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



1074
1075
1076
# File 'lib/carddb/collection.rb', line 1074

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

#cancelled?Boolean

Returns:

  • (Boolean)


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

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

#candidatesObject



1078
1079
1080
# File 'lib/carddb/collection.rb', line 1078

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

#client_request_idObject



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

def client_request_id = data['clientRequestId']

#completed?Boolean

Returns:

  • (Boolean)


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

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

#completed_atObject



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

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

#created_atObject



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

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

#dataset_keyObject



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

def dataset_key = data['datasetKey']

#errorObject



1090
1091
1092
# File 'lib/carddb/collection.rb', line 1090

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

#extractedObject



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

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

#failed?Boolean

Returns:

  • (Boolean)


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

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

#file_idObject



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

def file_id = data['fileId']

#game_keyObject



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

def game_key = data['gameKey']

#job_idObject



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

def job_id = data['jobId']

#metricsObject



1082
1083
1084
# File 'lib/carddb/collection.rb', line 1082

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

#publisher_slugObject



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

def publisher_slug = data['publisherSlug']

#started_atObject



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

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

#statusObject



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

def status = data['status']

#template_idObject



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

def template_id = data['templateId']

#template_version_idObject



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

def template_version_id = data['templateVersionId']

#updated_atObject



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

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

#webhookObject



1086
1087
1088
# File 'lib/carddb/collection.rb', line 1086

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