Class: EasyMeli::ApiClient
- Inherits:
-
Object
- Object
- EasyMeli::ApiClient
- Includes:
- HTTParty
- Defined in:
- lib/easy_meli/api_client.rb
Constant Summary collapse
- API_ROOT_URL =
'https://api.mercadolibre.com'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #delete(path, query: {}) ⇒ Object
- #get(path, query: {}) ⇒ Object
-
#initialize(access_token = nil, logger: nil) ⇒ ApiClient
constructor
A new instance of ApiClient.
- #post(path, query: {}, body: {}) ⇒ Object
- #put(path, query: {}, body: {}) ⇒ Object
Constructor Details
#initialize(access_token = nil, logger: nil) ⇒ ApiClient
Returns a new instance of ApiClient.
13 14 15 16 |
# File 'lib/easy_meli/api_client.rb', line 13 def initialize(access_token = nil, logger: nil) @logger = logger @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
11 12 13 |
# File 'lib/easy_meli/api_client.rb', line 11 def access_token @access_token end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
11 12 13 |
# File 'lib/easy_meli/api_client.rb', line 11 def logger @logger end |
Instance Method Details
#delete(path, query: {}) ⇒ Object
30 31 32 |
# File 'lib/easy_meli/api_client.rb', line 30 def delete(path, query: {}) send_request(:delete, path, query: query) end |
#get(path, query: {}) ⇒ Object
18 19 20 |
# File 'lib/easy_meli/api_client.rb', line 18 def get(path, query: {}) send_request(:get, path, query: query) end |
#post(path, query: {}, body: {}) ⇒ Object
22 23 24 |
# File 'lib/easy_meli/api_client.rb', line 22 def post(path, query: {}, body: {}) send_request(:post, path, query: query, body: body) end |
#put(path, query: {}, body: {}) ⇒ Object
26 27 28 |
# File 'lib/easy_meli/api_client.rb', line 26 def put(path, query: {}, body: {}) send_request(:put, path, query: query, body: body) end |