Class: GoFlippy::Config
- Inherits:
-
Object
- Object
- GoFlippy::Config
- Includes:
- Logger
- Defined in:
- lib/goflippy-ruby/config.rb
Constant Summary collapse
- DEFAULT_API_URI =
'http://localhost'
- DEFAULT_OPEN_TIMEOUT =
3
- DEFAULT_READ_TIMEOUT =
10
- DEFAULT_POLLING_INTERVAL =
300
Constants included from Logger
Instance Attribute Summary collapse
-
#api_uri ⇒ Object
readonly
Returns the value of attribute api_uri.
-
#open_timeout ⇒ Object
readonly
Returns the value of attribute open_timeout.
-
#polling_interval ⇒ Object
readonly
Returns the value of attribute polling_interval.
-
#read_timeout ⇒ Object
readonly
Returns the value of attribute read_timeout.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Config
constructor
A new instance of Config.
Methods included from Logger
debug, error, fatal, info, logger, logger=, unknown, warn
Constructor Details
#initialize(opts = {}) ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 19 20 |
# File 'lib/goflippy-ruby/config.rb', line 14 def initialize(opts = {}) @api_uri = (opts[:api_uri] || DEFAULT_API_URI).chomp('/') @open_timeout = (opts[:open_timeout] || DEFAULT_OPEN_TIMEOUT) @read_timeout = (opts[:read_timeout] || DEFAULT_READ_TIMEOUT) @polling_interval = (opts[:polling_interval] || DEFAULT_POLLING_INTERVAL) Logger.logger = opts[:logger] if opts[:logger] end |
Instance Attribute Details
#api_uri ⇒ Object (readonly)
Returns the value of attribute api_uri.
9 10 11 |
# File 'lib/goflippy-ruby/config.rb', line 9 def api_uri @api_uri end |
#open_timeout ⇒ Object (readonly)
Returns the value of attribute open_timeout.
10 11 12 |
# File 'lib/goflippy-ruby/config.rb', line 10 def open_timeout @open_timeout end |
#polling_interval ⇒ Object (readonly)
Returns the value of attribute polling_interval.
12 13 14 |
# File 'lib/goflippy-ruby/config.rb', line 12 def polling_interval @polling_interval end |
#read_timeout ⇒ Object (readonly)
Returns the value of attribute read_timeout.
11 12 13 |
# File 'lib/goflippy-ruby/config.rb', line 11 def read_timeout @read_timeout end |