Class: BigcommerceOAuthAPI::API

Inherits:
Base
  • Object
show all
Includes:
Connection, Request
Defined in:
lib/bigcommerce-oauth-api/api.rb

Direct Known Subclasses

Client

Instance Method Summary collapse

Methods included from Request

#delete, #get, #post, #put

Constructor Details

#initialize(options = {}) ⇒ API

Returns a new instance of API.



9
10
11
12
13
14
15
# File 'lib/bigcommerce-oauth-api/api.rb', line 9

def initialize(options = {})
  merged_options = BigcommerceOAuthAPI.options.merge(options)

  Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", merged_options[key])
  end
end

Instance Method Details

#configObject



17
18
19
20
21
22
23
# File 'lib/bigcommerce-oauth-api/api.rb', line 17

def config
  conf = {}
  Configuration::VALID_OPTIONS_KEYS.each do |key|
    conf[key] = send(key)
  end
  conf
end

#is_legacy?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/bigcommerce-oauth-api/api.rb', line 25

def is_legacy?
  !user_name.nil? && !api_key.nil? && endpoint != Configuration::DEFAULT_ENDPOINT
end