Class: Assistant::TechnicalSupport::CaseEventStream::EventBuilder::CommerceSerializer
- Inherits:
-
Base
- Object
- Base
- Assistant::TechnicalSupport::CaseEventStream::EventBuilder::CommerceSerializer
- Defined in:
- app/services/assistant/technical_support/case_event_stream/event_builder/commerce_serializer.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #call(record) ⇒ Object
-
#initialize(source_type:, **attributes) ⇒ CommerceSerializer
constructor
A new instance of CommerceSerializer.
Constructor Details
#initialize(source_type:, **attributes) ⇒ CommerceSerializer
Returns a new instance of CommerceSerializer.
11 12 13 14 |
# File 'app/services/assistant/technical_support/case_event_stream/event_builder/commerce_serializer.rb', line 11 def initialize(source_type:, **attributes) @source_type = source_type super(**attributes) end |
Instance Method Details
#call(record) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/assistant/technical_support/case_event_stream/event_builder/commerce_serializer.rb', line 16 def call(record) record_source(source_type) raw_event = event( record, key_prefix: "#{source_type.underscore.dasherize}-#{record.id}", source_type:, occurred_at: value_for(record, :created_at) || value_for(support_case, :created_at), kind: 'product_context', actor_role: 'system', status: value_for(record, :state), text: commerce_text(record) ) include_source(source_type) raw_event end |