Class: Dato::Account::Client
- Inherits:
-
Object
- Object
- Dato::Account::Client
- Defined in:
- lib/dato/account/client.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#extra_headers ⇒ Object
readonly
Returns the value of attribute extra_headers.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token, base_url: 'https://account-api.datocms.com', extra_headers: {}) ⇒ Client
constructor
A new instance of Client.
- #request(*args) ⇒ Object
Constructor Details
#initialize(token, base_url: 'https://account-api.datocms.com', extra_headers: {}) ⇒ Client
Returns a new instance of Client.
21 22 23 24 25 26 27 28 29 |
# File 'lib/dato/account/client.rb', line 21 def initialize( token, base_url: 'https://account-api.datocms.com', extra_headers: {} ) @base_url = base_url @token = token @extra_headers = extra_headers end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
19 20 21 |
# File 'lib/dato/account/client.rb', line 19 def base_url @base_url end |
#extra_headers ⇒ Object (readonly)
Returns the value of attribute extra_headers.
19 20 21 |
# File 'lib/dato/account/client.rb', line 19 def extra_headers @extra_headers end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
19 20 21 |
# File 'lib/dato/account/client.rb', line 19 def schema @schema end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
19 20 21 |
# File 'lib/dato/account/client.rb', line 19 def token @token end |
Instance Method Details
#request(*args) ⇒ Object
41 42 43 44 45 |
# File 'lib/dato/account/client.rb', line 41 def request(*args) connection.send(*args).body.with_indifferent_access rescue Faraday::ClientError => e raise ApiError, e end |