tiny_apns 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,4 +2,4 @@
2
2
 
3
3
  This project rocks and uses MIT-LICENSE.
4
4
 
5
- Extracted from PRX/apns_on_rails. I only want something lightweight, all the heavy loads are taken by guys creating the original library.
5
+ Extracted from PRX/apns_on_rails. I only want something lightweight, all the heavy loads on figuring out how things works are taken by guys creating the original library.
@@ -61,7 +61,7 @@ module TinyAPNS
61
61
 
62
62
  class Connection
63
63
  def initialize(options)
64
- options.assert_valid_keys(:cert, :port, :host, :passphrase, :feedback_host, :gateway_host)
64
+ options.assert_valid_keys(:cert, :port, :host, :passphrase, :feedback_host, :gateway_host, :sandbox)
65
65
  @options=options.with_indifferent_access
66
66
  end
67
67
 
@@ -80,17 +80,20 @@ module TinyAPNS
80
80
  raise ArgumentError.new("Invalid mode, valid options are :gateway,:feedback") unless [:gateway, :feedback].include?(mode)
81
81
  raise ArgumentError.new("Missing option :cert") unless options.has_key?(:cert) || @options.has_key?(:cert)
82
82
 
83
- default_options={:passphrase=>''}
84
- host_suffix="push.apple.com"
85
- host_suffix="sandbox.#{host_suffix}" unless Rails.env.downcase=='production'
86
-
83
+ default_options={:passphrase=>'', :sandbox=>true}
84
+ host_suffix="push.apple.com"
85
+
87
86
  default_options[:host]=@options["#{mode}_host"] if @options.has_key?("#{mode}_host")
88
- default_options[:host]||="#{mode.to_s}.#{host_suffix}"
89
87
 
90
88
  default_options[:port]=(mode==:gateway ? 2195 : 2196)
91
89
 
92
90
  result=default_options.merge(@options.except(:feedback_host, :gateway_host)).merge(options)
93
- puts result.inspect
91
+
92
+ if result[:sandbox]
93
+ host_suffix="sandbox.#{host_suffix}"
94
+ result[:host]||="#{mode.to_s}.#{host_suffix}"
95
+ end
96
+
94
97
 
95
98
  return result.with_indifferent_access
96
99
  end
@@ -1,3 +1,3 @@
1
1
  module TinyApns
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_apns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2158081160 !ruby/object:Gem::Requirement
16
+ requirement: &2157030800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2158081160
24
+ version_requirements: *2157030800
25
25
  description: ''
26
26
  email:
27
27
  - william@tofugear.com
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -1604370820590864454
81
+ hash: 1087351227641187912
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: -1604370820590864454
90
+ hash: 1087351227641187912
91
91
  requirements: []
92
92
  rubyforge_project:
93
93
  rubygems_version: 1.8.9