Module: EasyMeli

Defined in:
lib/easy_meli.rb,
lib/easy_meli/errors.rb,
lib/easy_meli/version.rb,
lib/easy_meli/constants.rb

Defined Under Namespace

Classes: AccessTokenError, ApiClient, AuthenticationError, AuthorizationClient, BadGatewayError, Configuration, CreateTokenError, Error, ErrorParser, ForbiddenError, GatewayTimeoutError, InternalServerError, InvalidGrantError, InvalidTokenError, MalformedTokenError, NotImplementedError, ServerError, ServiceUnavailableError, TooManyRequestsError, UnknownError

Constant Summary collapse

VERSION =
'0.6.17'
USER_AGENT =
"EasyMeli-%s" % VERSION
DEFAULT_HEADERS =
{
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'User-Agent' => USER_AGENT
}

Class Method Summary collapse

Class Method Details

.access_token(refresh_token, logger: nil) ⇒ Object



29
30
31
# File 'lib/easy_meli.rb', line 29

def self.access_token(refresh_token, logger: nil)
  EasyMeli::AuthorizationClient.access_token(refresh_token, logger: logger)
end

.api_client(access_token: nil, refresh_token: nil, logger: nil) ⇒ Object



33
34
35
36
# File 'lib/easy_meli.rb', line 33

def self.api_client(access_token: nil, refresh_token: nil, logger: nil)
  access_token ||= self.access_token(refresh_token, logger: logger) if refresh_token
  EasyMeli::ApiClient.new(access_token, logger: logger)
end

.authorization_url(country_code, redirect_uri) ⇒ Object



21
22
23
# File 'lib/easy_meli.rb', line 21

def self.authorization_url(country_code, redirect_uri)
  EasyMeli::AuthorizationClient.authorization_url(country_code, redirect_uri)
end

.configurationObject



13
14
15
# File 'lib/easy_meli.rb', line 13

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



17
18
19
# File 'lib/easy_meli.rb', line 17

def self.configure
  yield(configuration)
end

.create_token(code, redirect_uri, logger: nil) ⇒ Object



25
26
27
# File 'lib/easy_meli.rb', line 25

def self.create_token(code, redirect_uri, logger: nil)
  EasyMeli::AuthorizationClient.create_token(code, redirect_uri, logger: logger)
end