Module: ApplePush
- Defined in:
- lib/apple_push.rb,
lib/apple_push/server.rb,
lib/apple_push/version.rb,
lib/apple_push/configuration.rb
Defined Under Namespace
Classes: Configuration, Server
Constant Summary collapse
- LIVE_URL =
'gateway.push.apple.com'
- SANDBOX_URL =
'gateway.sandbox.push.apple.com'
- VERSION =
'0.1.2'
- @@options =
{}
- @@pools =
{}
Class Method Summary collapse
-
.configuration ⇒ Object
Get current configuration options.
- .configure(options = {}) ⇒ Object
-
.pool(env = 'sandbox') ⇒ Object
Get a connection from pool.
-
.pool?(env) ⇒ Boolean
Returns true if pools is configured.
Class Method Details
.configuration ⇒ Object
Get current configuration options
33 34 35 |
# File 'lib/apple_push.rb', line 33 def self.configuration @@options end |
.configure(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/apple_push.rb', line 14 def self.configure(={}) config = ApplePush::Configuration.new() @@options.merge!( :host => config.host || '127.0.0.1', :port => config.port || '27000', :timeout => config.timeout || 5 ) if !config.sandbox? && !config.live? raise ArgumentError, "At least one environment should be defined." end self.setup_environment('sandbox', config.sandbox) if config.sandbox? self.setup_environment('live', config.live) if config.live? end |
.pool(env = 'sandbox') ⇒ Object
Get a connection from pool
39 40 41 |
# File 'lib/apple_push.rb', line 39 def self.pool(env='sandbox') @@pools[env] end |
.pool?(env) ⇒ Boolean
Returns true if pools is configured
45 46 47 |
# File 'lib/apple_push.rb', line 45 def self.pool?(env) @@pools.key?(env) end |