houston 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 665f646fd8d10f128f8b408a5723bdfa846a6e49
4
- data.tar.gz: a7d075a67f504cbdfcbebe585d21e8e26d770d9e
3
+ metadata.gz: 601337973b7324c434f6b47e5ed2ace4146c0fed
4
+ data.tar.gz: 29531ef75c6009a69268d969e9177ef3dd02af9f
5
5
  SHA512:
6
- metadata.gz: 00c7bc4612f323d159411ce835a21e5c28acf85395c685bab5b7ad87e9d1a7d0378d02e2c4980e29bbb10bfe32c4ad844d04447c37edb18954ff36bafa58ab87
7
- data.tar.gz: 4b4be23b6122e002f391e5d4577cae6897f519696008c5c926e1e39de917055bba0e6740cf53533b967cd14da8581076e2f4d65ab5e89ff84681f4fece50e530
6
+ metadata.gz: 4f961aab88ab247bda590f79cad03ff48e397233219ceb83239b1f4699e5bc08ee8025537c9ec8d610157c4ee19d498f84375c783d2c6f54546f477bcb0c6845
7
+ data.tar.gz: 6b723519ed7b15a5c52f71cc2f8505ada1e03ccc30a062a2634e618cf654da5dbc55421d4a202d2559d926b50fddcde0c3ecd4411409bec363db085f8796d17b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- houston (0.2.1)
4
+ houston (0.2.2)
5
5
  commander (~> 4.1)
6
6
  json
7
7
 
data/bin/apn CHANGED
@@ -17,7 +17,7 @@ program :help_formatter, :compact
17
17
  default_command :help
18
18
 
19
19
  command :push do |c|
20
- c.syntax = 'apn push DEVICE [...]'
20
+ c.syntax = 'apn push TOKEN [...]'
21
21
  c.summary = 'Sends an Apple Push Notification to specified devices'
22
22
  c.description = ''
23
23
 
@@ -72,7 +72,7 @@ command :push do |c|
72
72
  @notifications = []
73
73
  args.each do |token|
74
74
  notification = Houston::Notification.new(@data || {})
75
- notification.device = token
75
+ notification.token = token
76
76
  notification.alert = @alert if @alert
77
77
  notification.badge = @badge if @badge
78
78
  notification.sound = @sound if @sound
data/houston-0.2.1.gem ADDED
Binary file
data/lib/houston.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Houston
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
4
4
 
5
5
  require 'houston/client'
@@ -2,11 +2,14 @@ require 'json'
2
2
 
3
3
  module Houston
4
4
  class Notification
5
- attr_accessor :device, :alert, :badge, :sound, :content_available, :custom_data
5
+ attr_accessor :token, :alert, :badge, :sound, :content_available, :custom_data
6
6
  attr_reader :sent_at
7
7
 
8
+ alias :device :token
9
+ alias :device= :token=
10
+
8
11
  def initialize(options = {})
9
- @device = options.delete(:device)
12
+ @token = options.delete(:token) || options.delete(:device)
10
13
  @alert = options.delete(:alert)
11
14
  @badge = options.delete(:badge)
12
15
  @sound = options.delete(:sound)
@@ -28,9 +31,9 @@ module Houston
28
31
 
29
32
  def message
30
33
  json = payload.to_json
31
- device_token = [@device.gsub(/[<\s>]/, '')].pack('H*')
34
+ hex_token = [@token.gsub(/[<\s>]/, '')].pack('H*')
32
35
 
33
- [0, 0, 32, device_token, 0, json.bytes.count, json].pack('ccca*cca*')
36
+ [0, 0, 32, hex_token, 0, json.bytes.count, json].pack('ccca*cca*')
34
37
  end
35
38
 
36
39
  def mark_as_sent!
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: 0.2.1
4
+ version: 0.2.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-04-24 00:00:00.000000000 Z
11
+ date: 2013-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -77,6 +77,7 @@ files:
77
77
  - ./apple_push_notification_production.pem
78
78
  - ./Gemfile
79
79
  - ./Gemfile.lock
80
+ - ./houston-0.2.1.gem
80
81
  - ./houston.gemspec
81
82
  - ./lib/houston/client.rb
82
83
  - ./lib/houston/connection.rb