Class: Amadeus::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/amadeus/client/request.rb,
lib/amadeus/client/request/hash.rb

Overview

A Request object containing all the compiled information about this request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_id ⇒ String (readonly)

The custom app ID passed in for this request

Returns:

  • (String)


45
46
47
# File 'lib/amadeus/client/request.rb', line 45

def app_id
  @app_id
end

#app_version ⇒ String (readonly)

The custom app version used for this request

Returns:

  • (String)


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

def app_version
  @app_version
end

#bearer_token ⇒ String (readonly)

The bearer token (if any) that is used for authentication

Returns:

  • (String)


33
34
35
# File 'lib/amadeus/client/request.rb', line 33

def bearer_token
  @bearer_token
end

#client_version ⇒ String (readonly)

The library version used for this request

Returns:

  • (String)


39
40
41
# File 'lib/amadeus/client/request.rb', line 39

def client_version
  @client_version
end

#headers ⇒ Hash (readonly)

The headers used for the API call

Returns:

  • (Hash)


36
37
38
# File 'lib/amadeus/client/request.rb', line 36

def headers
  @headers
end

#host ⇒ String (readonly)

The host used for this API call

Returns:

  • (String)


12
13
14
# File 'lib/amadeus/client/request.rb', line 12

def host
  @host
end

#language_version ⇒ String (readonly)

The Ruby language version used for this request

Returns:

  • (String)


42
43
44
# File 'lib/amadeus/client/request.rb', line 42

def language_version
  @language_version
end

#params ⇒ Hash (readonly)

The GET/POST params for the API call

Returns:

  • (Hash)


24
25
26
# File 'lib/amadeus/client/request.rb', line 24

def params
  @params
end

#path ⇒ String (readonly)

The path of the API to be called

Returns:

  • (String)


27
28
29
# File 'lib/amadeus/client/request.rb', line 27

def path
  @path
end

#port ⇒ Number (readonly)

The port for this API call. Standard set to 443.

Returns:

  • (Number)


15
16
17
# File 'lib/amadeus/client/request.rb', line 15

def port
  @port
end

#scheme ⇒ String (readonly)

The scheme used to make the API call

Returns:

  • (String)


21
22
23
# File 'lib/amadeus/client/request.rb', line 21

def scheme
  @scheme
end

#ssl ⇒ Boolean (readonly)

Wether to use SSL for a call, defaults to true

Returns:

  • (Boolean)


18
19
20
# File 'lib/amadeus/client/request.rb', line 18

def ssl
  @ssl
end

#verb ⇒ Symbol (readonly)

The verb used to make an API call (:GET or :POST)

Returns:

  • (Symbol)


30
31
32
# File 'lib/amadeus/client/request.rb', line 30

def verb
  @verb
end

Instance Method Details

#http_request ⇒ Object

Builds the request object



64
65
66
67
68
69
70
71
72
# File 'lib/amadeus/client/request.rb', line 64

def http_request
  @http_request ||= begin
    request = request_for_verb
    add_post_data(request)
    add_bearer_token(request)
    add_headers(request)
    request
  end
end