houston 2.0.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19ea781099fb74df316010704e9335580db3418c
4
- data.tar.gz: bb5452a82ab13181e6fee98915a37799ae1dbe0d
3
+ metadata.gz: 6be6d173e6911811d66a4347653d122ee5d7cb78
4
+ data.tar.gz: 4ae126de3be2d655ec32ba6b1605d7855986d229
5
5
  SHA512:
6
- metadata.gz: 24c557aa4a8ac29e937cc0f8c4ecccb2bd1218c3f204e3cf273d7c942646e0aa7cd7c01ddc5228ba8d6693ee46a0c65d1a732f2a8c50364ac7d452b8ca274390
7
- data.tar.gz: 552d74c3ff780d5168fe3a3fda11b31e3da9292c3a13607cc8741fa088e76b4d1c52677bbbe7e40ebcd6c029ce1b7d0a2eed7341fb1525c089303fe95d467717
6
+ metadata.gz: eb9b1a6b4072ced4dc430d9a4803b0d78443112439213cd3a233e022e6c6159ed8d76a1c3d743de881138cf7a9ea5b6c9c819390ae5bb6fef24abe42b684bc4d
7
+ data.tar.gz: a483316420be5af81ad924274b9a6674b3734944b2f3bd0accb3d5684dd6abaedc21eb9ec44c2e0180792650570624592f1c439e0b99a558eaa74dea13bbcefd
data/Gemfile.lock CHANGED
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- houston (2.0.0)
4
+ houston (2.0.2)
5
5
  commander (~> 4.1)
6
6
  json
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- commander (4.1.5)
11
+ commander (4.1.6)
12
12
  highline (~> 1.6.11)
13
- highline (1.6.19)
13
+ highline (1.6.21)
14
14
  json (1.8.1)
15
15
  multi_json (1.8.0)
16
16
  rake (0.9.6)
data/README.md CHANGED
@@ -21,6 +21,8 @@ Another caveat is that Houston doesn't manage device tokens for you. For that, y
21
21
  ## Usage
22
22
 
23
23
  ```ruby
24
+ require 'houston'
25
+
24
26
  # Environment variables are automatically read, or can be overridden by any specified options. You can also
25
27
  # conveniently use `Houston::Client.development` or `Houston::Client.production`.
26
28
  APN = Houston::Client.development
@@ -60,6 +62,14 @@ connection.write(notification.message)
60
62
  connection.close
61
63
  ```
62
64
 
65
+ ### Feedback Service
66
+
67
+ Apple provides a feedback service to query for unregistered device tokens, these are devices that have failed to receive a push notification and should be removed from your application. You should periodically query for and remove these devices, Apple audits providers to ensure they are removing unregistered devices. To obtain the list of unregistered device tokens:
68
+
69
+ ```ruby
70
+ Houston::Client.development.devices
71
+ ```
72
+
63
73
  ## Versioning
64
74
 
65
75
  Houston 2.0 supports the new [enhanced notification format](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4). Support for the legacy notification format is available in 1.x releases.
data/bin/apn CHANGED
@@ -47,7 +47,7 @@ command :push do |c|
47
47
  @alert = options.alert
48
48
  @badge = options.badge.nil? ? nil : options.badge.to_i
49
49
  @sound = options.sound
50
- @content_available = options.newsstand
50
+ @content_available = !!options.newsstand
51
51
 
52
52
  if options.payload
53
53
  begin
@@ -87,10 +87,26 @@ command :push do |c|
87
87
 
88
88
  begin
89
89
  client.push(*@notifications)
90
+
91
+ sent = @notifications.select{|notification| notification.sent?}
92
+ unsent = @notifications.select{|notification| not notification.sent?}
93
+
94
+ case sent.length
95
+ when 1
96
+ say_ok "#{sent.length} push notification sent successfully"
97
+ else
98
+ say_ok "#{sent.length} push notifications sent successfully"
99
+ end
100
+
101
+ case unsent.length
102
+ when 1
103
+ say_ok "#{unsent.length} push notification unsuccessful (#{unsent.join(", ")})"
104
+ else
105
+ say_ok "#{unsent.length} push notifications unsuccessful (#{unsent.join(", ")})"
106
+ end
107
+
90
108
  rescue => message
91
109
  say_error "Exception sending notification: #{message}" and abort
92
110
  end
93
-
94
- say_ok "Push notifications successfully sent"
95
111
  end
96
112
  end
data/houston-2.0.0.gem ADDED
Binary file
data/houston-2.0.1.gem ADDED
Binary file
data/houston.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.authors = ["Mattt Thompson"]
8
8
  s.email = "m@mattt.me"
9
9
  s.license = "MIT"
10
- s.homepage = "http://github.com/mattt/houston"
10
+ s.homepage = "http://nomad-cli.com"
11
11
  s.version = Houston::VERSION
12
12
  s.platform = Gem::Platform::RUBY
13
13
  s.summary = "Send Apple Push Notifications"
@@ -72,8 +72,6 @@ module Houston
72
72
 
73
73
  if error
74
74
  command, status, index = error.unpack("ccN")
75
- # status == 10 means shutdown, and the given id is the last one successfully sent
76
- index += 1 if status == 10
77
75
  notifications.slice!(0..index)
78
76
  notifications.each(&:mark_as_unsent!)
79
77
  push(*notifications)
@@ -75,7 +75,7 @@ module Houston
75
75
  end
76
76
 
77
77
  def expiration_item
78
- [4, 4, @expiry].pack('cnN') unless @expiry.nil?
78
+ [4, 4, @expiry.to_i].pack('cnN') unless @expiry.nil?
79
79
  end
80
80
 
81
81
  def priority_item
@@ -1,3 +1,3 @@
1
1
  module Houston
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.2"
3
3
  end
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.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-13 00:00:00.000000000 Z
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -91,6 +91,8 @@ files:
91
91
  - ./Gemfile
92
92
  - ./Gemfile.lock
93
93
  - ./houston-0.3.1.gem
94
+ - ./houston-2.0.0.gem
95
+ - ./houston-2.0.1.gem
94
96
  - ./houston.gemspec
95
97
  - ./lib/houston/client.rb
96
98
  - ./lib/houston/connection.rb
@@ -103,7 +105,7 @@ files:
103
105
  - spec/notification_spec.rb
104
106
  - spec/spec_helper.rb
105
107
  - bin/apn
106
- homepage: http://github.com/mattt/houston
108
+ homepage: http://nomad-cli.com
107
109
  licenses:
108
110
  - MIT
109
111
  metadata: {}
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  version: '0'
124
126
  requirements: []
125
127
  rubyforge_project:
126
- rubygems_version: 2.0.3
128
+ rubygems_version: 2.1.11
127
129
  signing_key:
128
130
  specification_version: 4
129
131
  summary: Send Apple Push Notifications