Class: Exa::Services::GetContents

Inherits:
Object
  • Object
show all
Defined in:
lib/exa/services/get_contents.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, **params) ⇒ GetContents



6
7
8
9
# File 'lib/exa/services/get_contents.rb', line 6

def initialize(connection, **params)
  @connection = connection
  @params = params
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/exa/services/get_contents.rb', line 11

def call
  response = @connection.post("/contents", @params)
  body = response.body

  Resources::ContentsResult.new(
    results: body["results"],
    request_id: body["requestId"],
    context: body["context"],
    statuses: body["statuses"],
    cost_dollars: body["costDollars"]
  )
end