Class: Iterable::Config
- Inherits:
-
Object
- Object
- Iterable::Config
- Extended by:
- T::Sig
- Defined in:
- lib/iterable/config.rb
Overview
Config provides a class to configre the API calls when interacting with REST endpoints
Constant Summary collapse
- DEFAULT_VERSION =
'1.8'.freeze
- DEFAULT_HOST =
'https://api.iterable.com'.freeze
- DEFAULT_URI =
"#{DEFAULT_HOST}/api".freeze
- DEFAULT_PORT =
443
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#token ⇒ Object
Returns the value of attribute token.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(token: nil) ⇒ Config
constructor
A new instance of Config.
- #uri ⇒ Object
Constructor Details
#initialize(token: nil) ⇒ Config
Returns a new instance of Config.
28 29 30 31 32 33 |
# File 'lib/iterable/config.rb', line 28 def initialize(token: nil) @host = DEFAULT_HOST @port = DEFAULT_PORT @version = DEFAULT_VERSION @token = token end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
19 20 21 |
# File 'lib/iterable/config.rb', line 19 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
19 20 21 |
# File 'lib/iterable/config.rb', line 19 def port @port end |
#token ⇒ Object
Returns the value of attribute token.
18 19 20 |
# File 'lib/iterable/config.rb', line 18 def token @token end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
19 20 21 |
# File 'lib/iterable/config.rb', line 19 def version @version end |
Instance Method Details
#uri ⇒ Object
41 42 43 |
# File 'lib/iterable/config.rb', line 41 def uri URI.parse("#{@host || DEFAULT_HOST}:#{@port || DEFAULT_PORT}/api") end |