Module: Fortnox::API::ClassMethods

Includes:
EnvironmentValidation
Included in:
Base
Defined in:
lib/fortnox/api/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#get_access_tokenObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fortnox/api/class_methods.rb', line 9

def get_access_token
  repository = self.new

  repository.headers = {
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'Authorization-Code' => get_authorization_code,
    'Client-Secret' => get_client_secret,
  }

  response = repository.get('/')

  response[ 'Authorisation' ][ 'AccessToken' ]
end

#set_headers(headers = {}) ⇒ Object



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

def set_headers( headers = {} )
  self.headers.merge!( headers )
end