Sha256: 995e919ccb780e34ff30d5b0201260a85b0657ee42ec472ea46dddf455f12880

Contents?: true

Size: 656 Bytes

Versions: 4

Compression:

Stored size: 656 Bytes

Contents

require 'fortnox/api/environment_validation'

module Fortnox
  module API
    module ClassMethods

      include Fortnox::API::EnvironmentValidation

      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

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

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fortnox-api-0.4.0 lib/fortnox/api/class_methods.rb
fortnox-api-0.3.0 lib/fortnox/api/class_methods.rb
fortnox-api-0.2.0 lib/fortnox/api/class_methods.rb
fortnox-api-0.1.0 lib/fortnox/api/class_methods.rb