houston 2.2.4 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +22 -22
- data/README.md +35 -14
- data/bin/apn +2 -2
- data/coverage/assets/{0.10.0 → 0.10.2}/application.css +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/application.js +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/border.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/controls.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/loading.gif +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/colorbox/loading_background.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/favicon_green.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/favicon_red.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/favicon_yellow.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/loading.gif +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/magnify.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/{0.10.0 → 0.10.2}/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +163 -128
- data/lib/houston/client.rb +2 -2
- data/lib/houston/connection.rb +2 -2
- data/lib/houston/notification.rb +6 -1
- data/lib/houston/version.rb +1 -1
- data/spec/notification_spec.rb +13 -5
- metadata +27 -27
data/lib/houston/client.rb
CHANGED
@@ -50,10 +50,10 @@ module Houston
|
|
50
50
|
connection.write(notification.message)
|
51
51
|
notification.mark_as_sent!
|
52
52
|
|
53
|
-
read_socket,
|
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
|
-
|
56
|
+
_command, status, index = error.unpack('ccN')
|
57
57
|
notification.apns_error_code = status
|
58
58
|
notification.mark_as_unsent!
|
59
59
|
end
|
data/lib/houston/connection.rb
CHANGED
data/lib/houston/notification.rb
CHANGED
@@ -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
|
data/lib/houston/version.rb
CHANGED
data/spec/notification_spec.rb
CHANGED
@@ -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(
|
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(
|
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,
|
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.
|
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:
|
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.
|
97
|
-
- "./coverage/assets/0.10.
|
98
|
-
- "./coverage/assets/0.10.
|
99
|
-
- "./coverage/assets/0.10.
|
100
|
-
- "./coverage/assets/0.10.
|
101
|
-
- "./coverage/assets/0.10.
|
102
|
-
- "./coverage/assets/0.10.
|
103
|
-
- "./coverage/assets/0.10.
|
104
|
-
- "./coverage/assets/0.10.
|
105
|
-
- "./coverage/assets/0.10.
|
106
|
-
- "./coverage/assets/0.10.
|
107
|
-
- "./coverage/assets/0.10.
|
108
|
-
- "./coverage/assets/0.10.
|
109
|
-
- "./coverage/assets/0.10.
|
110
|
-
- "./coverage/assets/0.10.
|
111
|
-
- "./coverage/assets/0.10.
|
112
|
-
- "./coverage/assets/0.10.
|
113
|
-
- "./coverage/assets/0.10.
|
114
|
-
- "./coverage/assets/0.10.
|
115
|
-
- "./coverage/assets/0.10.
|
116
|
-
- "./coverage/assets/0.10.
|
117
|
-
- "./coverage/assets/0.10.
|
118
|
-
- "./coverage/assets/0.10.
|
119
|
-
- "./coverage/assets/0.10.
|
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
|
151
|
+
rubygems_version: 2.7.6
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Send Apple Push Notifications
|