houston 2.2.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -27
- data/README.md +36 -14
- data/bin/apn +2 -2
- data/coverage/assets/0.7.1/application.css +1110 -0
- data/coverage/assets/0.7.1/application.js +626 -0
- 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.10.0 → 0.8.0}/application.js +931 -1079
- 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/coverage/index.html +184 -296
- data/houston-2.2.2.gem +0 -0
- data/houston-2.2.3.gem +0 -0
- data/lib/houston/client.rb +2 -2
- data/lib/houston/connection.rb +2 -2
- data/lib/houston/notification.rb +8 -1
- data/lib/houston/version.rb +1 -1
- data/spec/notification_spec.rb +26 -5
- metadata +69 -27
- /data/coverage/assets/{0.10.0 → 0.7.1}/favicon_green.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/favicon_red.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/favicon_yellow.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/loading.gif +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/magnify.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-icons_222222_256x240.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-icons_454545_256x240.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-icons_888888_256x240.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.7.1}/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.8.0}/application.css +0 -0
- /data/coverage/assets/{0.10.0 → 0.8.0}/colorbox/border.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.8.0}/colorbox/controls.png +0 -0
- /data/coverage/assets/{0.10.0 → 0.8.0}/colorbox/loading.gif +0 -0
- /data/coverage/assets/{0.10.0 → 0.8.0}/colorbox/loading_background.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfbcea0735347e252416d11e2ae57e506ba71ffd
|
4
|
+
data.tar.gz: 7e9b26d48fd1ad27fe068ec0f3a7cfe2c2f307d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6104dd4c1221816bc7e8f779c508c0fed230210d8c5b387d804e9d1120d83b88785ccfa398410190be4eb34ffa28ead665f9c836f76cb6224661c64924fb529
|
7
|
+
data.tar.gz: 301d4d835c5de3497aa5ed4330f3bb4207e0a0f54849a7747f6bd6927c414b1cff15700df430f7b3a91a7a68ad63720ffb49dd14f7beba22c23df7ff9c153176
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
houston (2.2.
|
5
|
-
commander (~> 4.
|
4
|
+
houston (2.2.3)
|
5
|
+
commander (~> 4.1)
|
6
6
|
json
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
commander (4.
|
12
|
-
highline (~> 1.
|
11
|
+
commander (4.2.0)
|
12
|
+
highline (~> 1.6.11)
|
13
13
|
diff-lcs (1.2.5)
|
14
14
|
docile (1.1.5)
|
15
|
-
highline (1.
|
16
|
-
json (
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rspec-
|
21
|
-
rspec-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
highline (1.6.21)
|
16
|
+
json (1.8.1)
|
17
|
+
multi_json (1.10.1)
|
18
|
+
rake (10.3.2)
|
19
|
+
rspec (3.0.0)
|
20
|
+
rspec-core (~> 3.0.0)
|
21
|
+
rspec-expectations (~> 3.0.0)
|
22
|
+
rspec-mocks (~> 3.0.0)
|
23
|
+
rspec-core (3.0.3)
|
24
|
+
rspec-support (~> 3.0.0)
|
25
|
+
rspec-expectations (3.0.3)
|
25
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-mocks (3.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
simplecov (0.12.0)
|
27
|
+
rspec-support (~> 3.0.0)
|
28
|
+
rspec-mocks (3.0.3)
|
29
|
+
rspec-support (~> 3.0.0)
|
30
|
+
rspec-support (3.0.3)
|
31
|
+
simplecov (0.9.0)
|
32
32
|
docile (~> 1.1.0)
|
33
|
-
|
34
|
-
simplecov-html (~> 0.
|
35
|
-
simplecov-html (0.
|
33
|
+
multi_json
|
34
|
+
simplecov-html (~> 0.8.0)
|
35
|
+
simplecov-html (0.8.0)
|
36
36
|
|
37
37
|
PLATFORMS
|
38
38
|
ruby
|
@@ -40,8 +40,5 @@ PLATFORMS
|
|
40
40
|
DEPENDENCIES
|
41
41
|
houston!
|
42
42
|
rake
|
43
|
-
rspec (~> 3.
|
43
|
+
rspec (~> 3.0)
|
44
44
|
simplecov
|
45
|
-
|
46
|
-
BUNDLED WITH
|
47
|
-
1.13.7
|
data/README.md
CHANGED
@@ -26,22 +26,24 @@ require 'houston'
|
|
26
26
|
# Environment variables are automatically read, or can be overridden by any specified options. You can also
|
27
27
|
# conveniently use `Houston::Client.development` or `Houston::Client.production`.
|
28
28
|
APN = Houston::Client.development
|
29
|
-
APN.certificate = File.read(
|
29
|
+
APN.certificate = File.read('/path/to/apple_push_notification.pem')
|
30
30
|
|
31
31
|
# An example of the token sent back when a device registers for notifications
|
32
|
-
token =
|
32
|
+
token = '<ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5969>'
|
33
33
|
|
34
34
|
# Create a notification that alerts a message to the user, plays a sound, and sets the badge on the app
|
35
35
|
notification = Houston::Notification.new(device: token)
|
36
|
-
notification.alert =
|
36
|
+
notification.alert = 'Hello, World!'
|
37
37
|
|
38
38
|
# Notifications can also change the badge count, have a custom sound, have a category identifier, indicate available Newsstand content, or pass along arbitrary data.
|
39
39
|
notification.badge = 57
|
40
|
-
notification.sound =
|
41
|
-
notification.category =
|
40
|
+
notification.sound = 'sosumi.aiff'
|
41
|
+
notification.category = 'INVITE_CATEGORY'
|
42
42
|
notification.content_available = true
|
43
43
|
notification.mutable_content = true
|
44
|
-
notification.custom_data = { foo:
|
44
|
+
notification.custom_data = { foo: 'bar' }
|
45
|
+
notification.url_args = %w[boarding A998]
|
46
|
+
notification.thread_id = 'notify-team-ios'
|
45
47
|
|
46
48
|
# And... sent! That's all it takes.
|
47
49
|
APN.push(notification)
|
@@ -72,10 +74,10 @@ puts "Error: #{notification.error}." if notification.error
|
|
72
74
|
|
73
75
|
### Silent Notifications
|
74
76
|
|
75
|
-
To send a silent push notification, set `sound` to an empty string (`
|
77
|
+
To send a silent push notification, set `sound` to an empty string (`''`):
|
76
78
|
|
77
79
|
```ruby
|
78
|
-
Houston::Notification.new(sound:
|
80
|
+
Houston::Notification.new(sound: '', content_available: true)
|
79
81
|
```
|
80
82
|
|
81
83
|
### Mutable Notifications
|
@@ -91,13 +93,13 @@ Houston::Notification.new(mutable_content: true)
|
|
91
93
|
If you want to manage your own persistent connection to Apple push services, such as for background workers, here's how to do it:
|
92
94
|
|
93
95
|
```ruby
|
94
|
-
certificate = File.read(
|
95
|
-
passphrase =
|
96
|
+
certificate = File.read('/path/to/apple_push_notification.pem')
|
97
|
+
passphrase = '...'
|
96
98
|
connection = Houston::Connection.new(Houston::APPLE_DEVELOPMENT_GATEWAY_URI, certificate, passphrase)
|
97
99
|
connection.open
|
98
100
|
|
99
101
|
notification = Houston::Notification.new(device: token)
|
100
|
-
notification.alert =
|
102
|
+
notification.alert = 'Hello, World!'
|
101
103
|
connection.write(notification.message)
|
102
104
|
|
103
105
|
connection.close
|
@@ -118,9 +120,9 @@ In `lib/tasks/notifications.rake`:
|
|
118
120
|
```ruby
|
119
121
|
namespace :notifications do
|
120
122
|
task device_token_feedback: [:environment] do
|
121
|
-
APN.
|
123
|
+
APN.unregistered_devices.each do |device_hash|
|
122
124
|
# Format: { token: token, timestamp: timestamp }
|
123
|
-
device = Device.find_by(token: device_hash[
|
125
|
+
device = Device.find_by(token: device_hash[:token])
|
124
126
|
next unless device.present?
|
125
127
|
# Remove device token
|
126
128
|
device.update_attribute(:device_token, nil)
|
@@ -141,9 +143,11 @@ Houston also comes with the `apn` binary, which provides a convenient way to tes
|
|
141
143
|
|
142
144
|
## Enabling Push Notifications on iOS
|
143
145
|
|
144
|
-
###
|
146
|
+
### Objective-C
|
145
147
|
|
146
148
|
```objective-c
|
149
|
+
// AppDelegate.m
|
150
|
+
|
147
151
|
- (void)applicationDidFinishLaunching:(UIApplication *)application {
|
148
152
|
// ...
|
149
153
|
|
@@ -165,6 +169,24 @@ didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
|
|
165
169
|
}
|
166
170
|
```
|
167
171
|
|
172
|
+
### Swift
|
173
|
+
```swift
|
174
|
+
// AppDelegate.swift
|
175
|
+
|
176
|
+
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
|
177
|
+
application.registerForRemoteNotifications()
|
178
|
+
return true
|
179
|
+
}
|
180
|
+
|
181
|
+
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
182
|
+
// Register the device token with a webservice
|
183
|
+
}
|
184
|
+
|
185
|
+
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
186
|
+
print("error \(error)")
|
187
|
+
}
|
188
|
+
```
|
189
|
+
|
168
190
|
## Converting Your Certificate
|
169
191
|
|
170
192
|
> These instructions come from the [APN on Rails](https://github.com/PRX/apn_on_rails) project, which is another great option for sending push notifications.
|
data/bin/apn
CHANGED
@@ -43,7 +43,7 @@ command :push do |c|
|
|
43
43
|
say_error "Missing certificate file option (-c /path/to/certificate.pem)" and abort unless @certificate
|
44
44
|
say_error "Could not find certificate file '#{@certificate}'" and abort unless File.exists?(@certificate)
|
45
45
|
|
46
|
-
@passphrase = options.passphrase ? password :
|
46
|
+
@passphrase = options.passphrase ? password : nil
|
47
47
|
|
48
48
|
@alert = options.alert
|
49
49
|
@badge = options.badge.nil? ? nil : options.badge.to_i
|
@@ -138,7 +138,7 @@ command :feedback do |c|
|
|
138
138
|
say_error "Missing certificate file option (-c /path/to/certificate.pem)" and abort unless @certificate
|
139
139
|
say_error "Could not find certificate file '#{@certificate}'" and abort unless File.exists?(@certificate)
|
140
140
|
|
141
|
-
@passphrase = options.passphrase ? password :
|
141
|
+
@passphrase = options.passphrase ? password : nil
|
142
142
|
|
143
143
|
client = (@environment == :production) ? Houston::Client.production : Houston::Client.development
|
144
144
|
client.certificate = File.read(@certificate)
|