lead_zeppelin 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -3
- data/lib/lead_zeppelin/apns/application.rb +2 -0
- data/lib/lead_zeppelin/apns/notification.rb +4 -1
- data/lib/lead_zeppelin/version.rb +2 -2
- metadata +2 -2
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
|
-
|
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, '
|
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))
|
@@ -12,7 +12,9 @@ module LeadZeppelin
|
|
12
12
|
|
13
13
|
@expiry = @opts[:expiry].nil? ? 1 : @opts[:expiry].to_i
|
14
14
|
|
15
|
-
if
|
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.
|
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.
|
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-
|
12
|
+
date: 2012-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|