Class: Stripe::V2::Core::EventNotification
- Inherits:
-
Object
- Object
- Stripe::V2::Core::EventNotification
- Defined in:
- lib/stripe/resources/v2/core/event_notification.rb
Direct Known Subclasses
Events::UnknownEventNotification, Events::V1BillingMeterErrorReportTriggeredEventNotification, Events::V1BillingMeterNoMeterFoundEventNotification, Events::V2CoreEventDestinationPingEventNotification
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#livemode ⇒ Object
readonly
Returns the value of attribute livemode.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#fetch_event ⇒ Object
Retrieves the Event that generated this EventNotification.
-
#initialize(event_payload, client) ⇒ EventNotification
constructor
A new instance of EventNotification.
Constructor Details
#initialize(event_payload, client) ⇒ EventNotification
Returns a new instance of EventNotification.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 37 def initialize(event_payload, client) @id = event_payload[:id] @type = event_payload[:type] @created = event_payload[:created] @livemode = event_payload[:livemode] @reason = EventReason.new(event_payload[:reason]) if event_payload[:reason] if event_payload[:context] && !event_payload[:context].empty? @context = StripeContext.parse(event_payload[:context]) end # private unless a child declares an attr_reader @related_object = RelatedObject.new(event_payload[:related_object]) if event_payload[:related_object] # internal use @client = client end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
35 36 37 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35 def context @context end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
35 36 37 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35 def created @created end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
35 36 37 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35 def id @id end |
#livemode ⇒ Object (readonly)
Returns the value of attribute livemode.
35 36 37 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35 def livemode @livemode end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
35 36 37 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35 def reason @reason end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
35 36 37 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35 def type @type end |
Instance Method Details
#fetch_event ⇒ Object
Retrieves the Event that generated this EventNotification.
54 55 56 57 58 |
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 54 def fetch_event resp = @client.raw_request(:get, "/v2/core/events/#{id}", opts: { stripe_context: context }, usage: ["fetch_event"]) @client.deserialize(resp.http_body, api_mode: :v2) end |