Class: CardDB::ScanJob

Inherits:
Resource show all
Defined in:
lib/carddb/collection.rb

Instance Attribute Summary

Attributes inherited from Resource

#client, #data

Instance Method Summary collapse

Methods inherited from Resource

#[], #initialize, #key?, #to_h, #to_json

Constructor Details

This class inherits a constructor from CardDB::Resource

Instance Method Details

#best_matchObject



1024
1025
1026
# File 'lib/carddb/collection.rb', line 1024

def best_match
  @best_match ||= data['bestMatch'] ? ScanBestMatch.new(data['bestMatch'], client: client) : nil
end

#cancelled?Boolean

Returns:

  • (Boolean)


1022
# File 'lib/carddb/collection.rb', line 1022

def cancelled? = status.to_s.downcase == 'cancelled'

#candidatesObject



1028
1029
1030
# File 'lib/carddb/collection.rb', line 1028

def candidates
  @candidates ||= (data['candidates'] || []).map { |candidate| ScanCandidate.new(candidate, client: client) }
end

#client_request_idObject



1012
# File 'lib/carddb/collection.rb', line 1012

def client_request_id = data['clientRequestId']

#completed?Boolean

Returns:

  • (Boolean)


1020
# File 'lib/carddb/collection.rb', line 1020

def completed? = status.to_s.downcase == 'completed'

#completed_atObject



1019
# File 'lib/carddb/collection.rb', line 1019

def completed_at = parse_time(data['completedAt'])

#created_atObject



1016
# File 'lib/carddb/collection.rb', line 1016

def created_at = parse_time(data['createdAt'])

#dataset_keyObject



1010
# File 'lib/carddb/collection.rb', line 1010

def dataset_key = data['datasetKey']

#errorObject



1040
1041
1042
# File 'lib/carddb/collection.rb', line 1040

def error
  @error ||= data['error'] ? ScanJobError.new(data['error'], client: client) : nil
end

#extractedObject



1015
# File 'lib/carddb/collection.rb', line 1015

def extracted = data['extracted'] || {}

#failed?Boolean

Returns:

  • (Boolean)


1021
# File 'lib/carddb/collection.rb', line 1021

def failed? = status.to_s.downcase == 'failed'

#file_idObject



1011
# File 'lib/carddb/collection.rb', line 1011

def file_id = data['fileId']

#game_keyObject



1009
# File 'lib/carddb/collection.rb', line 1009

def game_key = data['gameKey']

#job_idObject



1006
# File 'lib/carddb/collection.rb', line 1006

def job_id = data['jobId']

#metricsObject



1032
1033
1034
# File 'lib/carddb/collection.rb', line 1032

def metrics
  @metrics ||= data['metrics'] ? ScanJobMetrics.new(data['metrics'], client: client) : nil
end

#publisher_slugObject



1008
# File 'lib/carddb/collection.rb', line 1008

def publisher_slug = data['publisherSlug']

#started_atObject



1018
# File 'lib/carddb/collection.rb', line 1018

def started_at = parse_time(data['startedAt'])

#statusObject



1007
# File 'lib/carddb/collection.rb', line 1007

def status = data['status']

#template_idObject



1013
# File 'lib/carddb/collection.rb', line 1013

def template_id = data['templateId']

#template_version_idObject



1014
# File 'lib/carddb/collection.rb', line 1014

def template_version_id = data['templateVersionId']

#updated_atObject



1017
# File 'lib/carddb/collection.rb', line 1017

def updated_at = parse_time(data['updatedAt'])

#webhookObject



1036
1037
1038
# File 'lib/carddb/collection.rb', line 1036

def webhook
  @webhook ||= data['webhook'] ? ScanWebhookState.new(data['webhook'], client: client) : nil
end