Class: TypeformData::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, logger: nil) ⇒ Config

Parameters:

  • api_key (String)
  • logger (Object) (defaults to: nil)

    Should implement the same API as



12
13
14
15
16
17
18
# File 'lib/typeform_data/config.rb', line 12

def initialize(api_key:, logger: nil)
  unless api_key.is_a?(String) && api_key.length.positive?
    raise TypeformData::ArgumentError, 'An API key (as a nonempty String) is required'
  end
  @api_key = api_key
  @logger = logger || Logger.new($stdout)
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



6
7
8
# File 'lib/typeform_data/config.rb', line 6

def api_key
  @api_key
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/typeform_data/config.rb', line 7

def logger
  @logger
end

Instance Method Details

#==(other) ⇒ Object



34
35
36
# File 'lib/typeform_data/config.rb', line 34

def ==(other)
  other.api_key == api_key
end

#api_versionObject



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

def api_version
  1
end

#hostObject

These values were determined via URI.parse(‘api.typeform.com’).



22
23
24
# File 'lib/typeform_data/config.rb', line 22

def host
  'api.typeform.com'
end

#portObject



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

def port
  443
end