Class: CF::Configuration
- Inherits:
-
Object
- Object
- CF::Configuration
- Defined in:
- lib/cf/configuration.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#team_id ⇒ Object
Returns the value of attribute team_id.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#workspace_id ⇒ Object
Returns the value of attribute workspace_id.
Instance Method Summary collapse
- #base_url ⇒ Object
- #debug? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #log_requests? ⇒ Boolean
- #logger ⇒ Object
- #logger=(custom_logger) ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cf/configuration.rb', line 7 def initialize @subdomain = nil @api_token = nil @api_version = "v2" @debug = false @timeout = 30 @logger = nil @workspace_id = nil @team_id = nil end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def api_token @api_token end |
#api_version ⇒ Object
Returns the value of attribute api_version.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def api_version @api_version end |
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def debug @debug end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def subdomain @subdomain end |
#team_id ⇒ Object
Returns the value of attribute team_id.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def team_id @team_id end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def timeout @timeout end |
#workspace_id ⇒ Object
Returns the value of attribute workspace_id.
5 6 7 |
# File 'lib/cf/configuration.rb', line 5 def workspace_id @workspace_id end |
Instance Method Details
#base_url ⇒ Object
18 19 20 21 22 |
# File 'lib/cf/configuration.rb', line 18 def base_url raise CF::ConfigurationError, "Subdomain is required" unless subdomain "https://#{subdomain}.myclickfunnels.com/api/#{api_version}" end |
#debug? ⇒ Boolean
28 29 30 |
# File 'lib/cf/configuration.rb', line 28 def debug? debug end |
#log_requests? ⇒ Boolean
32 33 34 |
# File 'lib/cf/configuration.rb', line 32 def log_requests? debug? end |
#logger ⇒ Object
36 37 38 |
# File 'lib/cf/configuration.rb', line 36 def logger @logger ||= debug? ? CF::FileLogger.new : nil end |
#logger=(custom_logger) ⇒ Object
40 41 42 |
# File 'lib/cf/configuration.rb', line 40 def logger=(custom_logger) @logger = custom_logger end |
#valid? ⇒ Boolean
24 25 26 |
# File 'lib/cf/configuration.rb', line 24 def valid? !subdomain.nil? && !api_token.nil? end |