Class: EbayClient::Configuration
- Inherits:
-
Object
- Object
- EbayClient::Configuration
- Defined in:
- lib/ebay_client/configuration.rb
Defined Under Namespace
Classes: ApiKey
Instance Attribute Summary collapse
-
#api_keys ⇒ Object
Returns the value of attribute api_keys.
-
#current_key ⇒ Object
Returns the value of attribute current_key.
-
#error_language ⇒ Object
Returns the value of attribute error_language.
-
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
-
#routing ⇒ Object
Returns the value of attribute routing.
-
#savon_log_level ⇒ Object
Returns the value of attribute savon_log_level.
-
#siteid ⇒ Object
Returns the value of attribute siteid.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
-
#warning_level ⇒ Object
Returns the value of attribute warning_level.
Class Method Summary collapse
Instance Method Summary collapse
- #appid ⇒ Object
- #certid ⇒ Object
- #devid ⇒ Object
-
#initialize(presets) ⇒ Configuration
constructor
A new instance of Configuration.
- #next_key! ⇒ Object
- #preload? ⇒ Boolean
- #token ⇒ Object
- #wsdl_file ⇒ Object
Constructor Details
#initialize(presets) ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 23 |
# 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 |
Instance Attribute Details
#api_keys ⇒ Object
Returns the value of attribute api_keys.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def api_keys @api_keys end |
#current_key ⇒ Object
Returns the value of attribute current_key.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def current_key @current_key end |
#error_language ⇒ Object
Returns the value of attribute error_language.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def error_language @error_language end |
#http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def http_read_timeout @http_read_timeout end |
#routing ⇒ Object
Returns the value of attribute routing.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def routing @routing end |
#savon_log_level ⇒ Object
Returns the value of attribute savon_log_level.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def savon_log_level @savon_log_level end |
#siteid ⇒ Object
Returns the value of attribute siteid.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def siteid @siteid end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def version @version end |
#warning_level ⇒ Object
Returns the value of attribute warning_level.
12 13 14 |
# File 'lib/ebay_client/configuration.rb', line 12 def warning_level @warning_level end |
Class Method Details
.load(file) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# 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 |
Instance Method Details
#appid ⇒ Object
31 32 33 |
# File 'lib/ebay_client/configuration.rb', line 31 def appid @current_key.appid end |
#certid ⇒ Object
39 40 41 |
# File 'lib/ebay_client/configuration.rb', line 39 def certid @current_key.certid end |
#devid ⇒ Object
35 36 37 |
# File 'lib/ebay_client/configuration.rb', line 35 def devid @current_key.devid end |
#next_key! ⇒ Object
25 26 27 28 29 |
# 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? ⇒ Boolean
51 52 53 |
# File 'lib/ebay_client/configuration.rb', line 51 def preload? !!@preload end |
#token ⇒ Object
43 44 45 |
# File 'lib/ebay_client/configuration.rb', line 43 def token @current_key.token end |
#wsdl_file ⇒ Object
47 48 49 |
# File 'lib/ebay_client/configuration.rb', line 47 def wsdl_file @wsdl_file ||= File. "../../../vendor/ebay/#{version}.wsdl", __FILE__ end |