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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54dbbd173f8e1b261c87848e4ff13cf6e2d7bafc
4
- data.tar.gz: b0b353941c8e2b80fc9c2c815d7a589b446d5341
3
+ metadata.gz: 31c4793763c62619a6172cc71753e817ff5587e7
4
+ data.tar.gz: 1446300098aa1b5b67d15fea827148d08f804414
5
5
  SHA512:
6
- metadata.gz: 3346fdb4e641301f1f0dcfdd2303f9b7cebafb86682813be9f581fe278fdfad6c83b47153d4fd132a0492b377d6daaab7b75e94b0b4ff1c72c41fd07adc3ff06
7
- data.tar.gz: bde5768c3c3436d986182947ad0fe23f518b95583e89d69f7beeb57b4e94a1d5b9f15bed0c129122f18a05fa7c297fbef8dfa3dce29d0aee36b70059d1dcf7ed
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*')
@@ -1,3 +1,3 @@
1
1
  module ApnsSimple
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.2.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-09-15 00:00:00.000000000 Z
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: []