Class: Pobo::DTO::WebhookPayload
- Inherits:
-
Object
- Object
- Pobo::DTO::WebhookPayload
- Defined in:
- lib/pobo/dto/webhook_payload.rb
Instance Attribute Summary collapse
-
#eshop_id ⇒ Object
readonly
Returns the value of attribute eshop_id.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(event:, timestamp:, eshop_id:) ⇒ WebhookPayload
constructor
A new instance of WebhookPayload.
Constructor Details
#initialize(event:, timestamp:, eshop_id:) ⇒ WebhookPayload
Returns a new instance of WebhookPayload.
8 9 10 11 12 |
# File 'lib/pobo/dto/webhook_payload.rb', line 8 def initialize(event:, timestamp:, eshop_id:) @event = event = @eshop_id = eshop_id end |
Instance Attribute Details
#eshop_id ⇒ Object (readonly)
Returns the value of attribute eshop_id.
6 7 8 |
# File 'lib/pobo/dto/webhook_payload.rb', line 6 def eshop_id @eshop_id end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
6 7 8 |
# File 'lib/pobo/dto/webhook_payload.rb', line 6 def event @event end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/pobo/dto/webhook_payload.rb', line 6 def end |
Class Method Details
.from_hash(hash) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pobo/dto/webhook_payload.rb', line 14 def self.from_hash(hash) = hash["timestamp"] || hash[:timestamp] = Time.at() if .is_a?(Integer) = Time.parse() if .is_a?(String) new( event: hash["event"] || hash[:event], timestamp: , eshop_id: hash["eshop_id"] || hash[:eshop_id] ) end |