ts_p8push 1.1.1 → 1.1.6

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
  SHA256:
3
- metadata.gz: cc7e5c00d962713f16f0311086658d77ae9166564b86c2e20f57788c81fb7ef0
4
- data.tar.gz: 0700a0a33f24d259cebec7b0462db717be39fd688cb8595c2b30ce48cba05a53
3
+ metadata.gz: 987a54ec404771c665d609995a166db88d46aae12f90300eac1e8cb0f0dab123
4
+ data.tar.gz: '0196ba5cd63e3ae311c5227740f2878fbf8c4fab644ef9997eb5399a1a17c92e'
5
5
  SHA512:
6
- metadata.gz: 838dbcc895fe5dd98c16bd8d87226f7c1b88e3e557172d692192660eff4153ac6abf49b752f1a5009bbc5987682cdb21d311e0862463b4e2c4bdd13e483f2302
7
- data.tar.gz: fb650a5297aa0848de7a21cc7ddbca8d7d0c123aba950f383dd6527d6bc0453e0f5203ccb75c3aca2d6220b785429a9e013c959590968186226feda09087a783
6
+ metadata.gz: e75167b99cc0841da4347b3d6d5af831cc51f478be876852c53ac1d3270b7114e61c122438ca578cc63c6804e521bf6f403c4bbc4413dd7292fa17c0ca5d868f
7
+ data.tar.gz: 5959fd46f0e5846fa68339be6927dba81a37cbc4075c16297296d5a8f1ec70476352c58bce57ddeda8fc7d1a9ad79ddfdce153c20a4e8b2b74f860013ff26b77
data/lib/p8push/client.rb CHANGED
@@ -42,14 +42,11 @@ module P8push
42
42
  h['authorization'] = "bearer #{jwt_token}"
43
43
  h['content-type'] = 'application/json'
44
44
 
45
-
46
- puts payload.inspect
47
-
48
45
  res = client.call(:post, '/3/device/'+token, body: payload.to_json, timeout: @timeout,
49
46
  headers: h)
50
47
  client.close
51
48
  return nil if res.status.to_i == 200
52
- res.body
49
+ [res.body, res.status.to_i]
53
50
  end
54
51
 
55
52
  def push(*notifications)
@@ -64,12 +61,12 @@ module P8push
64
61
 
65
62
  notification.id = index
66
63
 
67
- err = jwt_http2_post(notification.topic, notification.payload, notification.token)
64
+ err, status = jwt_http2_post(notification.topic, notification.payload, notification.token)
68
65
  if err == nil
69
66
  notification.mark_as_sent!
70
67
  else
71
68
  puts err
72
- notification.apns_error_code = err
69
+ notification.apns_error_code = status
73
70
  notification.mark_as_unsent!
74
71
  end
75
72
  end
@@ -29,7 +29,7 @@ module P8push
29
29
  MAXIMUM_PAYLOAD_SIZE = 2048
30
30
 
31
31
  attr_accessor :topic, :token, :alert, :badge, :sound, :category, :content_available, :mutable_content,
32
- :custom_data, :id, :expiry, :priority
32
+ :custom_data, :id, :expiry, :priority, :media_url
33
33
  attr_reader :sent_at
34
34
  attr_writer :apns_error_code
35
35
 
@@ -39,6 +39,7 @@ module P8push
39
39
  def initialize(options = {})
40
40
  @token = options.delete(:token) || options.delete(:device)
41
41
  @alert = options.delete(:alert)
42
+ @media_url = options.delete(:media_url)
42
43
  @topic = options.delete(:topic) || ENV['APN_BUNDLE_ID']
43
44
  @badge = options.delete(:badge)
44
45
  @sound = options.delete(:sound)
@@ -56,12 +57,13 @@ module P8push
56
57
  json = {}.merge(@custom_data || {}).inject({}) { |h, (k, v)| h[k.to_s] = v; h }
57
58
 
58
59
  json['aps'] ||= {}
59
- json['aps']['alert'] = @alert if @alert
60
+ json['aps']['alert'] = @alert.as_json if @alert
60
61
  json['aps']['badge'] = @badge.to_i rescue 0 if @badge
61
62
  json['aps']['sound'] = @sound if @sound
62
63
  json['aps']['category'] = @category if @category
63
64
  json['aps']['content-available'] = 1 if @content_available
64
65
  json['aps']['mutable-content'] = 1 if @mutable_content
66
+ json['media-url'] = @media_url.present? ? "#{@media_url}" : ""
65
67
 
66
68
  json
67
69
  end
@@ -1,3 +1,3 @@
1
1
  module P8push
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.6'
3
3
  end
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts_p8push
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Arrow
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-06-04 00:00:00.000000000 Z
14
+ date: 2021-06-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: jwt
@@ -89,6 +89,11 @@ files:
89
89
  - "./ts_p8push-1.0.8.gem"
90
90
  - "./ts_p8push-1.0.9.gem"
91
91
  - "./ts_p8push-1.1.0.gem"
92
+ - "./ts_p8push-1.1.1.gem"
93
+ - "./ts_p8push-1.1.2.gem"
94
+ - "./ts_p8push-1.1.3.gem"
95
+ - "./ts_p8push-1.1.4.gem"
96
+ - "./ts_p8push-1.1.5.gem"
92
97
  homepage: https://talhashoaib.me
93
98
  licenses:
94
99
  - MIT