Class: MagicWrite::Configuration

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

Constant Summary collapse

DEFAULT_URI_BASE =
'https://api.magicwrite.ai/rest/'.freeze
DEFAULT_REQUEST_TIMEOUT =
120

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



25
26
27
28
29
30
# File 'lib/magicwrite.rb', line 25

def initialize
  @access_token = nil
  @uri_base = DEFAULT_URI_BASE
  @request_timeout = DEFAULT_REQUEST_TIMEOUT
  @extra_headers = nil
end

Instance Attribute Details

#access_tokenObject

Raises:



32
33
34
35
36
37
# File 'lib/magicwrite.rb', line 32

def access_token
  return @access_token if @access_token

  error_text = 'MagicWrite access token missing! See https://github.com/kykocamp/ruby-magicwrite#usage'
  raise ConfigurationError, error_text
end

#extra_headersObject

Returns the value of attribute extra_headers.



20
21
22
# File 'lib/magicwrite.rb', line 20

def extra_headers
  @extra_headers
end

#request_timeoutObject

Returns the value of attribute request_timeout.



20
21
22
# File 'lib/magicwrite.rb', line 20

def request_timeout
  @request_timeout
end

#uri_baseObject

Returns the value of attribute uri_base.



20
21
22
# File 'lib/magicwrite.rb', line 20

def uri_base
  @uri_base
end