|
2 | 2 | # frozen_string_literal: true |
3 | 3 |
|
4 | 4 | module Stripe |
5 | | - # Occurs when a Meter has invalid async usage events. |
6 | | - class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Event |
7 | | - def self.lookup_type |
8 | | - "v1.billing.meter.error_report_triggered" |
| 5 | + module Events |
| 6 | + # Occurs when a Meter has invalid async usage events. |
| 7 | + class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Event |
| 8 | + def self.lookup_type |
| 9 | + "v1.billing.meter.error_report_triggered" |
| 10 | + end |
| 11 | + |
| 12 | + class V1BillingMeterErrorReportTriggeredEventData < Stripe::StripeObject |
| 13 | + class Reason < Stripe::StripeObject |
| 14 | + class ErrorType < Stripe::StripeObject |
| 15 | + class SampleError < Stripe::StripeObject |
| 16 | + class Request < Stripe::StripeObject |
| 17 | + # The request idempotency key. |
| 18 | + attr_reader :identifier |
| 19 | + |
| 20 | + def self.inner_class_types |
| 21 | + @inner_class_types = {} |
| 22 | + end |
| 23 | + |
| 24 | + def self.field_remappings |
| 25 | + @field_remappings = {} |
| 26 | + end |
| 27 | + end |
| 28 | + # The error message. |
| 29 | + attr_reader :error_message |
| 30 | + # The request causes the error. |
| 31 | + attr_reader :request |
| 32 | + |
| 33 | + def self.inner_class_types |
| 34 | + @inner_class_types = { request: Request } |
| 35 | + end |
| 36 | + |
| 37 | + def self.field_remappings |
| 38 | + @field_remappings = {} |
| 39 | + end |
| 40 | + end |
| 41 | + # Open Enum. |
| 42 | + attr_reader :code |
| 43 | + # The number of errors of this type. |
| 44 | + attr_reader :error_count |
| 45 | + # A list of sample errors of this type. |
| 46 | + attr_reader :sample_errors |
| 47 | + |
| 48 | + def self.inner_class_types |
| 49 | + @inner_class_types = { sample_errors: SampleError } |
| 50 | + end |
| 51 | + |
| 52 | + def self.field_remappings |
| 53 | + @field_remappings = {} |
| 54 | + end |
| 55 | + end |
| 56 | + # The total error count within this window. |
| 57 | + attr_reader :error_count |
| 58 | + # The error details. |
| 59 | + attr_reader :error_types |
| 60 | + |
| 61 | + def self.inner_class_types |
| 62 | + @inner_class_types = { error_types: ErrorType } |
| 63 | + end |
| 64 | + |
| 65 | + def self.field_remappings |
| 66 | + @field_remappings = {} |
| 67 | + end |
| 68 | + end |
| 69 | + # This contains information about why meter error happens. |
| 70 | + attr_reader :reason |
| 71 | + # Extra field included in the event's `data` when fetched from /v2/events. |
| 72 | + attr_reader :developer_message_summary |
| 73 | + # The start of the window that is encapsulated by this summary. |
| 74 | + attr_reader :validation_start |
| 75 | + # The end of the window that is encapsulated by this summary. |
| 76 | + attr_reader :validation_end |
| 77 | + |
| 78 | + def self.inner_class_types |
| 79 | + @inner_class_types = { reason: Reason } |
| 80 | + end |
| 81 | + |
| 82 | + def self.field_remappings |
| 83 | + @field_remappings = {} |
| 84 | + end |
| 85 | + end |
| 86 | + |
| 87 | + def self.inner_class_types |
| 88 | + @inner_class_types = { data: V1BillingMeterErrorReportTriggeredEventData } |
| 89 | + end |
| 90 | + attr_reader :data, :related_object |
| 91 | + |
| 92 | + # Retrieves the related object from the API. Makes an API request on every call. |
| 93 | + def fetch_related_object |
| 94 | + _request( |
| 95 | + method: :get, |
| 96 | + path: related_object.url, |
| 97 | + base_address: :api, |
| 98 | + opts: { stripe_context: context } |
| 99 | + ) |
| 100 | + end |
9 | 101 | end |
10 | | - # There is additional data present for this event, accessible with the `data` property. |
11 | | - # See the Stripe API docs for more information. |
12 | | - |
13 | | - # Retrieves the related object from the API. Make an API request on every call. |
14 | | - def fetch_related_object |
15 | | - _request( |
16 | | - method: :get, |
17 | | - path: related_object.url, |
18 | | - base_address: :api, |
19 | | - opts: { stripe_account: context } |
20 | | - ) |
| 102 | + |
| 103 | + # Occurs when a Meter has invalid async usage events. |
| 104 | + class V1BillingMeterErrorReportTriggeredEventNotification < Stripe::V2::EventNotification |
| 105 | + def self.lookup_type |
| 106 | + "v1.billing.meter.error_report_triggered" |
| 107 | + end |
| 108 | + |
| 109 | + attr_reader :related_object |
| 110 | + |
| 111 | + # Retrieves the Meter related to this EventNotification from the Stripe API. Makes an API request on every call. |
| 112 | + def fetch_related_object |
| 113 | + resp = @client.raw_request( |
| 114 | + :get, |
| 115 | + related_object.url, |
| 116 | + opts: { stripe_context: context }, |
| 117 | + usage: ["fetch_related_object"] |
| 118 | + ) |
| 119 | + @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url)) |
| 120 | + end |
21 | 121 | end |
22 | 122 | end |
23 | 123 | end |
0 commit comments