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.



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

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
  @ingore_invalid_contacts  = true
  @logger                   = Rails.logger if defined?(Rails.logger) 
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 returns 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

#ingore_invalid_contactsObject

String - API key to override ENV



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

def ingore_invalid_contacts
  @ingore_invalid_contacts
end

#loggerObject

String - API key to override ENV



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

def logger
  @logger
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



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

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

#debug?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/knowtify/config.rb', line 33

def debug?
  @debug == true
end

#ingore_invalid_contacts?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/knowtify/config.rb', line 37

def ingore_invalid_contacts?
  @ingore_invalid_contacts == true
end