ts_p8push 1.1.3 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b7a23e2b2c147643de610af283df24b79e8d1044858f75b536ed646720ca52c
4
- data.tar.gz: 397c9800e117aa52f8e00999251d0575b77903ee7bfc1ba895053b7086dcf08e
3
+ metadata.gz: f616a53deae454e47449f50775a8c8726016d6b0be43412863ec8d09a7e585c8
4
+ data.tar.gz: e09f70cfe3d44db9478c3a75bf8d722c8ff8cfd3c47204adf38218574b73c8fb
5
5
  SHA512:
6
- metadata.gz: 2af01065e809342e2393046dcb90a017e4f2205a3548f32f3e5da36292526a44b2ea3174b251c4105a6fc75f05c704f6abc493518636a8eb5f95bee0441162ce
7
- data.tar.gz: 00f24c0d707c0081e107b9f2128c106212eccbca06e81d2e7828fda32a276513071789c949e9df02368b97ecc0288c977a874554e916f8de3cc221fc2b8ea45d
6
+ metadata.gz: ff82edf033c060a15448be54614bbe978e8b04640b284bcf0eac5fdddf8242e6753e1f8928babfcad43eab99afc3f866b0717aa9ff9371ac1755051bf703b9c9
7
+ data.tar.gz: c2a9c7910bbfe799ced2eb620233ada93841af4f41c6d4e3720fb309e57dbccd93d1fbdbfdad793201f28eb4a85ddd990d4320cc33d8e7d022328c468f28217a
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.to_json 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.3'
2
+ VERSION = '1.2.0'
3
3
  end
data/p8push.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_dependency 'jwt', '1.5.6'
17
17
  s.add_dependency 'commander', '4.4'
18
- s.add_dependency 'json', '2.1.0'
18
+ s.add_dependency 'json', '2.3.0'
19
19
  s.add_dependency 'net-http2', '0.18.2'
20
20
 
21
21
  s.files = Dir['./**/*'].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
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.3
4
+ version: 1.2.0
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-12-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: jwt
@@ -47,14 +47,14 @@ dependencies:
47
47
  requirements:
48
48
  - - '='
49
49
  - !ruby/object:Gem::Version
50
- version: 2.1.0
50
+ version: 2.3.0
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - '='
56
56
  - !ruby/object:Gem::Version
57
- version: 2.1.0
57
+ version: 2.3.0
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: net-http2
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +91,10 @@ files:
91
91
  - "./ts_p8push-1.1.0.gem"
92
92
  - "./ts_p8push-1.1.1.gem"
93
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"
97
+ - "./ts_p8push-1.1.6.gem"
94
98
  homepage: https://talhashoaib.me
95
99
  licenses:
96
100
  - MIT