houston 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +27 -24
- data/LICENSE +1 -1
- data/README.md +60 -15
- data/Rakefile +4 -8
- data/coverage/assets/{0.8.0 → 0.10.0}/application.css +0 -0
- data/coverage/assets/{0.8.0 → 0.10.0}/application.js +1079 -931
- data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/border.png +0 -0
- data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/controls.png +0 -0
- data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/loading.gif +0 -0
- data/coverage/assets/{0.8.0 → 0.10.0}/colorbox/loading_background.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/favicon_green.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/favicon_red.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/favicon_yellow.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/loading.gif +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/magnify.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/{0.7.1 → 0.10.0}/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +296 -184
- data/houston.gemspec +17 -17
- data/lib/houston/client.rb +16 -8
- data/lib/houston/connection.rb +1 -1
- data/lib/houston/notification.rb +33 -30
- data/lib/houston/version.rb +1 -1
- data/spec/client_spec.rb +13 -13
- data/spec/notification_spec.rb +25 -21
- data/spec/spec_helper.rb +2 -2
- metadata +56 -97
- data/coverage/assets/0.7.1/application.css +0 -1110
- data/coverage/assets/0.7.1/application.js +0 -626
- data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
- data/coverage/assets/0.8.0/favicon_green.png +0 -0
- data/coverage/assets/0.8.0/favicon_red.png +0 -0
- data/coverage/assets/0.8.0/favicon_yellow.png +0 -0
- data/coverage/assets/0.8.0/loading.gif +0 -0
- data/coverage/assets/0.8.0/magnify.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/houston-2.2.2.gem +0 -0
data/houston.gemspec
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'houston/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
7
|
-
s.authors = [
|
8
|
-
s.email =
|
9
|
-
s.license =
|
10
|
-
s.homepage =
|
6
|
+
s.name = 'houston'
|
7
|
+
s.authors = ['Mattt Thompson']
|
8
|
+
s.email = 'm@mattt.me'
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.homepage = 'http://nomad-cli.com'
|
11
11
|
s.version = Houston::VERSION
|
12
12
|
s.platform = Gem::Platform::RUBY
|
13
|
-
s.summary =
|
14
|
-
s.description =
|
13
|
+
s.summary = 'Send Apple Push Notifications'
|
14
|
+
s.description = 'Houston is a simple gem for sending Apple Push Notifications. Pass your credentials, construct your message, and send it.'
|
15
15
|
|
16
|
-
s.add_dependency
|
17
|
-
s.add_dependency
|
16
|
+
s.add_dependency 'commander', '~> 4.4'
|
17
|
+
s.add_dependency 'json'
|
18
18
|
|
19
|
-
s.add_development_dependency
|
20
|
-
s.add_development_dependency
|
21
|
-
s.add_development_dependency
|
19
|
+
s.add_development_dependency 'rspec', '~> 3.5'
|
20
|
+
s.add_development_dependency 'rake'
|
21
|
+
s.add_development_dependency 'simplecov'
|
22
22
|
|
23
|
-
s.files = Dir[
|
23
|
+
s.files = Dir['./**/*'].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
|
24
24
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
|
-
s.require_paths = [
|
25
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
26
|
+
s.require_paths = ['lib']
|
27
27
|
end
|
data/lib/houston/client.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Houston
|
2
|
-
APPLE_PRODUCTION_GATEWAY_URI =
|
3
|
-
APPLE_PRODUCTION_FEEDBACK_URI =
|
2
|
+
APPLE_PRODUCTION_GATEWAY_URI = 'apn://gateway.push.apple.com:2195'
|
3
|
+
APPLE_PRODUCTION_FEEDBACK_URI = 'apn://feedback.push.apple.com:2196'
|
4
4
|
|
5
|
-
APPLE_DEVELOPMENT_GATEWAY_URI =
|
6
|
-
APPLE_DEVELOPMENT_FEEDBACK_URI =
|
5
|
+
APPLE_DEVELOPMENT_GATEWAY_URI = 'apn://gateway.sandbox.push.apple.com:2195'
|
6
|
+
APPLE_DEVELOPMENT_FEEDBACK_URI = 'apn://feedback.sandbox.push.apple.com:2196'
|
7
7
|
|
8
8
|
class Client
|
9
9
|
attr_accessor :gateway_uri, :feedback_uri, :certificate, :passphrase, :timeout
|
@@ -27,7 +27,7 @@ module Houston
|
|
27
27
|
def initialize
|
28
28
|
@gateway_uri = ENV['APN_GATEWAY_URI']
|
29
29
|
@feedback_uri = ENV['APN_FEEDBACK_URI']
|
30
|
-
@certificate =
|
30
|
+
@certificate = certificate_data
|
31
31
|
@passphrase = ENV['APN_CERTIFICATE_PASSPHRASE']
|
32
32
|
@timeout = Float(ENV['APN_TIMEOUT'] || 0.5)
|
33
33
|
end
|
@@ -53,7 +53,7 @@ module Houston
|
|
53
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(
|
56
|
+
command, status, index = error.unpack('ccN')
|
57
57
|
notification.apns_error_code = status
|
58
58
|
notification.mark_as_unsent!
|
59
59
|
end
|
@@ -70,7 +70,7 @@ module Houston
|
|
70
70
|
feedback = line.unpack('N1n1H140')
|
71
71
|
timestamp = feedback[0]
|
72
72
|
token = feedback[2].scan(/.{0,8}/).join(' ').strip
|
73
|
-
devices << {token: token, timestamp: timestamp} if token && timestamp
|
73
|
+
devices << { token: token, timestamp: timestamp } if token && timestamp
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -78,7 +78,15 @@ module Houston
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def devices
|
81
|
-
unregistered_devices.collect{|device| device[:token]}
|
81
|
+
unregistered_devices.collect { |device| device[:token] }
|
82
|
+
end
|
83
|
+
|
84
|
+
def certificate_data
|
85
|
+
if ENV['APN_CERTIFICATE']
|
86
|
+
File.read(ENV['APN_CERTIFICATE'])
|
87
|
+
elsif ENV['APN_CERTIFICATE_DATA']
|
88
|
+
ENV['APN_CERTIFICATE_DATA']
|
89
|
+
end
|
82
90
|
end
|
83
91
|
end
|
84
92
|
end
|
data/lib/houston/connection.rb
CHANGED
data/lib/houston/notification.rb
CHANGED
@@ -5,17 +5,17 @@ module Houston
|
|
5
5
|
class APNSError < RuntimeError
|
6
6
|
# See: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW12
|
7
7
|
CODES = {
|
8
|
-
0 =>
|
9
|
-
1 =>
|
10
|
-
2 =>
|
11
|
-
3 =>
|
12
|
-
4 =>
|
13
|
-
5 =>
|
14
|
-
6 =>
|
15
|
-
7 =>
|
16
|
-
8 =>
|
17
|
-
10 =>
|
18
|
-
255 =>
|
8
|
+
0 => 'No errors encountered',
|
9
|
+
1 => 'Processing error',
|
10
|
+
2 => 'Missing device token',
|
11
|
+
3 => 'Missing topic',
|
12
|
+
4 => 'Missing payload',
|
13
|
+
5 => 'Invalid token size',
|
14
|
+
6 => 'Invalid topic size',
|
15
|
+
7 => 'Invalid payload size',
|
16
|
+
8 => 'Invalid token',
|
17
|
+
10 => 'Shutdown',
|
18
|
+
255 => 'Unknown error'
|
19
19
|
}
|
20
20
|
|
21
21
|
attr_reader :code
|
@@ -29,7 +29,8 @@ module Houston
|
|
29
29
|
|
30
30
|
MAXIMUM_PAYLOAD_SIZE = 2048
|
31
31
|
|
32
|
-
attr_accessor :token, :alert, :badge, :sound, :category, :content_available, :
|
32
|
+
attr_accessor :token, :alert, :badge, :sound, :category, :content_available, :mutable_content,
|
33
|
+
:custom_data, :id, :expiry, :priority
|
33
34
|
attr_reader :sent_at
|
34
35
|
attr_writer :apns_error_code
|
35
36
|
|
@@ -46,12 +47,13 @@ module Houston
|
|
46
47
|
@id = options.delete(:id)
|
47
48
|
@priority = options.delete(:priority)
|
48
49
|
@content_available = options.delete(:content_available)
|
50
|
+
@mutable_content = options.delete(:mutable_content)
|
49
51
|
|
50
52
|
@custom_data = options
|
51
53
|
end
|
52
54
|
|
53
55
|
def payload
|
54
|
-
json = {}.merge(@custom_data || {}).inject({}){|h,(k,v)| h[k.to_s] = v; h}
|
56
|
+
json = {}.merge(@custom_data || {}).inject({}) { |h, (k, v)| h[k.to_s] = v; h }
|
55
57
|
|
56
58
|
json['aps'] ||= {}
|
57
59
|
json['aps']['alert'] = @alert if @alert
|
@@ -59,6 +61,7 @@ module Houston
|
|
59
61
|
json['aps']['sound'] = @sound if @sound
|
60
62
|
json['aps']['category'] = @category if @category
|
61
63
|
json['aps']['content-available'] = 1 if @content_available
|
64
|
+
json['aps']['mutable-content'] = 1 if @mutable_content
|
62
65
|
|
63
66
|
json
|
64
67
|
end
|
@@ -89,30 +92,30 @@ module Houston
|
|
89
92
|
end
|
90
93
|
|
91
94
|
def error
|
92
|
-
APNSError.new(@apns_error_code) if @apns_error_code
|
95
|
+
APNSError.new(@apns_error_code) if @apns_error_code && @apns_error_code.nonzero?
|
93
96
|
end
|
94
97
|
|
95
98
|
private
|
96
99
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
+
def device_token_item
|
101
|
+
[1, 32, @token.gsub(/[<\s>]/, '')].pack('cnH64')
|
102
|
+
end
|
100
103
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
104
|
+
def payload_item
|
105
|
+
json = payload.to_json
|
106
|
+
[2, json.bytes.count, json].pack('cna*')
|
107
|
+
end
|
105
108
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
+
def identifier_item
|
110
|
+
[3, 4, @id].pack('cnN') unless @id.nil?
|
111
|
+
end
|
109
112
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
+
def expiration_item
|
114
|
+
[4, 4, @expiry.to_i].pack('cnN') unless @expiry.nil?
|
115
|
+
end
|
113
116
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
def priority_item
|
118
|
+
[5, 1, @priority].pack('cnc') unless @priority.nil?
|
119
|
+
end
|
117
120
|
end
|
118
121
|
end
|
data/lib/houston/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Houston::Client do
|
|
4
4
|
subject { Houston::Client.development }
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
stub_const(
|
7
|
+
stub_const('Houston::Connection', MockConnection)
|
8
8
|
end
|
9
9
|
|
10
10
|
context '#development' do
|
@@ -12,12 +12,12 @@ describe Houston::Client do
|
|
12
12
|
|
13
13
|
describe '#gateway_uri' do
|
14
14
|
subject { super().gateway_uri }
|
15
|
-
it { should == Houston::APPLE_DEVELOPMENT_GATEWAY_URI}
|
15
|
+
it { should == Houston::APPLE_DEVELOPMENT_GATEWAY_URI }
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#feedback_uri' do
|
19
19
|
subject { super().feedback_uri }
|
20
|
-
it { should == Houston::APPLE_DEVELOPMENT_FEEDBACK_URI}
|
20
|
+
it { should == Houston::APPLE_DEVELOPMENT_FEEDBACK_URI }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -26,21 +26,21 @@ describe Houston::Client do
|
|
26
26
|
|
27
27
|
describe '#gateway_uri' do
|
28
28
|
subject { super().gateway_uri }
|
29
|
-
it { should == Houston::APPLE_PRODUCTION_GATEWAY_URI}
|
29
|
+
it { should == Houston::APPLE_PRODUCTION_GATEWAY_URI }
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#feedback_uri' do
|
33
33
|
subject { super().feedback_uri }
|
34
|
-
it { should == Houston::APPLE_PRODUCTION_FEEDBACK_URI}
|
34
|
+
it { should == Houston::APPLE_PRODUCTION_FEEDBACK_URI }
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context '#new' do
|
39
39
|
context 'passing options through ENV' do
|
40
|
-
ENV['APN_GATEWAY_URI'] =
|
41
|
-
ENV['APN_FEEDBACK_URI'] =
|
42
|
-
ENV['APN_CERTIFICATE_PASSPHRASE'] =
|
43
|
-
ENV['APN_TIMEOUT'] =
|
40
|
+
ENV['APN_GATEWAY_URI'] = 'apn://gateway.example.com'
|
41
|
+
ENV['APN_FEEDBACK_URI'] = 'apn://feedback.example.com'
|
42
|
+
ENV['APN_CERTIFICATE_PASSPHRASE'] = 'passphrase'
|
43
|
+
ENV['APN_TIMEOUT'] = '10.0'
|
44
44
|
|
45
45
|
subject do
|
46
46
|
Houston::Client.new
|
@@ -83,8 +83,8 @@ describe Houston::Client do
|
|
83
83
|
describe '#unregistered_devices' do
|
84
84
|
it 'should correctly parse the feedback response and create a dictionary of unregistered devices with timestamps' do
|
85
85
|
expect(subject.unregistered_devices).to eq [
|
86
|
-
{:
|
87
|
-
{:
|
86
|
+
{ token: 'ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5969', timestamp: 443779200 },
|
87
|
+
{ token: 'ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5970', timestamp: 1388678223 }
|
88
88
|
]
|
89
89
|
end
|
90
90
|
end
|
@@ -92,8 +92,8 @@ describe Houston::Client do
|
|
92
92
|
describe '#devices' do
|
93
93
|
it 'should correctly parse the feedback response and create an array of unregistered devices' do
|
94
94
|
expect(subject.devices).to eq [
|
95
|
-
|
96
|
-
|
95
|
+
'ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5969',
|
96
|
+
'ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5970'
|
97
97
|
]
|
98
98
|
end
|
99
99
|
end
|
data/spec/notification_spec.rb
CHANGED
@@ -84,8 +84,7 @@ describe Houston::Notification do
|
|
84
84
|
|
85
85
|
describe '#payload' do
|
86
86
|
it 'should create a compliant dictionary' do
|
87
|
-
expect(subject.payload).to eq({
|
88
|
-
'aps' => {
|
87
|
+
expect(subject.payload).to eq( 'aps' => {
|
89
88
|
'alert' => 'Houston, we have a problem.',
|
90
89
|
'badge' => 2701,
|
91
90
|
'sound' => 'sosumi.aiff',
|
@@ -93,60 +92,65 @@ describe Houston::Notification do
|
|
93
92
|
'content-available' => 1
|
94
93
|
},
|
95
94
|
'key1' => 1,
|
96
|
-
'key2' => 'abc'
|
97
|
-
})
|
95
|
+
'key2' => 'abc')
|
98
96
|
end
|
99
97
|
|
100
98
|
it 'should create a dictionary of only custom data and empty aps' do
|
101
|
-
expect(Houston::Notification.new(key1: 123, key2: 'xyz').payload).to eq(
|
99
|
+
expect(Houston::Notification.new(key1: 123, key2: 'xyz').payload).to eq(
|
102
100
|
'aps' => {},
|
103
101
|
'key1' => 123,
|
104
102
|
'key2' => 'xyz'
|
105
|
-
|
103
|
+
)
|
106
104
|
end
|
107
105
|
|
108
106
|
it 'should create a dictionary only with alerts' do
|
109
|
-
expect(Houston::Notification.new(alert: 'Hello, World!').payload).to eq(
|
107
|
+
expect(Houston::Notification.new(alert: 'Hello, World!').payload).to eq(
|
110
108
|
'aps' => { 'alert' => 'Hello, World!' }
|
111
|
-
|
109
|
+
)
|
112
110
|
end
|
113
111
|
|
114
112
|
it 'should create a dictionary only with badges' do
|
115
|
-
expect(Houston::Notification.new(badge: '123').payload).to eq(
|
113
|
+
expect(Houston::Notification.new(badge: '123').payload).to eq(
|
116
114
|
'aps' => { 'badge' => 123 }
|
117
|
-
|
115
|
+
)
|
118
116
|
end
|
119
117
|
|
120
118
|
it 'should create a dictionary only with sound' do
|
121
|
-
expect(Houston::Notification.new(sound: 'ring.aiff').payload).to eq(
|
119
|
+
expect(Houston::Notification.new(sound: 'ring.aiff').payload).to eq(
|
122
120
|
'aps' => { 'sound' => 'ring.aiff' }
|
123
|
-
|
121
|
+
)
|
124
122
|
end
|
125
123
|
|
126
124
|
it 'should create a dictionary only with category' do
|
127
|
-
expect(Houston::Notification.new(category: 'INVITE_CATEGORY').payload).to eq(
|
125
|
+
expect(Houston::Notification.new(category: 'INVITE_CATEGORY').payload).to eq(
|
128
126
|
'aps' => { 'category' => 'INVITE_CATEGORY' }
|
129
|
-
|
127
|
+
)
|
130
128
|
end
|
131
129
|
|
132
130
|
it 'should create a dictionary only with content-available' do
|
133
|
-
expect(Houston::Notification.new(content_available: true).payload).to eq(
|
131
|
+
expect(Houston::Notification.new(content_available: true).payload).to eq(
|
134
132
|
'aps' => { 'content-available' => 1 }
|
135
|
-
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'should create a dictionary only with mutable-content' do
|
137
|
+
expect(Houston::Notification.new(mutable_content: true).payload).to eq(
|
138
|
+
'aps' => { 'mutable-content' => 1 }
|
139
|
+
)
|
136
140
|
end
|
137
141
|
|
138
142
|
it 'should allow custom data inside aps key' do
|
139
143
|
notification_options = { :badge => 567, 'aps' => { 'loc-key' => 'my-key' } }
|
140
|
-
expect(Houston::Notification.new(notification_options).payload).to eq(
|
144
|
+
expect(Houston::Notification.new(notification_options).payload).to eq(
|
141
145
|
'aps' => { 'loc-key' => 'my-key', 'badge' => 567 }
|
142
|
-
|
146
|
+
)
|
143
147
|
end
|
144
148
|
|
145
149
|
it 'should create notification from hash with string and symbol keys' do
|
146
|
-
notification_options = { :
|
147
|
-
expect(Houston::Notification.new(notification_options).payload['aps']).to eq(
|
150
|
+
notification_options = { badge: 567, aps: { 'loc-key' => 'my-key' } }
|
151
|
+
expect(Houston::Notification.new(notification_options).payload['aps']).to eq(
|
148
152
|
'loc-key' => 'my-key', 'badge' => 567
|
149
|
-
|
153
|
+
)
|
150
154
|
end
|
151
155
|
end
|
152
156
|
|
data/spec/spec_helper.rb
CHANGED
@@ -18,8 +18,8 @@ class MockConnection
|
|
18
18
|
|
19
19
|
def initialize
|
20
20
|
@unregistered_devices = [
|
21
|
-
[443779200, 32,
|
22
|
-
[1388678223, 32,
|
21
|
+
[443779200, 32, 'ce8be6272e43e85516033e24b4c289220eeda4879c477160b2545e95b68b5969'],
|
22
|
+
[1388678223, 32, 'ce8be6272e43e85516033e24b4c289220eeda4879c477160b2545e95b68b5970']
|
23
23
|
]
|
24
24
|
end
|
25
25
|
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: houston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
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: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Houston is a simple gem for sending Apple Push Notifications. Pass your
|
@@ -88,87 +88,46 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- ./
|
92
|
-
- ./
|
93
|
-
- ./
|
94
|
-
- ./
|
95
|
-
- ./
|
96
|
-
- ./coverage/assets/0.
|
97
|
-
- ./coverage/assets/0.
|
98
|
-
- ./coverage/assets/0.
|
99
|
-
- ./coverage/assets/0.
|
100
|
-
- ./coverage/assets/0.
|
101
|
-
- ./coverage/assets/0.
|
102
|
-
- ./coverage/assets/0.
|
103
|
-
- ./coverage/assets/0.
|
104
|
-
- ./coverage/assets/0.
|
105
|
-
- ./coverage/assets/0.
|
106
|
-
- ./coverage/assets/0.
|
107
|
-
- ./coverage/assets/0.
|
108
|
-
- ./coverage/assets/0.
|
109
|
-
- ./coverage/assets/0.
|
110
|
-
- ./coverage/assets/0.
|
111
|
-
- ./coverage/assets/0.
|
112
|
-
- ./coverage/assets/0.
|
113
|
-
- ./coverage/assets/0.
|
114
|
-
- ./coverage/assets/0.
|
115
|
-
- ./coverage/assets/0.
|
116
|
-
- ./coverage/assets/0.
|
117
|
-
- ./coverage/assets/0.
|
118
|
-
- ./coverage/assets/0.
|
119
|
-
- ./coverage/assets/0.
|
120
|
-
- ./coverage/
|
121
|
-
- ./
|
122
|
-
- ./
|
123
|
-
- ./
|
124
|
-
- ./
|
125
|
-
- ./
|
126
|
-
- ./
|
127
|
-
-
|
128
|
-
- ./coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png
|
129
|
-
- ./coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png
|
130
|
-
- ./coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png
|
131
|
-
- ./coverage/assets/0.8.0/application.css
|
132
|
-
- ./coverage/assets/0.8.0/application.js
|
133
|
-
- ./coverage/assets/0.8.0/colorbox/border.png
|
134
|
-
- ./coverage/assets/0.8.0/colorbox/controls.png
|
135
|
-
- ./coverage/assets/0.8.0/colorbox/loading.gif
|
136
|
-
- ./coverage/assets/0.8.0/colorbox/loading_background.png
|
137
|
-
- ./coverage/assets/0.8.0/favicon_green.png
|
138
|
-
- ./coverage/assets/0.8.0/favicon_red.png
|
139
|
-
- ./coverage/assets/0.8.0/favicon_yellow.png
|
140
|
-
- ./coverage/assets/0.8.0/loading.gif
|
141
|
-
- ./coverage/assets/0.8.0/magnify.png
|
142
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
143
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
144
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
145
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
146
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
147
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
148
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
149
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
150
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png
|
151
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png
|
152
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png
|
153
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png
|
154
|
-
- ./coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png
|
155
|
-
- ./coverage/index.html
|
156
|
-
- ./Gemfile
|
157
|
-
- ./Gemfile.lock
|
158
|
-
- ./houston-2.2.2.gem
|
159
|
-
- ./houston.gemspec
|
160
|
-
- ./lib/houston/client.rb
|
161
|
-
- ./lib/houston/connection.rb
|
162
|
-
- ./lib/houston/notification.rb
|
163
|
-
- ./lib/houston/version.rb
|
164
|
-
- ./lib/houston.rb
|
165
|
-
- ./LICENSE
|
166
|
-
- ./Rakefile
|
167
|
-
- ./README.md
|
91
|
+
- "./Gemfile"
|
92
|
+
- "./Gemfile.lock"
|
93
|
+
- "./LICENSE"
|
94
|
+
- "./README.md"
|
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"
|
120
|
+
- "./coverage/index.html"
|
121
|
+
- "./houston.gemspec"
|
122
|
+
- "./lib/houston.rb"
|
123
|
+
- "./lib/houston/client.rb"
|
124
|
+
- "./lib/houston/connection.rb"
|
125
|
+
- "./lib/houston/notification.rb"
|
126
|
+
- "./lib/houston/version.rb"
|
127
|
+
- bin/apn
|
168
128
|
- spec/client_spec.rb
|
169
129
|
- spec/notification_spec.rb
|
170
130
|
- spec/spec_helper.rb
|
171
|
-
- bin/apn
|
172
131
|
homepage: http://nomad-cli.com
|
173
132
|
licenses:
|
174
133
|
- MIT
|
@@ -179,17 +138,17 @@ require_paths:
|
|
179
138
|
- lib
|
180
139
|
required_ruby_version: !ruby/object:Gem::Requirement
|
181
140
|
requirements:
|
182
|
-
- -
|
141
|
+
- - ">="
|
183
142
|
- !ruby/object:Gem::Version
|
184
143
|
version: '0'
|
185
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
145
|
requirements:
|
187
|
-
- -
|
146
|
+
- - ">="
|
188
147
|
- !ruby/object:Gem::Version
|
189
148
|
version: '0'
|
190
149
|
requirements: []
|
191
150
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.6.8
|
193
152
|
signing_key:
|
194
153
|
specification_version: 4
|
195
154
|
summary: Send Apple Push Notifications
|