class SquareEvent::Event
Attributes
data[R]
environment[R]
event_id[R]
initial_delivery_timestamp[R]
merchant_id[R]
payload[R]
type[R]
Public Class Methods
construct_from(payload, environment, timestamp)
click to toggle source
# File lib/square_event/event.rb, line 16 def self.construct_from(payload, environment, timestamp) type = payload[:type] merchant_id = payload[:merchant_id] event_id = payload[:event_id] data = payload[:data] new(type, merchant_id, event_id, data, payload, environment, timestamp) end
new(type, merchant_id, event_id, data, payload, environment, timestamp)
click to toggle source
# File lib/square_event/event.rb, line 25 def initialize(type, merchant_id, event_id, data, payload, environment, timestamp) @type = type @merchant_id = merchant_id @event_id = event_id @data = data @environment = environment @initial_delivery_timestamp = timestamp @internal_hash = {} end
Public Instance Methods
[](key)
click to toggle source
# File lib/square_event/event.rb, line 35 def [](key) @internal_hash[key] end
[]=(key, value)
click to toggle source
# File lib/square_event/event.rb, line 39 def []=(key, value) @internal_hash[key] = value end
livemode()
click to toggle source
# File lib/square_event/event.rb, line 43 def livemode environment != 'Sandbox' end
Also aliased as: livemode?
sandbox()
click to toggle source
# File lib/square_event/event.rb, line 48 def sandbox environment == 'Sandbox' end
Also aliased as: sandbox?
to_h()
click to toggle source
# File lib/square_event/event.rb, line 5 def to_h { type: type, merchant_id: merchant_id, event_id: event_id, data: data, environment: environment, initial_delivery_timestamp: initial_delivery_timestamp } end