Class: Knowtify::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/knowtify/config.rb

Constant Summary collapse

HANDLERS =
{
  :excon => Knowtify::ExconHandler
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
19
20
21
22
23
24
# File 'lib/knowtify/config.rb', line 16

def initialize
  @api_key              = ENV['KNOWTIFY_API_TOKEN']
  @base_url             = "http://www.knowtify.io"
  @api_version          = "v1"
  @http_client_options  = {}
  @max_retries          = 2
  @debug                = false
  @handler              = :excon
end

Instance Attribute Details

#api_keyObject

String - API key to override ENV



3
4
5
# File 'lib/knowtify/config.rb', line 3

def api_key
  @api_key
end

#api_versionObject

String - API key to override ENV



3
4
5
# File 'lib/knowtify/config.rb', line 3

def api_version
  @api_version
end

#base_urlObject

String - API key to override ENV



3
4
5
# File 'lib/knowtify/config.rb', line 3

def base_url
  @base_url
end

#debugObject

String - API key to override ENV



3
4
5
# File 'lib/knowtify/config.rb', line 3

def debug
  @debug
end

#handlerObject

Until there are more handler options just return Excon



3
4
5
# File 'lib/knowtify/config.rb', line 3

def handler
  @handler
end

#http_client_optionsObject

String - API key to override ENV



3
4
5
# File 'lib/knowtify/config.rb', line 3

def http_client_options
  @http_client_options
end

#max_retriesObject

String - API key to override ENV



3
4
5
# File 'lib/knowtify/config.rb', line 3

def max_retries
  @max_retries
end

Instance Method Details

#base_pathObject



26
27
28
# File 'lib/knowtify/config.rb', line 26

def base_path
  "/api/#{@api_version}"
end

#debug?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/knowtify/config.rb', line 30

def debug?
  @debug == true
end