module Workarea::Emarsys
Constants
- VERSION
Public Class Methods
api_token()
click to toggle source
# File lib/workarea/emarsys.rb, line 31 def self.api_token sales_data_credentials[:api_token] end
config()
click to toggle source
# File lib/workarea/emarsys.rb, line 35 def self.config Workarea.config.emarsys end
credentials()
click to toggle source
# File lib/workarea/emarsys.rb, line 11 def self.credentials (Rails.application.secrets.emarsys || {}).deep_symbolize_keys end
gateway()
click to toggle source
Conditionally use the real gateway when secrets are present. Otherwise, use the bogus gateway.
@return [Emarsys::Gateway]
# File lib/workarea/emarsys.rb, line 43 def self.gateway if credentials.present? Emarsys::Gateway.new(secret_key, user_name, { test: !Workarea.config.emarsys_production_api }) else Emarsys::BogusGateway.new end end
merchant_id()
click to toggle source
# File lib/workarea/emarsys.rb, line 27 def self.merchant_id Workarea.config.merchant_id end
sales_data_credentials()
click to toggle source
# File lib/workarea/emarsys.rb, line 15 def self.sales_data_credentials (Rails.application.secrets.emarsys_sales || {}).deep_symbolize_keys end
sales_data_gateway()
click to toggle source
# File lib/workarea/emarsys.rb, line 51 def self.sales_data_gateway if credentials.present? Emarsys::SalesDataGateway.new(api_token, { merchant_id: Emarsys.merchant_id }) else Emarsys::SalesDataBogusGateway.new end end
secret_key()
click to toggle source
# File lib/workarea/emarsys.rb, line 19 def self.secret_key credentials[:secret_key] end
user_name()
click to toggle source
# File lib/workarea/emarsys.rb, line 23 def self.user_name credentials[:user_name] end