Module: Amadeus::Client::HTTP

Included in:
Amadeus::Client
Defined in:
lib/amadeus/client/http.rb

Overview

A helper module for making generic API calls. It is used by every namespaced API method.

Instance Method Summary collapse

Instance Method Details

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

A helper module for making generic GET requests calls. It is used by every namespaced API GET method.

amadeus.reference_data.urls.checkin_links.get(airline: '1X')

It can be used to make any generic API call that is automatically authenticated using your API credentials:

amadeus.get('/v2/reference-data/urls/checkin-links', {
  airline: '1X'
})

Parameters:

  • path (String)

    the full path for the API call

  • params (Hash) (defaults to: {})

    the optional GET params to pass to the API



26
27
28
# File 'lib/amadeus/client/http.rb', line 26

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

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

A helper module for making generic POST requests calls. It is used by every namespaced API POST method.

amadeus.foo.bar.post(some: 'data')

It can be used to make any generic API call that is automatically authenticated using your API credentials:

amadeus.post('/v2/foo/bar', { some: 'data' })

To make an unauthenticated API call, make sure to pass in an explicit nil for the access token:

amadeus.post('/v2/foo/bar', { some: 'data' }, nil)

Parameters:

  • path (String)

    the full path for the API call

  • params (Hash) (defaults to: {})

    the optional POST params to pass to the API



48
49
50
# File 'lib/amadeus/client/http.rb', line 48

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