class RakutenWebService::Configuration
Attributes
affiliate_id[RW]
application_id[RW]
debug[RW]
max_retries[RW]
Public Class Methods
new()
click to toggle source
# File lib/rakuten_web_service/configuration.rb, line 9 def initialize @application_id = ENV['RWS_APPLICATION_ID'] @affiliate_id = ENV['RWS_AFFILIATE_ID'] @max_retries = 5 end
Public Instance Methods
debug_mode?()
click to toggle source
# File lib/rakuten_web_service/configuration.rb, line 28 def debug_mode? ENV.key?('RWS_SDK_DEBUG') || debug end
default_parameters()
click to toggle source
# File lib/rakuten_web_service/configuration.rb, line 19 def default_parameters raise 'Application ID is not defined' unless has_required_options? { application_id: application_id, affiliate_id: affiliate_id, format_version: '2' } end
generate_parameters(params)
click to toggle source
# File lib/rakuten_web_service/configuration.rb, line 15 def generate_parameters(params) convert_snake_key_to_camel_key(default_parameters.merge(params)) end
has_required_options?()
click to toggle source
# File lib/rakuten_web_service/configuration.rb, line 24 def has_required_options? application_id && application_id != '' end
Private Instance Methods
convert_snake_key_to_camel_key(params)
click to toggle source
# File lib/rakuten_web_service/configuration.rb, line 36 def convert_snake_key_to_camel_key(params) params.inject({}) do |h, (k, v)| k = k.to_s.to_camel h[k] = v h end end