Class: Exa::Services::Websets::GetImport

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

Instance Method Summary collapse

Constructor Details

#initialize(connection, id:) ⇒ GetImport



7
8
9
10
# File 'lib/exa/services/websets/import_get.rb', line 7

def initialize(connection, id:)
  @connection = connection
  @id = id
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/exa/services/websets/import_get.rb', line 12

def call
  response = @connection.get("/websets/v0/imports/#{@id}")
  body = response.body

  Resources::Import.new(
    id: body["id"],
    object: body["object"],
    status: body["status"],
    format: body["format"],
    entity: body["entity"],
    title: body["title"],
    count: body["count"],
    metadata: body["metadata"],
    failed_reason: body["failedReason"],
    failed_at: body["failedAt"],
    failed_message: body["failedMessage"],
    created_at: body["createdAt"],
    updated_at: body["updatedAt"],
    upload_url: body["uploadUrl"],
    upload_valid_until: body["uploadValidUntil"]
  )
end