Class: Retab::UsagePrimitiveRecord
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::UsagePrimitiveRecord
- Defined in:
- lib/retab/usage/usage_primitive_record.rb
Constant Summary collapse
- HASH_ATTRS =
{ block_id: :block_id, completed_at: :completed_at, created_at: :created_at, credits: :credits, documents: :documents, duration_ms: :duration_ms, environment_id: :environment_id, metadata: :metadata, model: :model, operation: :operation, page_count: :page_count, primitive_execution_id: :primitive_execution_id, project_id: :project_id, resource_kind: :resource_kind, run_id: :run_id, status: :status, triggered_by: :triggered_by, workflow_id: :workflow_id }.freeze
Instance Attribute Summary collapse
-
#block_id ⇒ Object
Returns the value of attribute block_id.
-
#completed_at ⇒ Object
Returns the value of attribute completed_at.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#credits ⇒ Object
Returns the value of attribute credits.
-
#documents ⇒ Object
Returns the value of attribute documents.
-
#duration_ms ⇒ Object
Returns the value of attribute duration_ms.
-
#environment_id ⇒ Object
Returns the value of attribute environment_id.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#model ⇒ Object
Returns the value of attribute model.
-
#operation ⇒ Object
Returns the value of attribute operation.
-
#page_count ⇒ Object
Returns the value of attribute page_count.
-
#primitive_execution_id ⇒ Object
Returns the value of attribute primitive_execution_id.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#resource_kind ⇒ Object
Returns the value of attribute resource_kind.
-
#run_id ⇒ Object
Returns the value of attribute run_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#triggered_by ⇒ Object
Returns the value of attribute triggered_by.
-
#workflow_id ⇒ Object
Returns the value of attribute workflow_id.
Instance Method Summary collapse
-
#initialize(json) ⇒ UsagePrimitiveRecord
constructor
A new instance of UsagePrimitiveRecord.
Constructor Details
#initialize(json) ⇒ UsagePrimitiveRecord
Returns a new instance of UsagePrimitiveRecord.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 50 def initialize(json) super() hash = self.class.normalize(json) @block_id = hash[:block_id] @completed_at = hash[:completed_at] @created_at = hash[:created_at] @credits = hash[:credits] @documents = (hash[:documents] || []).map { |item| item ? Retab::UsagePrimitiveDocument.new(item) : nil } @duration_ms = hash[:duration_ms] @environment_id = hash[:environment_id] @metadata = hash[:metadata] || {} @model = hash[:model] @operation = hash[:operation] @page_count = hash[:page_count] @primitive_execution_id = hash[:primitive_execution_id] @project_id = hash[:project_id] @resource_kind = hash[:resource_kind] @run_id = hash[:run_id] @status = hash[:status] @triggered_by = hash[:triggered_by] ? Retab::UsagePrimitiveTriggeredBy.new(hash[:triggered_by]) : nil @workflow_id = hash[:workflow_id] end |
Instance Attribute Details
#block_id ⇒ Object
Returns the value of attribute block_id.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def block_id @block_id end |
#completed_at ⇒ Object
Returns the value of attribute completed_at.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def completed_at @completed_at end |
#created_at ⇒ Object
Returns the value of attribute created_at.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def created_at @created_at end |
#credits ⇒ Object
Returns the value of attribute credits.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def credits @credits end |
#documents ⇒ Object
Returns the value of attribute documents.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def documents @documents end |
#duration_ms ⇒ Object
Returns the value of attribute duration_ms.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def duration_ms @duration_ms end |
#environment_id ⇒ Object
Returns the value of attribute environment_id.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def environment_id @environment_id end |
#metadata ⇒ Object
Returns the value of attribute metadata.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def @metadata end |
#model ⇒ Object
Returns the value of attribute model.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def model @model end |
#operation ⇒ Object
Returns the value of attribute operation.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def operation @operation end |
#page_count ⇒ Object
Returns the value of attribute page_count.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def page_count @page_count end |
#primitive_execution_id ⇒ Object
Returns the value of attribute primitive_execution_id.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def primitive_execution_id @primitive_execution_id end |
#project_id ⇒ Object
Returns the value of attribute project_id.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def project_id @project_id end |
#resource_kind ⇒ Object
Returns the value of attribute resource_kind.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def resource_kind @resource_kind end |
#run_id ⇒ Object
Returns the value of attribute run_id.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def run_id @run_id end |
#status ⇒ Object
Returns the value of attribute status.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def status @status end |
#triggered_by ⇒ Object
Returns the value of attribute triggered_by.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def triggered_by @triggered_by end |
#workflow_id ⇒ Object
Returns the value of attribute workflow_id.
29 30 31 |
# File 'lib/retab/usage/usage_primitive_record.rb', line 29 def workflow_id @workflow_id end |