Module: Repro::Api::Client
- Defined in:
- lib/repro/api/client.rb,
lib/repro/api/client/version.rb
Constant Summary collapse
- API_VERSION =
'v1'.freeze
- API_ENDPOINT =
"https://marketing.repro.io/#{API_VERSION}".freeze
- VERSION =
"0.1.0"- @@options =
{ method: 'post' }
Class Method Summary collapse
- .configure {|@@options| ... } ⇒ Object
- .endpoint ⇒ Object
- .options ⇒ Object
- .options=(opts) ⇒ Object
-
.push_deliver(push_id, user_ids, opts = {}) ⇒ Object
/push/:push_id/deliver.
- .token ⇒ Object
- .user_agent ⇒ Object
Class Method Details
.configure {|@@options| ... } ⇒ Object
27 28 29 30 |
# File 'lib/repro/api/client.rb', line 27 def self.configure raise ArgumentError, 'Block is required.' unless block_given? yield end |
.endpoint ⇒ Object
60 61 62 |
# File 'lib/repro/api/client.rb', line 60 def endpoint [:endpoint] || API_ENDPOINT end |
.options ⇒ Object
19 20 21 |
# File 'lib/repro/api/client.rb', line 19 def self. end |
.options=(opts) ⇒ Object
23 24 25 |
# File 'lib/repro/api/client.rb', line 23 def self.=(opts) = opts end |
.push_deliver(push_id, user_ids, opts = {}) ⇒ Object
/push/:push_id/deliver
41 42 43 44 45 46 47 48 |
# File 'lib/repro/api/client.rb', line 41 def self.push_deliver(push_id, user_ids, opts = {}) raise ArgumentError, ':body is required.' unless opts[:body] opts[:path] = "/push/#{push_id}/deliver" body = { audience: { user_ids: user_ids } } body[:notification] = {custom_payload: build_payload(opts)} opts[:body] = body send_request(opts) end |
.token ⇒ Object
52 53 54 |
# File 'lib/repro/api/client.rb', line 52 def token [:token] end |
.user_agent ⇒ Object
56 57 58 |
# File 'lib/repro/api/client.rb', line 56 def user_agent [:user_agent] || "Repro Ruby Client/#{VERSION}" end |