Class: Doconomy::Api::Client

Inherits:
Base
  • Object
show all
Defined in:
lib/doconomy/api/client.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

client, #errors

Instance Method Details

#delete(endpoint, headers = { 'Content-Type' => 'application/json' }, options = {}) ⇒ Hash

It makes HTTP DELETE request

Parameters:

  • endpoint
  • headers ({ 'Content-Type' => 'application/json' }) (defaults to: { 'Content-Type' => 'application/json' })

    Custom headers

  • options ({}) (defaults to: {})

    Additional options like `with_authorization'

Returns:

  • (Hash)


51
52
53
# File 'lib/doconomy/api/client.rb', line 51

def delete(endpoint, headers = { 'Content-Type' => 'application/json' }, options = {})
  request(:delete, endpoint, nil, headers, options)
end

#get(endpoint, headers = { 'Content-Type' => 'application/json' }, options = {}) ⇒ Hash

It makes HTTP GET request

Parameters:

  • endpoint
  • headers ({ 'Content-Type' => 'application/json' }) (defaults to: { 'Content-Type' => 'application/json' })

    Custom headers

  • options ({}) (defaults to: {})

    Additional options like `with_authorization'

Returns:

  • (Hash)


15
16
17
# File 'lib/doconomy/api/client.rb', line 15

def get(endpoint, headers = { 'Content-Type' => 'application/json' }, options = {})
  request(:get, endpoint, nil, headers, options)
end

#head(endpoint, headers = { 'Content-Type' => 'application/json' }, options = {}) ⇒ Hash

It makes HTTP HEAD request

Parameters:

  • endpoint
  • headers ({ 'Content-Type' => 'application/json' }) (defaults to: { 'Content-Type' => 'application/json' })

    Custom headers

  • options ({}) (defaults to: {})

    Additional options like `with_authorization'

Returns:

  • (Hash)


63
64
65
# File 'lib/doconomy/api/client.rb', line 63

def head(endpoint, headers = { 'Content-Type' => 'application/json' }, options = {})
  request(:head, endpoint, nil, headers, options)
end

#post(endpoint, payload = nil, headers = { 'Content-Type' => 'application/json' }, options = {}) ⇒ Hash

It makes HTTP POST request

Parameters:

  • endpoint
  • headers ({ 'Content-Type' => 'application/json' }) (defaults to: { 'Content-Type' => 'application/json' })

    Custom headers

  • options ({}) (defaults to: {})

    Additional options like `with_authorization'

Returns:

  • (Hash)


27
28
29
# File 'lib/doconomy/api/client.rb', line 27

def post(endpoint, payload = nil, headers = { 'Content-Type' => 'application/json' }, options = {})
  request(:post, endpoint, payload, headers, options)
end

#put(endpoint, payload = nil, headers = { 'Content-Type' => 'application/json' }, options = {}) ⇒ Hash

It makes HTTP PUT request

Parameters:

  • endpoint
  • headers ({ 'Content-Type' => 'application/json' }) (defaults to: { 'Content-Type' => 'application/json' })

    Custom headers

  • options ({}) (defaults to: {})

    Additional options like `with_authorization'

Returns:

  • (Hash)


39
40
41
# File 'lib/doconomy/api/client.rb', line 39

def put(endpoint, payload = nil, headers = { 'Content-Type' => 'application/json' }, options = {})
  request(:put, endpoint, payload, headers, options)
end