Class: Knowtify::Config
- Inherits:
-
Object
- Object
- Knowtify::Config
- Defined in:
- lib/knowtify/config.rb
Constant Summary collapse
- HANDLERS =
{ :excon => Knowtify::ExconHandler }.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
String - API key to override ENV.
-
#api_version ⇒ Object
String - API key to override ENV.
-
#base_url ⇒ Object
String - API key to override ENV.
-
#debug ⇒ Object
String - API key to override ENV.
-
#handler ⇒ Object
Until there are more handler options just returns Excon.
-
#http_client_options ⇒ Object
String - API key to override ENV.
-
#ingore_invalid_contacts ⇒ Object
String - API key to override ENV.
-
#logger ⇒ Object
String - API key to override ENV.
-
#max_retries ⇒ Object
String - API key to override ENV.
Instance Method Summary collapse
- #base_path ⇒ Object
- #debug? ⇒ Boolean
- #ingore_invalid_contacts? ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
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_key ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def api_key @api_key end |
#api_version ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def api_version @api_version end |
#base_url ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def base_url @base_url end |
#debug ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def debug @debug end |
#handler ⇒ Object
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_options ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def @http_client_options end |
#ingore_invalid_contacts ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def ingore_invalid_contacts @ingore_invalid_contacts end |
#logger ⇒ Object
String - API key to override ENV
3 4 5 |
# File 'lib/knowtify/config.rb', line 3 def logger @logger end |
#max_retries ⇒ Object
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_path ⇒ Object
29 30 31 |
# File 'lib/knowtify/config.rb', line 29 def base_path "/api/#{@api_version}" end |
#debug? ⇒ Boolean
33 34 35 |
# File 'lib/knowtify/config.rb', line 33 def debug? @debug == true end |
#ingore_invalid_contacts? ⇒ Boolean
37 38 39 |
# File 'lib/knowtify/config.rb', line 37 def ingore_invalid_contacts? @ingore_invalid_contacts == true end |