repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/pushy/time_to_live_validator.rb | lib/rpush/client/active_model/pushy/time_to_live_validator.rb | module Rpush
module Client
module ActiveModel
module Pushy
class TimeToLiveValidator < ::ActiveModel::Validator
def validate(record)
return if record.time_to_live.blank? || record.time_to_live <= 1.year.seconds
record.errors.add(:time_to_live, 'The maximum value is ... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/pushy/app.rb | lib/rpush/client/active_model/pushy/app.rb | module Rpush
module Client
module ActiveModel
module Pushy
module App
def self.included(base)
base.instance_eval do
alias_attribute :api_key, :auth_key
validates :api_key, presence: true
end
end
def service_name
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/pushy/notification.rb | lib/rpush/client/active_model/pushy/notification.rb | module Rpush
module Client
module ActiveModel
module Pushy
module Notification
def self.included(base)
base.instance_eval do
alias_attribute :time_to_live, :expiry
validates :time_to_live, numericality: { only_integer: true, greater_than: 0 }, allow... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/apnsp8/app.rb | lib/rpush/client/active_model/apnsp8/app.rb | module Rpush
module Client
module ActiveModel
module Apnsp8
module App
def self.included(base)
base.instance_eval do
validates :environment, presence: true, inclusion: { in: %w(development production sandbox) }
validates :apn_key, presence: true
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/apnsp8/notification.rb | lib/rpush/client/active_model/apnsp8/notification.rb | module Rpush
module Client
module ActiveModel
module Apnsp8
include Rpush::Client::ActiveModel::Apns
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/wpns/app.rb | lib/rpush/client/active_model/wpns/app.rb | module Rpush
module Client
module ActiveModel
module Wpns
module App
def service_name
'wpns'
end
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/wpns/notification.rb | lib/rpush/client/active_model/wpns/notification.rb | module Rpush
module Client
module ActiveModel
module Wpns
module Notification
module InstanceMethods
def alert=(value)
return unless value
data = self.data || {}
data['title'] = value
self.data = data
end
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/adm/data_validator.rb | lib/rpush/client/active_model/adm/data_validator.rb | module Rpush
module Client
module ActiveModel
module Adm
class DataValidator < ::ActiveModel::Validator
def validate(record)
return unless record.collapse_key.nil? && record.data.nil?
record.errors.add :data, 'must be set unless collapse_key is specified'
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/adm/app.rb | lib/rpush/client/active_model/adm/app.rb | module Rpush
module Client
module ActiveModel
module Adm
module App
def self.included(base)
base.instance_eval do
validates :client_id, :client_secret, presence: true
end
end
def access_token_expired?
access_token_expir... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_model/adm/notification.rb | lib/rpush/client/active_model/adm/notification.rb | module Rpush
module Client
module ActiveModel
module Adm
module Notification
def self.included(base)
base.instance_eval do
validates :registration_ids, presence: true
validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator, limit: 6144
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/app.rb | lib/rpush/client/active_record/app.rb | module Rpush
module Client
module ActiveRecord
class App < ::ActiveRecord::Base
self.table_name = 'rpush_apps'
has_many :notifications, class_name: 'Rpush::Client::ActiveRecord::Notification', dependent: :destroy
validates :name, presence: true, uniqueness: { scope: [:type, :enviro... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/notification.rb | lib/rpush/client/active_record/notification.rb | module Rpush
module Client
module ActiveRecord
class Notification < ::ActiveRecord::Base
include Rpush::MultiJsonHelper
include Rpush::Client::ActiveModel::Notification
self.table_name = 'rpush_notifications'
self.default_column_serializer = YAML if respond_to?(:default_col... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/webpush/app.rb | lib/rpush/client/active_record/webpush/app.rb | module Rpush
module Client
module ActiveRecord
module Webpush
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Webpush::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/webpush/notification.rb | lib/rpush/client/active_record/webpush/notification.rb | module Rpush
module Client
module ActiveRecord
module Webpush
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Webpush::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/wns/app.rb | lib/rpush/client/active_record/wns/app.rb | module Rpush
module Client
module ActiveRecord
module Wns
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Wns::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/wns/raw_notification.rb | lib/rpush/client/active_record/wns/raw_notification.rb | module Rpush
module Client
module ActiveRecord
module Wns
class RawNotification < Rpush::Client::ActiveRecord::Notification
validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator,
limit: 5120
include Rpush::Client::ActiveModel::Wns::Notificat... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/wns/badge_notification.rb | lib/rpush/client/active_record/wns/badge_notification.rb | module Rpush
module Client
module ActiveRecord
module Wns
class BadgeNotification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Wns::Notification
def skip_data_validation?
true
end
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/wns/notification.rb | lib/rpush/client/active_record/wns/notification.rb | module Rpush
module Client
module ActiveRecord
module Wns
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Wns::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apns2/app.rb | lib/rpush/client/active_record/apns2/app.rb | module Rpush
module Client
module ActiveRecord
module Apns2
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Apns2::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apns2/notification.rb | lib/rpush/client/active_record/apns2/notification.rb | module Rpush
module Client
module ActiveRecord
module Apns2
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Apns::Notification
include Rpush::Client::ActiveModel::Apns2::Notification
include Rpush::Client::ActiveRecord:... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apns/feedback.rb | lib/rpush/client/active_record/apns/feedback.rb | module Rpush
module Client
module ActiveRecord
module Apns
class Feedback < ::ActiveRecord::Base
self.table_name = 'rpush_feedback'
belongs_to :app, class_name: 'Rpush::Client::ActiveRecord::App'
validates :device_token, presence: true
validates :failed_at, ... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apns/app.rb | lib/rpush/client/active_record/apns/app.rb | module Rpush
module Client
module ActiveRecord
module Apns
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Apns::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apns/active_record_serializable_notification.rb | lib/rpush/client/active_record/apns/active_record_serializable_notification.rb | module Rpush
module Client
module ActiveRecord
module Apns
module ActiveRecordSerializableNotification
def alert=(alert)
if alert.is_a?(Hash)
write_attribute(:alert, multi_json_dump(alert))
self.alert_is_json = true if has_attribute?(:alert_is_json)
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apns/notification.rb | lib/rpush/client/active_record/apns/notification.rb | module Rpush
module Client
module ActiveRecord
module Apns
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Apns::Notification
include ActiveRecordSerializableNotification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/fcm/app.rb | lib/rpush/client/active_record/fcm/app.rb | module Rpush
module Client
module ActiveRecord
module Fcm
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Fcm::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/fcm/notification.rb | lib/rpush/client/active_record/fcm/notification.rb | module Rpush
module Client
module ActiveRecord
module Fcm
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Fcm::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/pushy/app.rb | lib/rpush/client/active_record/pushy/app.rb | module Rpush
module Client
module ActiveRecord
module Pushy
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Pushy::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/pushy/notification.rb | lib/rpush/client/active_record/pushy/notification.rb | module Rpush
module Client
module ActiveRecord
module Pushy
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Pushy::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apnsp8/app.rb | lib/rpush/client/active_record/apnsp8/app.rb | module Rpush
module Client
module ActiveRecord
module Apnsp8
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Apnsp8::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/apnsp8/notification.rb | lib/rpush/client/active_record/apnsp8/notification.rb | module Rpush
module Client
module ActiveRecord
module Apnsp8
class Notification < Rpush::Client::ActiveRecord::Apns::Notification
include Rpush::Client::ActiveModel::Apns2::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/wpns/app.rb | lib/rpush/client/active_record/wpns/app.rb | module Rpush
module Client
module ActiveRecord
module Wpns
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Wpns::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/wpns/notification.rb | lib/rpush/client/active_record/wpns/notification.rb | module Rpush
module Client
module ActiveRecord
module Wpns
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Wpns::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/adm/app.rb | lib/rpush/client/active_record/adm/app.rb | module Rpush
module Client
module ActiveRecord
module Adm
class App < Rpush::Client::ActiveRecord::App
include Rpush::Client::ActiveModel::Adm::App
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/client/active_record/adm/notification.rb | lib/rpush/client/active_record/adm/notification.rb | module Rpush
module Client
module ActiveRecord
module Adm
class Notification < Rpush::Client::ActiveRecord::Notification
include Rpush::Client::ActiveModel::Adm::Notification
end
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/signal_handler.rb | lib/rpush/daemon/signal_handler.rb | module Rpush
module Daemon
class SignalHandler
extend Loggable
class << self
attr_reader :thread
end
def self.start
return unless trap_signals?
read_io, @write_io = IO.pipe
start_handler(read_io)
%w(INT TERM HUP USR2).each do |signal|
Si... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/service_config_methods.rb | lib/rpush/daemon/service_config_methods.rb | module Rpush
module Daemon
module ServiceConfigMethods
DISPATCHERS = {
http: Rpush::Daemon::Dispatcher::Http,
apns_http2: Rpush::Daemon::Dispatcher::ApnsHttp2,
apnsp8_http2: Rpush::Daemon::Dispatcher::Apnsp8Http2
}
def batch_deliveries(value = nil)
return b... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/batch.rb | lib/rpush/daemon/batch.rb | module Rpush
module Daemon
class Batch
include Reflectable
include Loggable
attr_reader :num_processed, :notifications, :delivered, :failed, :retryable
def initialize(notifications)
@notifications = notifications
@num_processed = 0
@delivered = []
@failed ... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/synchronizer.rb | lib/rpush/daemon/synchronizer.rb | module Rpush
module Daemon
class Synchronizer
extend Loggable
extend StringHelpers
APP_ATTRIBUTES_TO_CHECK = [:certificate, :environment, :auth_key, :client_id, :client_secret].freeze
def self.sync
apps = Rpush::Daemon.store.all_apps
apps.each { |app| sync_app(app) }
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/loggable.rb | lib/rpush/daemon/loggable.rb | module Rpush
module Daemon
module Loggable
def log_debug(msg)
Rpush.logger.debug(app_prefix(msg))
end
def log_info(msg)
Rpush.logger.info(app_prefix(msg))
end
def log_warn(msg)
Rpush.logger.warn(app_prefix(msg))
end
def log_error(e)
if e... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/feeder.rb | lib/rpush/daemon/feeder.rb | module Rpush
module Daemon
class Feeder
extend Reflectable
extend Loggable
def self.start(push_mode = false)
self.should_stop = false
@thread = Thread.new do
push_mode ? feed_all : feed_forever
Rpush::Daemon.store.release_connection
end
@thr... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/string_helpers.rb | lib/rpush/daemon/string_helpers.rb | module Rpush
module Daemon
module StringHelpers
def pluralize(count, singular, plural = nil)
if count == 1
word = singular
else
word = plural || singular.pluralize
end
"#{count || 0} #{word}"
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/app_runner.rb | lib/rpush/daemon/app_runner.rb | # encoding: UTF-8
module Rpush
module Daemon
class AppRunner
extend Reflectable
include Reflectable
include Loggable
extend Loggable
include StringHelpers
extend StringHelpers
@runners = {}
def self.enqueue(notifications)
notifications.group_by(&:app_id).... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/fcm.rb | lib/rpush/daemon/fcm.rb | module Rpush
module Daemon
module Fcm
extend ServiceConfigMethods
dispatcher :http
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/errors.rb | lib/rpush/daemon/errors.rb | module Rpush
class CertificateExpiredError < StandardError
attr_reader :app, :time
def initialize(app, time)
@app = app
@time = time
end
def to_s
message
end
def message
"#{app.name} certificate expired at #{time}."
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/ring_buffer.rb | lib/rpush/daemon/ring_buffer.rb | module Rpush
module Daemon
class RingBuffer < Array
def initialize(max_size)
@max_size = max_size
end
def <<(obj)
shift if size >= @max_size
super
end
alias_method :push, :<<
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/rpc.rb | lib/rpush/daemon/rpc.rb | module Rpush
module Daemon
module Rpc
def self.socket_path(pid = Process.pid)
"/tmp/rpush.#{pid}.sock"
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/queue_payload.rb | lib/rpush/daemon/queue_payload.rb | module Rpush
module Daemon
class QueuePayload
attr_reader :batch, :notification
def initialize(batch, notification = nil)
@batch = batch
@notification = notification
end
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/delivery_error.rb | lib/rpush/daemon/delivery_error.rb | module Rpush
class DeliveryError < StandardError
attr_reader :code, :notification_id
def initialize(code, notification_id, description)
@code = code
@notification_id = notification_id
@description = description
end
def to_s
message
end
def message
error_str = [... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/pushy.rb | lib/rpush/daemon/pushy.rb | module Rpush
module Daemon
module Pushy
extend ServiceConfigMethods
dispatcher :http
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/interruptible_sleep.rb | lib/rpush/daemon/interruptible_sleep.rb | module Rpush
module Daemon
class InterruptibleSleep
def sleep(duration)
@thread = Thread.new { Kernel.sleep duration }
Thread.pass
begin
@thread.join
rescue StandardError # rubocop:disable Lint/HandleExceptions
ensure
@thread = nil
end
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/webpush.rb | lib/rpush/daemon/webpush.rb | module Rpush
module Daemon
module Webpush
extend ServiceConfigMethods
dispatcher :http
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wpns.rb | lib/rpush/daemon/wpns.rb | module Rpush
module Daemon
module Wpns
extend ServiceConfigMethods
dispatcher :http
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/constants.rb | lib/rpush/daemon/constants.rb | module Rpush
module Daemon
HTTP_STATUS_CODES = {
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/adm.rb | lib/rpush/daemon/adm.rb | module Rpush
module Daemon
module Adm
extend ServiceConfigMethods
dispatcher :http
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/dispatcher_loop.rb | lib/rpush/daemon/dispatcher_loop.rb | module Rpush
module Daemon
class DispatcherLoop
include Reflectable
include Loggable
attr_reader :started_at, :dispatch_count
STOP = :stop
def initialize(queue, dispatcher)
@queue = queue
@dispatcher = dispatcher
@dispatch_count = 0
end
def thr... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/proc_title.rb | lib/rpush/daemon/proc_title.rb | module Rpush
module Daemon
class ProcTitle
def self.update
return if Rpush.config.embedded || Rpush.config.push
Process.respond_to?(:setproctitle) ? Process.setproctitle(proc_title) : $0 = proc_title
end
def self.proc_title
total_dispatchers = AppRunner.total_dispatchers... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/delivery.rb | lib/rpush/daemon/delivery.rb | module Rpush
module Daemon
class Delivery
include Reflectable
include Loggable
def mark_retryable(notification, deliver_after, error = nil)
if notification.fail_after && notification.fail_after < Time.now
@batch.mark_failed(notification, nil, "Notification failed to be deliver... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/retryable_error.rb | lib/rpush/daemon/retryable_error.rb | module Rpush
class RetryableError < StandardError
attr_reader :code, :description, :response
def initialize(code, notification_id, description, response)
@code = code
@notification_id = notification_id
@description = description
@response = response
end
def to_s
message... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wns.rb | lib/rpush/daemon/wns.rb | module Rpush
module Daemon
module Wns
extend ServiceConfigMethods
dispatcher :http
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/retry_header_parser.rb | lib/rpush/daemon/retry_header_parser.rb | module Rpush
module Daemon
class RetryHeaderParser
def self.parse(header)
new(header).parse
end
def initialize(header)
@header = header
end
def parse
return unless @header
if @header.to_s =~ /^[0-9]+$/
Time.now + @header.to_i
else
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/google_credential_cache.rb | lib/rpush/daemon/google_credential_cache.rb | require 'singleton'
module Rpush
module Daemon
class GoogleCredentialCache
include Singleton
include Loggable
# Assuming tokens are valid for 1 hour
TOKEN_VALID_FOR_SEC = 60 * 59
def initialize
@credentials_cache = {}
end
def access_token(scope, json_key)
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/apnsp8.rb | lib/rpush/daemon/apnsp8.rb | module Rpush
module Daemon
module Apnsp8
extend ServiceConfigMethods
batch_deliveries true
dispatcher :apnsp8_http2
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/apns2.rb | lib/rpush/daemon/apns2.rb | module Rpush
module Daemon
module Apns2
extend ServiceConfigMethods
batch_deliveries true
dispatcher :apns_http2
end
end
end
| ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/webpush/delivery.rb | lib/rpush/daemon/webpush/delivery.rb | # frozen_string_literal: true
require "web-push"
module Rpush
module Daemon
module Webpush
# Webpush::Request handles all the encryption / signing.
# We just override #perform to inject the http instance that is managed
# by Rpush.
#
class Request < ::WebPush::Request
def ... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wns/post_request.rb | lib/rpush/daemon/wns/post_request.rb | module Rpush
module Daemon
module Wns
class PostRequest
def self.create(notification, access_token)
stringify_keys(notification.data) unless notification.data.nil?
if raw_notification?(notification)
RawRequest.create(notification, access_token)
elsif badge_... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wns/badge_request.rb | lib/rpush/daemon/wns/badge_request.rb | module Rpush
module Daemon
module Wns
class BadgeRequest
def self.create(notification, access_token)
body = BadgeRequestPayload.new(notification).to_xml
uri = URI.parse(notification.uri)
headers = {
"Content-Length" => body.length.to_s,
"Content-... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wns/delivery.rb | lib/rpush/daemon/wns/delivery.rb | module Rpush
module Daemon
module Wns
# https://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx
class Delivery < Rpush::Daemon::Delivery
# Oauth2.0 token endpoint. This endpoint is used to request authorization tokens.
WPN_TOKEN_URI = URI.parse('https://login.live.com/acces... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wns/raw_request.rb | lib/rpush/daemon/wns/raw_request.rb | module Rpush
module Daemon
module Wns
class RawRequest
def self.create(notification, access_token)
body = notification.data.to_json
uri = URI.parse(notification.uri)
headers = {
"Content-Length" => body.length.to_s,
"Content-Type" => "application... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wns/toast_request.rb | lib/rpush/daemon/wns/toast_request.rb | module Rpush
module Daemon
module Wns
class ToastRequest
def self.create(notification, access_token)
body = ToastRequestPayload.new(notification).to_xml
uri = URI.parse(notification.uri)
headers = {
"Content-Length" => body.length.to_s,
"Content... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/dispatcher/http.rb | lib/rpush/daemon/dispatcher/http.rb | module Rpush
module Daemon
module Dispatcher
class Http
def initialize(app, delivery_class, _options = {})
@app = app
@delivery_class = delivery_class
@http = Net::HTTP::Persistent.new(name: 'rpush')
@http.proxy = Rpush.config.proxy_uri if Rpush.config.proxy_u... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/dispatcher/apns_http2.rb | lib/rpush/daemon/dispatcher/apns_http2.rb | module Rpush
module Daemon
module Dispatcher
class ApnsHttp2
include Loggable
include Reflectable
include Proxy
URLS = {
production: 'https://api.push.apple.com:443',
development: 'https://api.sandbox.push.apple.com:443',
sandbox: 'https://api.s... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/dispatcher/apnsp8_http2.rb | lib/rpush/daemon/dispatcher/apnsp8_http2.rb | module Rpush
module Daemon
module Dispatcher
class Apnsp8Http2
include Loggable
include Reflectable
include Proxy
URLS = {
production: 'https://api.push.apple.com',
development: 'https://api.sandbox.push.apple.com',
sandbox: 'https://api.sandbox... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/apns2/delivery.rb | lib/rpush/daemon/apns2/delivery.rb | module Rpush
module Daemon
module Apns2
# https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html
HTTP2_HEADERS_KEY = 'headers'
class Delivery < Rpush::Daemon::Delivery
RETRYABLE_CODES = [ 429, 500, 503 ]
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/store/active_record.rb | lib/rpush/daemon/store/active_record.rb | require 'active_record'
require 'rpush/daemon/store/active_record/reconnectable'
module Rpush
module Daemon
module Store
class ActiveRecord
include Reconnectable
DEFAULT_MARK_OPTIONS = { persist: true }
def initialize
reopen_log unless Rpush.config.embedded
end
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/store/redis.rb | lib/rpush/daemon/store/redis.rb | module Rpush
module Daemon
module Store
class Redis
DEFAULT_MARK_OPTIONS = { persist: true }
def app(app_id)
Rpush::Client::Redis::App.find(app_id)
end
def all_apps
Rpush::Client::Redis::App.all
end
def deliverable_notifications(limit)
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/store/interface.rb | lib/rpush/daemon/store/interface.rb | module Rpush
module Daemon
module Store
class Interface
PUBLIC_METHODS = [:deliverable_notifications, :mark_retryable,
:mark_batch_retryable, :mark_delivered, :mark_batch_delivered,
:mark_failed, :mark_batch_failed,
:creat... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/store/active_record/reconnectable.rb | lib/rpush/daemon/store/active_record/reconnectable.rb | class PGError < StandardError; end unless defined?(PGError)
module PG
class Error < StandardError; end unless defined?(::PG::Error)
end
class Mysql; class Error < StandardError; end; end unless defined?(Mysql)
module Mysql2; class Error < StandardError; end; end unless defined?(Mysql2)
module ActiveRecord
class JDB... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/rpc/client.rb | lib/rpush/daemon/rpc/client.rb | module Rpush
module Daemon
module Rpc
class Client
def initialize(pid)
@socket = UNIXSocket.open(Rpc.socket_path(pid))
end
def status
call(:status)
end
def close
@socket.close
rescue StandardError # rubocop:disable Lint/HandleEx... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/rpc/server.rb | lib/rpush/daemon/rpc/server.rb | require 'socket'
require 'singleton'
module Rpush
module Daemon
module Rpc
class Server
include Singleton
include Loggable
include Reflectable
def self.start
instance.start
end
def self.stop
instance.stop
end
def start
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/fcm/delivery.rb | lib/rpush/daemon/fcm/delivery.rb | module Rpush
module Daemon
module Fcm
# https://firebase.google.com/docs/cloud-messaging/server
class Delivery < Rpush::Daemon::Delivery
include MultiJsonHelper
HOST = 'https://fcm.googleapis.com'.freeze
SCOPE = 'https://www.googleapis.com/auth/firebase.messaging'.freeze
... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/pushy/delivery.rb | lib/rpush/daemon/pushy/delivery.rb | module Rpush
module Daemon
module Pushy
class Delivery < Rpush::Daemon::Delivery
include MultiJsonHelper
attr_reader :http, :notification, :batch, :pushy_uri
def initialize(app, http, notification, batch)
@http = http
@notification = notification
@batc... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/apnsp8/delivery.rb | lib/rpush/daemon/apnsp8/delivery.rb | module Rpush
module Daemon
module Apnsp8
# https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html
HTTP2_HEADERS_KEY = 'headers'
class Delivery < Rpush::Daemon::Delivery
RETRYABLE_CODES = [ 429, 500, 503 ]... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/apnsp8/token.rb | lib/rpush/daemon/apnsp8/token.rb | module Rpush
module Daemon
module Apnsp8
TOKEN_TTL = 30 * 60
class Token
def initialize(app)
@app = app
end
def token
if @cached_token && !expired_token?
@cached_token
else
new_token
end
end
priva... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/wpns/delivery.rb | lib/rpush/daemon/wpns/delivery.rb | module Rpush
module Daemon
module Wpns
# http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff941100%28v=vs.105%29.aspx
class Delivery < Rpush::Daemon::Delivery
FAILURE_MESSAGES = {
400 => 'Bad XML or malformed notification URI.',
401 => 'Unauthorized to send a no... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
rpush/rpush | https://github.com/rpush/rpush/blob/a5ea408d732227c2ed0d23f8a91001d40768152e/lib/rpush/daemon/adm/delivery.rb | lib/rpush/daemon/adm/delivery.rb | module Rpush
module Daemon
module Adm
# https://developer.amazon.com/sdk/adm/sending-message.html
class Delivery < Rpush::Daemon::Delivery
include MultiJsonHelper
# Oauth2.0 token endpoint. This endpoint is used to request authorization tokens.
AMAZON_TOKEN_URI = URI.parse('ht... | ruby | MIT | a5ea408d732227c2ed0d23f8a91001d40768152e | 2026-01-04T15:57:16.574030Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/test/test_nifty_layout_generator.rb | test/test_nifty_layout_generator.rb | require File.join(File.dirname(__FILE__), "test_helper.rb")
class TestNiftyLayoutGenerator < Test::Unit::TestCase
include NiftyGenerators::TestHelper
# Some generator-related assertions:
# assert_generated_file(name, &block) # block passed the file contents
# assert_directory_exists(name)
# assert_gen... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/test/test_nifty_scaffold_generator.rb | test/test_nifty_scaffold_generator.rb | require File.join(File.dirname(__FILE__), "test_helper.rb")
class TestNiftyScaffoldGenerator < Test::Unit::TestCase
include NiftyGenerators::TestHelper
# Some generator-related assertions:
# assert_generated_file(name, &block) # block passed the file contents
# assert_directory_exists(name)
# assert_g... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/test/test_helper.rb | test/test_helper.rb | require 'test/unit'
# Must set before requiring generator libs.
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
app_root = File.join(TMP_ROOT, PROJECT_NAME)
if defined?(APP_ROOT)
APP_ROOT.replace(app_root)
else
APP_ROOT = app_root
end
if... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/test/test_nifty_authentication_generator.rb | test/test_nifty_authentication_generator.rb | require File.join(File.dirname(__FILE__), "test_helper.rb")
class TestNiftyAuthenticationGenerator < Test::Unit::TestCase
include NiftyGenerators::TestHelper
# Some generator-related assertions:
# assert_generated_file(name, &block) # block passed the file contents
# assert_directory_exists(name)
# as... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/test/test_nifty_config_generator.rb | test/test_nifty_config_generator.rb | require File.join(File.dirname(__FILE__), "test_helper.rb")
class TestNiftyConfigGenerator < Test::Unit::TestCase
include NiftyGenerators::TestHelper
# Some generator-related assertions:
# assert_generated_file(name, &block) # block passed the file contents
# assert_directory_exists(name)
# assert_gen... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/features/support/matchers.rb | features/support/matchers.rb | RSpec::Matchers.define :exist do |path|
match do
File.exist?(path)
end
failure_message_for_should { "Expected #{path} to exist but no file found" }
failure_message_for_should_not { "Expected #{path} to not exist but file was found" }
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/features/support/env.rb | features/support/env.rb | require 'cucumber'
require 'rspec'
Before do
FileUtils.rm_rf "tmp/rails_app"
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/features/step_definitions/common_steps.rb | features/step_definitions/common_steps.rb | When /^I run "([^\"]*)"$/ do |command|
system("cd #{@current_directory} && #{command}").should be_true
end
When /^I add "([^\"]*)" to file "([^\"]*)"$/ do |content, short_path|
path = File.join(@current_directory, short_path)
File.should exist(path)
File.open(path, 'a') { |f| f.write(content + "\n") }
end
Whe... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/features/step_definitions/rails_setup_steps.rb | features/step_definitions/rails_setup_steps.rb | Given /^a new Rails app$/ do
FileUtils.mkdir_p("tmp")
system("rails new tmp/rails_app").should be_true
system("ln -s ../../../lib/generators tmp/rails_app/lib/generators").should be_true
@current_directory = File.expand_path("tmp/rails_app")
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty.rb | lib/generators/nifty.rb | require 'rails/generators/base'
module Nifty
module Generators
class Base < Rails::Generators::Base #:nodoc:
def self.source_root
@_nifty_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'nifty', generator_name, 'templates'))
end
def self.banner
"rails generat... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/scaffold_generator.rb | lib/generators/nifty/scaffold/scaffold_generator.rb | require 'generators/nifty'
require 'rails/generators/migration'
require 'rails/generators/generated_attribute'
module Nifty
module Generators
class ScaffoldGenerator < Base
include Rails::Generators::Migration
no_tasks { attr_accessor :scaffold_name, :model_attributes, :controller_actions }
ar... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/controller.rb | lib/generators/nifty/scaffold/templates/controller.rb | class <%= plural_class_name %>Controller < ApplicationController
<%= controller_methods :actions %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/helper.rb | lib/generators/nifty/scaffold/templates/helper.rb | module <%= plural_class_name %>Helper
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/migration.rb | lib/generators/nifty/scaffold/templates/migration.rb | class Create<%= class_name.pluralize.delete('::') %> < ActiveRecord::Migration
def self.up
create_table :<%= table_name || plural_name.split('/').last %> do |t|
<%- for attribute in model_attributes -%>
t.<%= attribute.type %> :<%= attribute.name %>
<%- end -%>
<%- unless options[:skip_timestamp... | ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
ryanb/nifty-generators | https://github.com/ryanb/nifty-generators/blob/e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8/lib/generators/nifty/scaffold/templates/model.rb | lib/generators/nifty/scaffold/templates/model.rb | class <%= class_name %> < ActiveRecord::Base
<%= " set_table_name :#{table_name}\n" if table_name -%>
attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
end
| ruby | MIT | e1e10a0f4c513167e6b0456214b3a4f8fb8f38e8 | 2026-01-04T15:59:06.695584Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.