Class: Jbr::Job
Constant Summary collapse
- FIND =
<<~GRAPHQL.freeze query($id: EncodedId!) { job(id: $id) { id quote { id } startAt completedAt } } GRAPHQL
Instance Attribute Summary collapse
-
#quote_id ⇒ Object
readonly
Returns the value of attribute quote_id.
Attributes inherited from Resource
Instance Method Summary collapse
-
#completed_at ⇒ Time
The job completed time.
- #find(id) ⇒ Object
-
#scheduled_at ⇒ Time
The job scheduled time.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Jbr::Resource
Instance Attribute Details
#quote_id ⇒ Object (readonly)
Returns the value of attribute quote_id.
9 10 11 |
# File 'lib/jbr/job.rb', line 9 def quote_id @quote_id end |
Instance Method Details
#completed_at ⇒ Time
Returns the job completed time.
28 29 30 |
# File 'lib/jbr/job.rb', line 28 def completed_at Time.iso8601(@completed_at) if @completed_at end |
#find(id) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jbr/job.rb', line 11 def find(id) output = @oauth.query FIND, variables: { id: id } return unless job = output['job'] @id = job['id'] @quote_id = job.dig 'quote', 'id' @scheduled_at = job['startAt'] @completed_at = job['completedAt'] self end |
#scheduled_at ⇒ Time
Returns the job scheduled time.
23 24 25 |
# File 'lib/jbr/job.rb', line 23 def scheduled_at Time.iso8601(@scheduled_at) if @scheduled_at end |