class Iterable::Config
Config
provides a class to configre the API calls when interacting with REST endpoints
@example Creating a config object
Iterable::Config.new token: 'secret-token'
Constants
- DEFAULT_HOST
- DEFAULT_PORT
- DEFAULT_URI
- DEFAULT_VERSION
Attributes
host[R]
port[R]
token[RW]
version[R]
Public Class Methods
new(token: nil)
click to toggle source
initialize a new [Iterable::Config] object for requests
@param token [String] Iterable
API token @return [Iterable::Config]
# File lib/iterable/config.rb, line 23 def initialize(token: nil) @host = DEFAULT_HOST @port = DEFAULT_PORT @version = DEFAULT_VERSION @token = token end
Public Instance Methods
uri()
click to toggle source
Creates a [URI] for the API host
@return [URI] API URI object
# File lib/iterable/config.rb, line 35 def uri URI.parse("#{@host || DEFAULT_HOST}:#{@port || DEFAULT_PORT}/api") end