Class: AbsorbApi::Authorize

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAuthorize

Returns a new instance of Authorize.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/absorb_api/authorize.rb', line 5

def initialize
  @token ||= Faraday.new(url: AbsorbApi.configuration.url) do |faraday|
    faraday.request :url_encoded
    faraday.response :logger
    faraday.adapter :typhoeus
  end.post do |req|
    req.url 'Authenticate', username: AbsorbApi.configuration.absorbuser, password: AbsorbApi.configuration.absorbpass, privateKey: AbsorbApi.configuration.absorbkey
    req.headers['Content-Type'] = 'application/json'
    req.headers['accept'] = 'json'
  end.body.delete('\\"')
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



3
4
5
# File 'lib/absorb_api/authorize.rb', line 3

def token
  @token
end