Class: HotelBeds::Configuration
- Inherits:
-
Object
- Object
- HotelBeds::Configuration
- Defined in:
- lib/hotel_beds/configuration.rb
Instance Attribute Summary collapse
-
#enable_logging ⇒ Object
Returns the value of attribute enable_logging.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#password ⇒ Object
Returns the value of attribute password.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#response_timeout ⇒ Object
Returns the value of attribute response_timeout.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #enable_logging? ⇒ Boolean
-
#initialize(endpoint: :test, username:, password:, proxy: nil, request_timeout: 5, response_timeout: 30, enable_logging: false) ⇒ Configuration
constructor
A new instance of Configuration.
- #proxy? ⇒ Boolean
Constructor Details
#initialize(endpoint: :test, username:, password:, proxy: nil, request_timeout: 5, response_timeout: 30, enable_logging: false) ⇒ Configuration
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hotel_beds/configuration.rb', line 14 def initialize(endpoint: :test, username:, password:, proxy: nil, request_timeout: 5, response_timeout: 30, enable_logging: false) self.endpoint = self.class.endpoints.fetch(endpoint, endpoint) self.username = username self.password = password self.proxy = proxy self.request_timeout = Integer(request_timeout) self.response_timeout = Integer(response_timeout) self.enable_logging = enable_logging freeze end |
Instance Attribute Details
#enable_logging ⇒ Object
Returns the value of attribute enable_logging.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def enable_logging @enable_logging end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def endpoint @endpoint end |
#password ⇒ Object
Returns the value of attribute password.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def password @password end |
#proxy ⇒ Object
Returns the value of attribute proxy.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def proxy @proxy end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def request_timeout @request_timeout end |
#response_timeout ⇒ Object
Returns the value of attribute response_timeout.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def response_timeout @response_timeout end |
#username ⇒ Object
Returns the value of attribute username.
11 12 13 |
# File 'lib/hotel_beds/configuration.rb', line 11 def username @username end |
Class Method Details
.endpoints ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/hotel_beds/configuration.rb', line 3 def self.endpoints path = "appservices/ws/FrontendService" { test: "http://testapi.interface-xml.com/#{path}".freeze, live: "http://api.interface-xml.com/#{path}".freeze, } end |
Instance Method Details
#enable_logging? ⇒ Boolean
25 26 27 |
# File 'lib/hotel_beds/configuration.rb', line 25 def enable_logging? !!enable_logging end |
#proxy? ⇒ Boolean
29 30 31 |
# File 'lib/hotel_beds/configuration.rb', line 29 def proxy? !!(proxy && !proxy.empty?) end |