class EbayClient::Configuration
Attributes
api_keys[RW]
current_key[RW]
error_language[RW]
http_read_timeout[RW]
routing[RW]
savon_log_level[RW]
siteid[RW]
url[RW]
version[RW]
warning_level[RW]
Public Class Methods
load(file)
click to toggle source
# File lib/ebay_client/configuration.rb, line 56 def load(file) defaults = load_defaults configs = YAML.load(ERB.new(File.read(file)).result) configs.each_pair do |env, presets| env_defaults = defaults[env] || {} presets = presets || {} configs[env] = new env_defaults.merge(presets) end configs end
new(presets)
click to toggle source
# File lib/ebay_client/configuration.rb, line 14 def initialize(presets) presets.each do |key, val| instance_variable_set "@#{key}", val end @api_keys = @api_keys.map do |key_values| ApiKey.new key_values end.shuffle @current_key = @api_keys.first end
Protected Class Methods
defaults_file()
click to toggle source
# File lib/ebay_client/configuration.rb, line 75 def defaults_file File.expand_path '../../../config/defaults.yml', __FILE__ end
load_defaults()
click to toggle source
# File lib/ebay_client/configuration.rb, line 71 def load_defaults YAML.load_file defaults_file end
Public Instance Methods
appid()
click to toggle source
# File lib/ebay_client/configuration.rb, line 31 def appid @current_key.appid end
certid()
click to toggle source
# File lib/ebay_client/configuration.rb, line 39 def certid @current_key.certid end
devid()
click to toggle source
# File lib/ebay_client/configuration.rb, line 35 def devid @current_key.devid end
next_key!()
click to toggle source
# File lib/ebay_client/configuration.rb, line 25 def next_key! i = @api_keys.index(@current_key) + 1 i = 0 if i >= @api_keys.count @current_key = @api_keys[i] end
preload?()
click to toggle source
# File lib/ebay_client/configuration.rb, line 51 def preload? !!@preload end
token()
click to toggle source
# File lib/ebay_client/configuration.rb, line 43 def token @current_key.token end
wsdl_file()
click to toggle source
# File lib/ebay_client/configuration.rb, line 47 def wsdl_file @wsdl_file ||= File.expand_path "../../../vendor/ebay/#{version}.wsdl", __FILE__ end