class FlexCommerceApi::Config

Global configuration object

This is not accessed directly but using code similar to this example :-

FlexCommerceApi.config do |config|
  config.flex_root_url=ENV["FLEX_ROOT_URL"]
  config.flex_account=ENV["FLEX_ACCOUNT"]
  config.flex_api_key=ENV["FLEX_API_KEY"]
  config.logger = Rails.logger
  config.order_test_mode = ENV.key?("ORDER_TEST_MODE")
end

The above code would typically be found in a rails initializer as an example.

Attributes

adapter[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
api_version[R]
flex_account[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
flex_api_key[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
flex_root_url[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
forwarded_for[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
http_cache[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
logger[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
open_timeout[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
order_test_mode[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
paypal_connection_errors_no_of_retries[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
paypal_login[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
paypal_password[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
paypal_signature[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders
timeout[RW]

@!attribute flex_root_url

The root url for the flex server.  Must NOT include the account name at the end
For example https://api.flexcommerce.com

@!attribute flex_account

The account to be used on the flex server.
For example myaccount

@!attribute flex_api_key

The API key to access the flex server with.  This comes from the 'Access Keys'
section of the admin panel

@!attribute order_test_mode

The order test mode.This config determines if orders are processed as test or real orders

Public Class Methods

new() click to toggle source
# File lib/flex_commerce_api/config.rb, line 50
def initialize
  self.order_test_mode = false
  self.http_cache = {}
  self.open_timeout = ENV.fetch("SHIFT_OPEN_TIMEOUT", 2).to_i
  self.timeout = ENV.fetch("SHIFT_TIMEOUT", 15).to_i
end

Public Instance Methods

api_base_url() click to toggle source

The api base URL @return [String] The base URL for the flex system. Calculated from the

flex_root_url and _api_verision
# File lib/flex_commerce_api/config.rb, line 60
def api_base_url
  "#{flex_root_url}/#{flex_account}"
end
reconfigure_all!() click to toggle source

Informs all models that the configuration may have changed but only if ApiBase is defined - else nothing has loaded yet so they wont need reconfiguring

# File lib/flex_commerce_api/config.rb, line 67
def reconfigure_all!
  FlexCommerceApi::BaseResource.reconfigure_all if FlexCommerceApi.const_defined? "ApiBase"
end