Class: UscreenAPI::Client
- Inherits:
-
Object
- Object
- UscreenAPI::Client
- Defined in:
- lib/uscreen_api/client.rb
Constant Summary collapse
- BASE_URL =
"https://www.uscreen.io/publisher_api/v1/"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #connection ⇒ Object
- #customers ⇒ Object
-
#initialize(api_key:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key:) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/uscreen_api/client.rb', line 11 def initialize(api_key:) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/uscreen_api/client.rb', line 7 def api_key @api_key end |
Instance Method Details
#connection ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/uscreen_api/client.rb', line 19 def connection @connection = Faraday.new( url: BASE_URL, headers: { "Content-Type": "application/json", Authorization: api_key } ) do |f| f.request(:json) f.response(:json) end end |
#customers ⇒ Object
15 16 17 |
# File 'lib/uscreen_api/client.rb', line 15 def customers @customers ||= UscreenAPI::Customers.new(client: self) end |