repro-api-client 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: 2df819152eca29047156efb357b852b32e741e19
4
- data.tar.gz: b3c53d91ba66c7ac864a5b13f2ef0a0d47cd6f59
3
+ metadata.gz: a6448d092fc7119ae6fb1098ee8e69aba55bf2e2
4
+ data.tar.gz: 4fea0948d1f31d11c907400ebc7806866a7cbd03
5
5
  SHA512:
6
- metadata.gz: 8219c7927015cc86186d22e35f6efa077cea6d727ebd8698bba0f370b0eab4c395f4c9fee63365a5d66ca02a3027b84d26802e8a1b2e8a165b86a93e838e1de2
7
- data.tar.gz: 20c934762f17d3a67d1c1c6a4a2c82acc2ef8fce8a3d041a7099572c2b8e0a863e92df3067650fdcbc45ff3842cfacaba3a047ed38aa2aa42cced1b06aa81f79
6
+ metadata.gz: ec8d3c6d92f2edce3d81127fa8c644b4b7f8384ce31e5b6a6811b66090187be811b8f82bc928fb177ca13baf7aceb8b6742bfce4d9cdf2b1327159dcacebe25c
7
+ data.tar.gz: 76a159c15cf7b927f831dd45d715d87b5de0b3ea14d5e09bc5386140be89db8576450f934add3ceef4b012ae2873dae80591678f879b67e32bbc9016fab648a3
data/exe/repro-api-client CHANGED
@@ -24,9 +24,7 @@ class CLI
24
24
  raise '-u,--users are required' if @user_ids.nil?
25
25
  raise '-b,--body or --json or --file is required' if @body.nil? && @payload.nil?
26
26
 
27
- Repro::Api::Client.configure do |c|
28
- c[:token] = @token
29
- end
27
+ client = Repro::Api::Client.new @token
30
28
 
31
29
  if @payload
32
30
  custom_payload = @payload
@@ -37,7 +35,7 @@ class CLI
37
35
  end
38
36
 
39
37
  begin
40
- response = Repro::Api::Client.push_deliver(@push_id, @user_ids, custom_payload)
38
+ response = client.push_deliver(@push_id, @user_ids, custom_payload)
41
39
  puts response.body
42
40
  rescue => ex
43
41
  puts ex.message
@@ -1,7 +1,7 @@
1
1
  module Repro
2
2
  module Api
3
3
  class Client
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
7
7
  end
@@ -51,15 +51,21 @@ module Repro
51
51
  private
52
52
 
53
53
  def build_payload(opts)
54
- payload = {aps: {alert: {}}}
55
- payload[:aps][:alert][:body] = opts.delete(:body)
56
- payload[:aps][:alert][:title] = opts.delete(:title)
57
- payload[:aps][:badge] = opts.delete(:badge) if opts[:badge]
58
- payload[:aps][:sound] = opts.key?(:sound) ? opts.delete(:sound) : 'default'
59
- payload[:rpr_url] = opts.delete(:url) if opts[:url]
54
+ payload = { aps: { alert: {} }, data: {} }
55
+ payload[:data][:rpr_body] = opts[:body]
56
+ payload[:data][:rpr_title] = opts[:title]
57
+ payload[:aps][:alert][:body] = opts[:body]
58
+ payload[:aps][:alert][:title] = opts[:title]
59
+ payload[:aps][:badge] = opts[:badge] if opts[:badge]
60
+ payload[:aps][:sound] = opts.key?(:sound) ? opts[:sound] : 'default'
61
+ if opts[:url]
62
+ payload[:data][:rpr_url] = opts[:url]
63
+ payload[:rpr_url] = opts[:url]
64
+ end
60
65
  if opts[:attachment]
66
+ payload[:data][:rpr_picture] = {url: opts[:attachment]}
61
67
  payload[:aps]['mutable-content'] = 1
62
- payload[:rpr_attachment] = opts.delete(:attachment)
68
+ payload[:rpr_attachment] = opts[:attachment]
63
69
  end
64
70
  JSON.generate(payload)
65
71
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repro-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takafumi Hirata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler