module Edools

Constants

CORE_BASE_URL
CORE_VERSION
ECOMMERCE_BASE_URL
ECOMMERCE_VERSION

Attributes

credentials[RW]
format[RW]

Public Class Methods

api_objects() click to toggle source
# File lib/edools/config.rb, line 24
def api_objects
  ObjectSpace.each_object(Class).select{ |klass| klass < Edools::Base } << Edools::Base
end
credentials=(new_credentials) click to toggle source

Set your API credentials using this method.

# File lib/edools/config.rb, line 8
def credentials= (new_credentials)
  @credentials = new_credentials
  refresh_config_for_api_objects!
  @credentials
end
format=(new_format) click to toggle source

Set the format that the API uses to either ‘json’ or ‘xml’. Accepts either a String or a Symbol.

# File lib/edools/config.rb, line 16
def format=(new_format)
  valid_formats = [:json, :xml]
  raise ArgumentError, "Invalid format.  Supported formats: #{valid_formats.join(', ')}." unless valid_formats.include?(new_format.to_sym)
  @format = new_format
  refresh_config_for_api_objects!
  @format
end
refresh_config_for_api_objects!() click to toggle source
# File lib/edools/config.rb, line 28
def refresh_config_for_api_objects!
  api_objects.each {|d| d.refresh_config!}
end