class Levelup::Endpoints::AccessTokens

The endpoint holding all functions related to the management of access tokens.

Attributes

api_key[W]

The API key assigned to your app. Preconfigured key.

secret[W]

The client secret assigned to your app. Preconfigured key.

Public Class Methods

new(auth_info) click to toggle source
# File lib/levelup/endpoints/access_tokens.rb, line 10
def initialize(auth_info)
  @api_key = auth_info[:api_key]
  @secret = auth_info[:secret]
end

Public Instance Methods

create_for_app(app_auth_request = nil) click to toggle source

Generates a new app access token. If passed no parameters, attempts to pass the preconfigured API key and client secret to the endpoint.

# File lib/levelup/endpoints/access_tokens.rb, line 17
def create_for_app(app_auth_request = nil)
  build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },
      Requests::AuthenticateApp).
    send_to_api(:post, endpoint_path)
end
create_for_merchant(merchant_auth_request) click to toggle source

Generates a new merchant access token.

# File lib/levelup/endpoints/access_tokens.rb, line 24
def create_for_merchant(merchant_auth_request)
  build_request(merchant_auth_request,
      Requests::AuthenticateMerchant).
    send_to_api(:post, endpoint_path(:v14))
end

Private Instance Methods

path() click to toggle source
# File lib/levelup/endpoints/access_tokens.rb, line 32
def path
  'access_tokens'
end