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
5 6 7 8 9 |
# File 'lib/rakuten_web_service/configuration.rb', line 5 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.
3 4 5 |
# File 'lib/rakuten_web_service/configuration.rb', line 3 def affiliate_id @affiliate_id end |
#application_id ⇒ Object
Returns the value of attribute application_id.
3 4 5 |
# File 'lib/rakuten_web_service/configuration.rb', line 3 def application_id @application_id end |
#debug ⇒ Object
Returns the value of attribute debug.
3 4 5 |
# File 'lib/rakuten_web_service/configuration.rb', line 3 def debug @debug end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
3 4 5 |
# File 'lib/rakuten_web_service/configuration.rb', line 3 def max_retries @max_retries end |
Instance Method Details
#debug_mode? ⇒ Boolean
24 25 26 |
# File 'lib/rakuten_web_service/configuration.rb', line 24 def debug_mode? ENV.has_key?('RWS_SDK_DEBUG') || debug end |
#default_parameters ⇒ Object
15 16 17 18 |
# File 'lib/rakuten_web_service/configuration.rb', line 15 def default_parameters raise "Application ID is not defined" unless { application_id: application_id, affiliate_id: affiliate_id } end |
#generate_parameters(params) ⇒ Object
11 12 13 |
# File 'lib/rakuten_web_service/configuration.rb', line 11 def generate_parameters(params) convert_snake_key_to_camel_key(default_parameters.merge(params)) end |
#has_required_options? ⇒ Boolean
20 21 22 |
# File 'lib/rakuten_web_service/configuration.rb', line 20 def application_id && application_id != '' end |