Class: RakutenWebService::Configuration
- Inherits:
-
Object
- Object
- RakutenWebService::Configuration
- Defined in:
- lib/rakuten_web_service/configuration.rb
Instance Attribute Summary collapse
-
#affiliate_id ⇒ Object
Returns the value of attribute affiliate_id.
-
#application_id ⇒ Object
Returns the value of attribute application_id.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
Instance Method Summary collapse
- #debug_mode? ⇒ Boolean
- #default_parameters ⇒ Object
- #generate_parameters(params) ⇒ Object
- #has_required_options? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 |
# 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 |
Instance Attribute Details
#affiliate_id ⇒ Object
Returns the value of attribute affiliate_id
7 8 9 |
# File 'lib/rakuten_web_service/configuration.rb', line 7 def affiliate_id @affiliate_id end |
#application_id ⇒ Object
Returns the value of attribute application_id
7 8 9 |
# File 'lib/rakuten_web_service/configuration.rb', line 7 def application_id @application_id end |
#debug ⇒ Object
Returns the value of attribute debug
7 8 9 |
# File 'lib/rakuten_web_service/configuration.rb', line 7 def debug @debug end |
#max_retries ⇒ Object
Returns the value of attribute max_retries
7 8 9 |
# File 'lib/rakuten_web_service/configuration.rb', line 7 def max_retries @max_retries end |
Instance Method Details
#debug_mode? ⇒ Boolean
28 29 30 |
# File 'lib/rakuten_web_service/configuration.rb', line 28 def debug_mode? ENV.key?('RWS_SDK_DEBUG') || debug end |
#default_parameters ⇒ Object
19 20 21 22 |
# File 'lib/rakuten_web_service/configuration.rb', line 19 def default_parameters raise 'Application ID is not defined' unless { application_id: application_id, affiliate_id: affiliate_id, format_version: '2' } end |
#generate_parameters(params) ⇒ Object
15 16 17 |
# 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? ⇒ Boolean
24 25 26 |
# File 'lib/rakuten_web_service/configuration.rb', line 24 def application_id && application_id != '' end |