lead_zeppelin 0.1.1 → 0.1.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.
data/README.md CHANGED
@@ -34,14 +34,20 @@ Instantiate a new client and configure it by adding the block of code to handle
34
34
  c.add_application :your_app_identifier, pem: File.read('./yourapp.pem')
35
35
  end
36
36
 
37
- # Add a poller to read messages via a method of your choosing:
37
+ ## Polling
38
+
39
+ Add a poller to read messages via a method of your choosing:
38
40
 
39
41
  # Poll every second, join parent (main) thread so it doesn't close
40
42
 
41
43
  client.poll(1, join_parent_thread: true) do |c|
42
- c.message :demoapp, 'f80d44bc73b4a856d9bcd63c2285e5190f8a7dcd8af34cfdf1f4a23cfd66423d', "testing!"
44
+ c.message :demoapp, 'YOUR_DEVICE_TOKEN_GOES_HERE', "testing!"
43
45
  end
44
46
 
47
+ If you already have the generated JSON payload, you can inform the message sender to not encode to JSON:
48
+
49
+ c.message :demoapp, 'YOUR_DEVICE_TOKEN_GOES_HERE', '{"aps":{"alert":"Now Playing: Dazed and Confused"}}', raw: true
50
+
45
51
  # Logging
46
52
 
47
53
  LeadZeppelin#logger takes a Logger class:
@@ -68,4 +74,5 @@ To watch the thread flow, pass an IO to LeadZeppelin#thread_logger (but not a Lo
68
74
  * Performance and concurrency speedups
69
75
  * Edge cases
70
76
  * Documentation (code level and regular)
71
- * Length checking for payload, possibly an auto truncating feature
77
+ * Length checking for payload, possibly an auto truncating feature
78
+ * Research Celluloid and Celluloid::IO integration (waiting on [this ticket](https://github.com/celluloid/celluloid-io/pull/11))
@@ -4,6 +4,8 @@ module LeadZeppelin
4
4
  CONNECTION_POOL_SIZE = 5
5
5
  CONNECTION_POOL_TIMEOUT = 5
6
6
 
7
+ attr_reader :name
8
+
7
9
  def initialize(name, opts={})
8
10
  @name = name
9
11
  @opts = opts
@@ -12,7 +12,9 @@ module LeadZeppelin
12
12
 
13
13
  @expiry = @opts[:expiry].nil? ? 1 : @opts[:expiry].to_i
14
14
 
15
- if message.is_a?(Hash)
15
+ if opts[:raw] == true
16
+ @message = message
17
+ elsif message.is_a?(Hash)
16
18
  other = message.delete(:other)
17
19
  @message = {aps: message}
18
20
  @message.merge!(other) if other
@@ -32,6 +34,7 @@ module LeadZeppelin
32
34
  end
33
35
 
34
36
  def message_json
37
+ return @message if @opts[:raw] == true
35
38
  @message_json ||= MultiJson.encode @message
36
39
  end
37
40
  end
@@ -1,3 +1,3 @@
1
1
  module LeadZeppelin
2
- VERSION = '0.1.1'
3
- end
2
+ VERSION = '0.1.2'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lead_zeppelin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
12
+ date: 2012-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json