Class: Adtraction::Api::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/adtraction/api/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host: "api.adtraction.com", api_version: 1, api_key: nil) ⇒ Configuration

Returns a new instance of Configuration.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/adtraction/api/configuration.rb', line 6

def initialize(host: "api.adtraction.com", api_version: 1, api_key: nil)
  self.host             =   host
  self.api_version      =   api_version
  self.api_key          =   api_key

  self.faraday          =   {
    adapter:    :net_http,
    user_agent: "Adtraction Ruby Client #{::Adtraction::Api::VERSION}",
    verbose:    false
  }
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



4
5
6
# File 'lib/adtraction/api/configuration.rb', line 4

def api_key
  @api_key
end

#api_versionObject

Returns the value of attribute api_version.



4
5
6
# File 'lib/adtraction/api/configuration.rb', line 4

def api_version
  @api_version
end

#faradayObject

Returns the value of attribute faraday.



4
5
6
# File 'lib/adtraction/api/configuration.rb', line 4

def faraday
  @faraday
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'lib/adtraction/api/configuration.rb', line 4

def host
  @host
end

Instance Method Details

#verbose_faraday?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/adtraction/api/configuration.rb', line 18

def verbose_faraday?
  self.faraday.fetch(:verbose, false)
end