Class: BillerBotResource::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



4
5
6
7
# File 'lib/biller_bot_resource/configuration.rb', line 4

def initialize
  self.site = "https://billerbot.com"
  self.timeout = 7 # seconds. Low value so we fail fast
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



2
3
4
# File 'lib/biller_bot_resource/configuration.rb', line 2

def logger
  @logger
end

#siteObject

Returns the value of attribute site.



2
3
4
# File 'lib/biller_bot_resource/configuration.rb', line 2

def site
  @site
end

#timeoutObject

Returns the value of attribute timeout.



2
3
4
# File 'lib/biller_bot_resource/configuration.rb', line 2

def timeout
  @timeout
end

Instance Method Details

#api_keyObject



16
17
18
# File 'lib/biller_bot_resource/configuration.rb', line 16

def api_key
  Thread.current["active.resource.currentthread.api_key"]
end

#api_key=(key) ⇒ Object

We store the API key within the context of the thread because this is more likely to change between requests.



12
13
14
# File 'lib/biller_bot_resource/configuration.rb', line 12

def api_key=(key)
  Thread.current["active.resource.currentthread.api_key"] = key
end