Class: SquareEvent::Event
- Inherits:
-
Object
- Object
- SquareEvent::Event
- Defined in:
- lib/square_event/event.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#initial_delivery_timestamp ⇒ Object
readonly
Returns the value of attribute initial_delivery_timestamp.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, merchant_id, event_id, data, payload, environment, timestamp) ⇒ Event
constructor
A new instance of Event.
- #livemode ⇒ Object (also: #livemode?)
- #sandbox ⇒ Object (also: #sandbox?)
Constructor Details
#initialize(type, merchant_id, event_id, data, payload, environment, timestamp) ⇒ Event
Returns a new instance of Event.
14 15 16 17 18 19 20 21 |
# File 'lib/square_event/event.rb', line 14 def initialize(type, merchant_id, event_id, data, payload, environment, ) @type = type @merchant_id = merchant_id @event_id = event_id @data = data @environment = environment = end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def data @data end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def environment @environment end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def event_id @event_id end |
#initial_delivery_timestamp ⇒ Object (readonly)
Returns the value of attribute initial_delivery_timestamp.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def merchant_id @merchant_id end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def payload @payload end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/square_event/event.rb', line 3 def type @type end |
Class Method Details
.construct_from(payload, environment, timestamp) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/square_event/event.rb', line 5 def self.construct_from(payload, environment, ) 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, ) end |
Instance Method Details
#livemode ⇒ Object Also known as: livemode?
23 24 25 |
# File 'lib/square_event/event.rb', line 23 def livemode environment != 'Sandbox' end |
#sandbox ⇒ Object Also known as: sandbox?
28 29 30 |
# File 'lib/square_event/event.rb', line 28 def sandbox environment == 'Sandbox' end |