Class: CF::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_tokenObject

Returns the value of attribute api_token.



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

def api_token
  @api_token
end

#api_versionObject

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

#debugObject

Returns the value of attribute debug.



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

def debug
  @debug
end

#subdomainObject

Returns the value of attribute subdomain.



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

def subdomain
  @subdomain
end

#team_idObject

Returns the value of attribute team_id.



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

def team_id
  @team_id
end

#timeoutObject

Returns the value of attribute timeout.



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

def timeout
  @timeout
end

#workspace_idObject

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_urlObject



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

Returns:

  • (Boolean)


28
29
30
# File 'lib/cf/configuration.rb', line 28

def debug?
  debug
end

#log_requests?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/cf/configuration.rb', line 32

def log_requests?
  debug?
end

#loggerObject



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

Returns:

  • (Boolean)


24
25
26
# File 'lib/cf/configuration.rb', line 24

def valid?
  !subdomain.nil? && !api_token.nil?
end