Class: AbsorbApi::Api

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connectionObject



9
10
11
12
13
14
15
16
# File 'lib/absorb_api/api.rb', line 9

def connection
  Faraday.new(url: AbsorbApi.configuration.url) do |faraday|
    faraday.request :json
    faraday.response :json, content_type: /\bjson$/
    faraday.adapter Faraday.default_adapter
    faraday.headers = { "Authorization" => AbsorbApi.token }
  end
end

Instance Method Details

#delete(path, params = {}) ⇒ Object



34
35
36
# File 'lib/absorb_api/api.rb', line 34

def delete(path, params = {})
  request(:delete, path, params)
end

#get(path, params = {}) ⇒ Object



18
19
20
# File 'lib/absorb_api/api.rb', line 18

def get(path, params = {})
  request(:get, path, params)
end

#patch(path, params = {}) ⇒ Object



26
27
28
# File 'lib/absorb_api/api.rb', line 26

def patch(path, params = {})
  request(:patch, path, params)
end

#post(path, params = {}) ⇒ Object



30
31
32
# File 'lib/absorb_api/api.rb', line 30

def post(path, params = {})
  request(:post, path, params)
end

#put(path, params = {}) ⇒ Object



22
23
24
# File 'lib/absorb_api/api.rb', line 22

def put(path, params = {})
  request(:put, path, params)
end