Class: EasyMeli::ApiClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/easy_meli/api_client.rb

Constant Summary collapse

API_ROOT_URL =
'https://api.mercadolibre.com'

Instance Attribute Summary collapse

Instance Method Summary collapse

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_tokenObject (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

#loggerObject (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