apns_simple 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apns_simple.gemspec +1 -1
- data/lib/apns_simple/notification.rb +4 -2
- data/lib/apns_simple/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c4793763c62619a6172cc71753e817ff5587e7
|
4
|
+
data.tar.gz: 1446300098aa1b5b67d15fea827148d08f804414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baaf00721c5974490be29f178ba92d176a805aced9d6cdedeb961e7b25aac528406da160921ba83104824d45f755e669456e9ebe43314df2385cae48b6013695
|
7
|
+
data.tar.gz: 7257e1a31137e00f7b9ec7ceb407322404a24aa7a341d201dee25124f9ed5faced36b7bdf14a497d34f30d6ff45ce8fdb270258d876915b8d342cdca6036bd0b
|
data/apns_simple.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["andrey.voronkov@medm.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Simple Apple Push Notifications sender}
|
13
|
-
spec.description = %q{Simple Apple Push Notifications sender}
|
13
|
+
spec.description = %q{Simple Apple Push Notifications sender for the sake of good}
|
14
14
|
spec.homepage = "https://github.com/Antiarchitect/apns_simple"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -3,15 +3,16 @@ require 'json'
|
|
3
3
|
module ApnsSimple
|
4
4
|
class Notification
|
5
5
|
|
6
|
-
attr_reader :token, :alert, :badge, :sound, :content_available
|
6
|
+
attr_reader :token, :alert, :badge, :sound, :content_available, :custom_payload
|
7
7
|
attr_accessor :error
|
8
8
|
|
9
|
-
def initialize(options)
|
9
|
+
def initialize(options, custom_payload = {})
|
10
10
|
@token = options.fetch(:token)
|
11
11
|
@alert = options[:alert]
|
12
12
|
@badge = options[:badge]
|
13
13
|
@sound = options[:sound] || 'default'
|
14
14
|
@content_available = options[:content_available]
|
15
|
+
@custom_payload = custom_payload
|
15
16
|
end
|
16
17
|
|
17
18
|
def payload
|
@@ -20,6 +21,7 @@ module ApnsSimple
|
|
20
21
|
payload[:aps][:badge] = badge if badge
|
21
22
|
payload[:aps][:sound] = sound if sound
|
22
23
|
payload[:aps]['content-available'] = 1 if content_available
|
24
|
+
payload.merge! custom_payload
|
23
25
|
|
24
26
|
packed_message = payload.to_json.gsub(/\\u([\da-fA-F]{4})/) {|m| [$1].pack("H*").unpack("n*").pack("U*")}
|
25
27
|
packed_token = [token.gsub(/[\s|<|>]/,'')].pack('H*')
|
data/lib/apns_simple/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apns_simple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Voronkov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: Simple Apple Push Notifications sender
|
41
|
+
description: Simple Apple Push Notifications sender for the sake of good
|
42
42
|
email:
|
43
43
|
- andrey.voronkov@medm.com
|
44
44
|
executables: []
|