Class: Fortnox::API::Base

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
EnvironmentValidation, RequestHandling, HTTParty
Defined in:
lib/fortnox/api/base.rb

Direct Known Subclasses

Repository::Base

Constant Summary collapse

DEFAULT_HEADERS =
{
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
}
HTTP_METHODS =
[ :get, :put, :post, :delete ]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassMethods

get_access_token, set_headers

Constructor Details

#initializeBase

Returns a new instance of Base.



26
27
28
29
30
31
32
33
# File 'lib/fortnox/api/base.rb', line 26

def initialize
  self.class.base_uri( get_base_url )

  self.headers = DEFAULT_HEADERS.merge({
    'Client-Secret' => get_client_secret,
    'Access-Token' => get_access_token,
  })
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



24
25
26
# File 'lib/fortnox/api/base.rb', line 24

def headers
  @headers
end