houston 2.2.4 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +22 -22
  3. data/README.md +35 -14
  4. data/bin/apn +2 -2
  5. data/coverage/assets/{0.10.0 → 0.10.2}/application.css +0 -0
  6. data/coverage/assets/{0.10.0 → 0.10.2}/application.js +0 -0
  7. data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/border.png +0 -0
  8. data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/controls.png +0 -0
  9. data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/loading.gif +0 -0
  10. data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/loading_background.png +0 -0
  11. data/coverage/assets/{0.10.0 → 0.10.2}/favicon_green.png +0 -0
  12. data/coverage/assets/{0.10.0 → 0.10.2}/favicon_red.png +0 -0
  13. data/coverage/assets/{0.10.0 → 0.10.2}/favicon_yellow.png +0 -0
  14. data/coverage/assets/{0.10.0 → 0.10.2}/loading.gif +0 -0
  15. data/coverage/assets/{0.10.0 → 0.10.2}/magnify.png +0 -0
  16. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  17. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  18. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  19. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  20. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  21. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  22. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  23. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  24. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_222222_256x240.png +0 -0
  25. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  26. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_454545_256x240.png +0 -0
  27. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_888888_256x240.png +0 -0
  28. data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  29. data/coverage/index.html +163 -128
  30. data/lib/houston/client.rb +2 -2
  31. data/lib/houston/connection.rb +2 -2
  32. data/lib/houston/notification.rb +6 -1
  33. data/lib/houston/version.rb +1 -1
  34. data/spec/notification_spec.rb +13 -5
  35. metadata +27 -27
@@ -50,10 +50,10 @@ module Houston
50
50
  connection.write(notification.message)
51
51
  notification.mark_as_sent!
52
52
 
53
- read_socket, write_socket = IO.select([ssl], [ssl], [ssl], nil)
53
+ read_socket, _write_socket = IO.select([ssl], [ssl], [ssl], nil)
54
54
  if (read_socket && read_socket[0])
55
55
  if error = connection.read(6)
56
- command, status, index = error.unpack('ccN')
56
+ _command, status, index = error.unpack('ccN')
57
57
  notification.apns_error_code = status
58
58
  notification.mark_as_unsent!
59
59
  end
@@ -26,8 +26,8 @@ module Houston
26
26
 
27
27
  def initialize(uri, certificate, passphrase)
28
28
  @uri = URI(uri)
29
- @certificate = certificate
30
- @passphrase = passphrase
29
+ @certificate = certificate.to_s
30
+ @passphrase = passphrase.to_s unless passphrase.nil?
31
31
  end
32
32
 
33
33
  def open
@@ -30,7 +30,7 @@ module Houston
30
30
  MAXIMUM_PAYLOAD_SIZE = 2048
31
31
 
32
32
  attr_accessor :token, :alert, :badge, :sound, :category, :content_available, :mutable_content,
33
- :custom_data, :id, :expiry, :priority
33
+ :custom_data, :id, :expiry, :priority, :url_args
34
34
  attr_reader :sent_at
35
35
  attr_writer :apns_error_code
36
36
 
@@ -48,8 +48,12 @@ module Houston
48
48
  @priority = options.delete(:priority)
49
49
  @content_available = options.delete(:content_available)
50
50
  @mutable_content = options.delete(:mutable_content)
51
+ @url_args = options.delete(:url_args)
51
52
 
52
53
  @custom_data = options
54
+
55
+ @sent_at = nil
56
+ @apns_error_code = nil
53
57
  end
54
58
 
55
59
  def payload
@@ -62,6 +66,7 @@ module Houston
62
66
  json['aps']['category'] = @category if @category
63
67
  json['aps']['content-available'] = 1 if @content_available
64
68
  json['aps']['mutable-content'] = 1 if @mutable_content
69
+ json['aps']['url-args'] = @url_args if @url_args
65
70
 
66
71
  json
67
72
  end
@@ -1,3 +1,3 @@
1
1
  module Houston
2
- VERSION = '2.2.4'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -13,7 +13,8 @@ describe Houston::Notification do
13
13
  priority: 10,
14
14
  content_available: true,
15
15
  key1: 1,
16
- key2: 'abc'
16
+ key2: 'abc',
17
+ url_args: %w[boarding A998]
17
18
  }
18
19
  }
19
20
 
@@ -69,6 +70,11 @@ describe Houston::Notification do
69
70
  it { should == { key1: 1, key2: 'abc' } }
70
71
  end
71
72
 
73
+ describe '#url_args' do
74
+ subject { super().url_args }
75
+ it { should == %w[boarding A998] }
76
+ end
77
+
72
78
  context 'using :device instead of :token' do
73
79
  subject do
74
80
  notification_options[:device] = notification_options[:token]
@@ -84,12 +90,14 @@ describe Houston::Notification do
84
90
 
85
91
  describe '#payload' do
86
92
  it 'should create a compliant dictionary' do
87
- expect(subject.payload).to eq( 'aps' => {
93
+ expect(subject.payload).to eq(
94
+ 'aps' => {
88
95
  'alert' => 'Houston, we have a problem.',
89
96
  'badge' => 2701,
90
97
  'sound' => 'sosumi.aiff',
91
98
  'category' => 'INVITE_CATEGORY',
92
- 'content-available' => 1
99
+ 'content-available' => 1,
100
+ 'url-args' => %w[boarding A998]
93
101
  },
94
102
  'key1' => 1,
95
103
  'key2' => 'abc')
@@ -179,7 +187,7 @@ describe Houston::Notification do
179
187
 
180
188
  it 'should create a message with correct frame length' do
181
189
  _1, length, _2 = subject.message.unpack('cNa*')
182
- expect(length).to eq(211)
190
+ expect(length).to eq(242)
183
191
  end
184
192
 
185
193
  def parse_items(items_stream)
@@ -206,7 +214,7 @@ describe Houston::Notification do
206
214
  it 'should include an item #2 with the payload as JSON' do
207
215
  _1, _2, items_stream = subject.message.unpack('cNa*')
208
216
  items = parse_items(items_stream)
209
- expect(items).to include([2, 155, '{"key1":1,"key2":"abc","aps":{"alert":"Houston, we have a problem.","badge":2701,"sound":"sosumi.aiff","category":"INVITE_CATEGORY","content-available":1}}'])
217
+ expect(items).to include([2, 186, '{"key1":1,"key2":"abc","aps":{"alert":"Houston, we have a problem.","badge":2701,"sound":"sosumi.aiff","category":"INVITE_CATEGORY","content-available":1,"url-args":["boarding","A998"]}}'])
210
218
  end
211
219
 
212
220
  it 'should include an item #3 with the identifier' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houston
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2018-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -93,30 +93,30 @@ files:
93
93
  - "./LICENSE"
94
94
  - "./README.md"
95
95
  - "./Rakefile"
96
- - "./coverage/assets/0.10.0/application.css"
97
- - "./coverage/assets/0.10.0/application.js"
98
- - "./coverage/assets/0.10.0/colorbox/border.png"
99
- - "./coverage/assets/0.10.0/colorbox/controls.png"
100
- - "./coverage/assets/0.10.0/colorbox/loading.gif"
101
- - "./coverage/assets/0.10.0/colorbox/loading_background.png"
102
- - "./coverage/assets/0.10.0/favicon_green.png"
103
- - "./coverage/assets/0.10.0/favicon_red.png"
104
- - "./coverage/assets/0.10.0/favicon_yellow.png"
105
- - "./coverage/assets/0.10.0/loading.gif"
106
- - "./coverage/assets/0.10.0/magnify.png"
107
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png"
108
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png"
109
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png"
110
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png"
111
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png"
112
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png"
113
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png"
114
- - "./coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png"
115
- - "./coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png"
116
- - "./coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png"
117
- - "./coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png"
118
- - "./coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png"
119
- - "./coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png"
96
+ - "./coverage/assets/0.10.2/application.css"
97
+ - "./coverage/assets/0.10.2/application.js"
98
+ - "./coverage/assets/0.10.2/colorbox/border.png"
99
+ - "./coverage/assets/0.10.2/colorbox/controls.png"
100
+ - "./coverage/assets/0.10.2/colorbox/loading.gif"
101
+ - "./coverage/assets/0.10.2/colorbox/loading_background.png"
102
+ - "./coverage/assets/0.10.2/favicon_green.png"
103
+ - "./coverage/assets/0.10.2/favicon_red.png"
104
+ - "./coverage/assets/0.10.2/favicon_yellow.png"
105
+ - "./coverage/assets/0.10.2/loading.gif"
106
+ - "./coverage/assets/0.10.2/magnify.png"
107
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png"
108
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png"
109
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png"
110
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png"
111
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png"
112
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png"
113
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png"
114
+ - "./coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png"
115
+ - "./coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png"
116
+ - "./coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png"
117
+ - "./coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png"
118
+ - "./coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png"
119
+ - "./coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png"
120
120
  - "./coverage/index.html"
121
121
  - "./houston.gemspec"
122
122
  - "./lib/houston.rb"
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.6.8
151
+ rubygems_version: 2.7.6
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Send Apple Push Notifications