Class: Omdb::Api::Request

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

Constant Summary collapse

BASE_URI =
'https://www.omdbapi.com'

Instance Method Summary collapse

Constructor Details

#initialize(client, request_method, params) ⇒ Request

Returns a new instance of Request.



10
11
12
13
14
15
# File 'lib/omdb/api/request.rb', line 10

def initialize(client, request_method, params)
  @configuration = client.configuration
  @request_method = request_method
  @headers = _set_headers(params.delete(:headers))
  @params = _set_params(params.delete(:query_params))
end

Instance Method Details

#performObject



17
18
19
20
21
22
23
24
# File 'lib/omdb/api/request.rb', line 17

def perform
  _http_client.public_send(
    @request_method,
    BASE_URI,
    headers: @headers,
    query: @params
  )
end