Class: Vapi::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/subscription.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, type:, status:, credits:, concurrency_counter:, concurrency_limit_included:, concurrency_limit_purchased:, phone_numbers_counter: OMIT, phone_numbers_included: OMIT, monthly_charge_schedule_id: OMIT, monthly_credit_check_schedule_id: OMIT, stripe_customer_id: OMIT, stripe_payment_method_id: OMIT, slack_support_enabled: OMIT, slack_channel_id: OMIT, hipaa_enabled: OMIT, hipaa_common_paper_agreement_id: OMIT, stripe_payment_method_fingerprint: OMIT, stripe_customer_email: OMIT, referred_by_email: OMIT, auto_reload_plan: OMIT, minutes_included: OMIT, minutes_used: OMIT, minutes_used_next_reset_at: OMIT, minutes_overage_cost: OMIT, providers_included: OMIT, outbound_calls_daily_limit: OMIT, outbound_calls_counter: OMIT, outbound_calls_counter_next_reset_at: OMIT, coupon_ids: OMIT, coupon_usage_left: OMIT, invoice_plan: OMIT, pci_enabled: OMIT, pci_common_paper_agreement_id: OMIT, additional_properties: nil) ⇒ Vapi::Subscription

Parameters:

  • id (String)

    This is the unique identifier for the subscription.

  • created_at (DateTime)

    This is the timestamp when the subscription was created.

  • updated_at (DateTime)

    This is the timestamp when the subscription was last updated.

  • type (Vapi::SubscriptionType)

    This is the type / tier of the subscription.

  • status (Vapi::SubscriptionStatus)

    This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.

  • credits (String)

    This is the number of credits the subscription currently has. Note: This is a string to avoid floating point precision issues.

  • concurrency_counter (Float)

    This is the total number of active calls (concurrency) across all orgs under this subscription.

  • concurrency_limit_included (Float)

    This is the default concurrency limit for the subscription.

  • phone_numbers_counter (Float) (defaults to: OMIT)

    This is the number of free phone numbers the subscription has

  • phone_numbers_included (Float) (defaults to: OMIT)

    This is the maximum number of free phone numbers the subscription can have

  • concurrency_limit_purchased (Float)

    This is the purchased add-on concurrency limit for the subscription.

  • monthly_charge_schedule_id (Float) (defaults to: OMIT)

    This is the ID of the monthly job that charges for subscription add ons and phone numbers.

  • monthly_credit_check_schedule_id (Float) (defaults to: OMIT)

    This is the ID of the monthly job that checks whether the credit balance of the subscription is sufficient for the monthly charge.

  • stripe_customer_id (String) (defaults to: OMIT)

    This is the Stripe customer ID.

  • stripe_payment_method_id (String) (defaults to: OMIT)

    This is the Stripe payment ID.

  • slack_support_enabled (Boolean) (defaults to: OMIT)

    If this flag is true, then the user has purchased slack support.

  • slack_channel_id (String) (defaults to: OMIT)

    If this subscription has a slack support subscription, the slack channel’s ID will be stored here.

  • hipaa_enabled (Boolean) (defaults to: OMIT)

    This is the HIPAA enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable HIPAA compliance.

  • hipaa_common_paper_agreement_id (String) (defaults to: OMIT)

    This is the ID for the Common Paper agreement outlining the HIPAA contract.

  • stripe_payment_method_fingerprint (String) (defaults to: OMIT)

    This is the Stripe fingerprint of the payment method (card). It allows us to detect users who try to abuse our system through multiple sign-ups.

  • stripe_customer_email (String) (defaults to: OMIT)

    This is the customer’s email on Stripe.

  • referred_by_email (String) (defaults to: OMIT)

    This is the email of the referrer for the subscription.

  • auto_reload_plan (Vapi::AutoReloadPlan) (defaults to: OMIT)

    This is the auto reload plan configured for the subscription.

  • minutes_included (Float) (defaults to: OMIT)

    The number of minutes included in the subscription.

  • minutes_used (Float) (defaults to: OMIT)

    The number of minutes used in the subscription.

  • minutes_used_next_reset_at (DateTime) (defaults to: OMIT)

    This is the timestamp at which the number of monthly free minutes is scheduled to reset at.

  • minutes_overage_cost (Float) (defaults to: OMIT)

    The per minute charge on minutes that exceed the included minutes. Enterprise only.

  • providers_included (Array<String>) (defaults to: OMIT)

    The list of providers included in the subscription. Enterprise only.

  • outbound_calls_daily_limit (Float) (defaults to: OMIT)

    The maximum number of outbound calls this subscription may make in a day. Resets every night.

  • outbound_calls_counter (Float) (defaults to: OMIT)

    The current number of outbound calls the subscription has made in the current day.

  • outbound_calls_counter_next_reset_at (DateTime) (defaults to: OMIT)

    This is the timestamp at which the outbound calls counter is scheduled to reset at.

  • coupon_ids (Array<String>) (defaults to: OMIT)

    This is the IDs of the coupons applicable to this subscription.

  • coupon_usage_left (String) (defaults to: OMIT)

    This is the number of credits left obtained from a coupon.

  • invoice_plan (Vapi::InvoicePlan) (defaults to: OMIT)

    This is the invoice plan for the subscription.

  • pci_enabled (Boolean) (defaults to: OMIT)

    This is the PCI enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable PCI compliance.

  • pci_common_paper_agreement_id (String) (defaults to: OMIT)

    This is the ID for the Common Paper agreement outlining the PCI contract.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/vapi_server_sdk/types/subscription.rb', line 165

def initialize(id:, created_at:, updated_at:, type:, status:, credits:, concurrency_counter:,
               concurrency_limit_included:, concurrency_limit_purchased:, phone_numbers_counter: OMIT, phone_numbers_included: OMIT, monthly_charge_schedule_id: OMIT, monthly_credit_check_schedule_id: OMIT, stripe_customer_id: OMIT, stripe_payment_method_id: OMIT, slack_support_enabled: OMIT, slack_channel_id: OMIT, hipaa_enabled: OMIT, hipaa_common_paper_agreement_id: OMIT, stripe_payment_method_fingerprint: OMIT, stripe_customer_email: OMIT, referred_by_email: OMIT, auto_reload_plan: OMIT, minutes_included: OMIT, minutes_used: OMIT, minutes_used_next_reset_at: OMIT, minutes_overage_cost: OMIT, providers_included: OMIT, outbound_calls_daily_limit: OMIT, outbound_calls_counter: OMIT, outbound_calls_counter_next_reset_at: OMIT, coupon_ids: OMIT, coupon_usage_left: OMIT, invoice_plan: OMIT, pci_enabled: OMIT, pci_common_paper_agreement_id: OMIT, additional_properties: nil)
  @id = id
  @created_at = created_at
  @updated_at = updated_at
  @type = type
  @status = status
  @credits = credits
  @concurrency_counter = concurrency_counter
  @concurrency_limit_included = concurrency_limit_included
  @phone_numbers_counter = phone_numbers_counter if phone_numbers_counter != OMIT
  @phone_numbers_included = phone_numbers_included if phone_numbers_included != OMIT
  @concurrency_limit_purchased = concurrency_limit_purchased
  @monthly_charge_schedule_id = monthly_charge_schedule_id if monthly_charge_schedule_id != OMIT
  @monthly_credit_check_schedule_id = monthly_credit_check_schedule_id if monthly_credit_check_schedule_id != OMIT
  @stripe_customer_id = stripe_customer_id if stripe_customer_id != OMIT
  @stripe_payment_method_id = stripe_payment_method_id if stripe_payment_method_id != OMIT
  @slack_support_enabled = slack_support_enabled if slack_support_enabled != OMIT
  @slack_channel_id = slack_channel_id if slack_channel_id != OMIT
  @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT
  @hipaa_common_paper_agreement_id = hipaa_common_paper_agreement_id if hipaa_common_paper_agreement_id != OMIT
  if stripe_payment_method_fingerprint != OMIT
    @stripe_payment_method_fingerprint = stripe_payment_method_fingerprint
  end
  @stripe_customer_email = stripe_customer_email if stripe_customer_email != OMIT
  @referred_by_email = referred_by_email if referred_by_email != OMIT
  @auto_reload_plan = auto_reload_plan if auto_reload_plan != OMIT
  @minutes_included = minutes_included if minutes_included != OMIT
  @minutes_used = minutes_used if minutes_used != OMIT
  @minutes_used_next_reset_at = minutes_used_next_reset_at if minutes_used_next_reset_at != OMIT
  @minutes_overage_cost = minutes_overage_cost if minutes_overage_cost != OMIT
  @providers_included = providers_included if providers_included != OMIT
  @outbound_calls_daily_limit = outbound_calls_daily_limit if outbound_calls_daily_limit != OMIT
  @outbound_calls_counter = outbound_calls_counter if outbound_calls_counter != OMIT
  if outbound_calls_counter_next_reset_at != OMIT
    @outbound_calls_counter_next_reset_at = outbound_calls_counter_next_reset_at
  end
  @coupon_ids = coupon_ids if coupon_ids != OMIT
  @coupon_usage_left = coupon_usage_left if coupon_usage_left != OMIT
  @invoice_plan = invoice_plan if invoice_plan != OMIT
  @pci_enabled = pci_enabled if pci_enabled != OMIT
  @pci_common_paper_agreement_id = pci_common_paper_agreement_id if pci_common_paper_agreement_id != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "createdAt": created_at,
    "updatedAt": updated_at,
    "type": type,
    "status": status,
    "credits": credits,
    "concurrencyCounter": concurrency_counter,
    "concurrencyLimitIncluded": concurrency_limit_included,
    "phoneNumbersCounter": phone_numbers_counter,
    "phoneNumbersIncluded": phone_numbers_included,
    "concurrencyLimitPurchased": concurrency_limit_purchased,
    "monthlyChargeScheduleId": monthly_charge_schedule_id,
    "monthlyCreditCheckScheduleId": monthly_credit_check_schedule_id,
    "stripeCustomerId": stripe_customer_id,
    "stripePaymentMethodId": stripe_payment_method_id,
    "slackSupportEnabled": slack_support_enabled,
    "slackChannelId": slack_channel_id,
    "hipaaEnabled": hipaa_enabled,
    "hipaaCommonPaperAgreementId": hipaa_common_paper_agreement_id,
    "stripePaymentMethodFingerprint": stripe_payment_method_fingerprint,
    "stripeCustomerEmail": stripe_customer_email,
    "referredByEmail": referred_by_email,
    "autoReloadPlan": auto_reload_plan,
    "minutesIncluded": minutes_included,
    "minutesUsed": minutes_used,
    "minutesUsedNextResetAt": minutes_used_next_reset_at,
    "minutesOverageCost": minutes_overage_cost,
    "providersIncluded": providers_included,
    "outboundCallsDailyLimit": outbound_calls_daily_limit,
    "outboundCallsCounter": outbound_calls_counter,
    "outboundCallsCounterNextResetAt": outbound_calls_counter_next_reset_at,
    "couponIds": coupon_ids,
    "couponUsageLeft": coupon_usage_left,
    "invoicePlan": invoice_plan,
    "pciEnabled": pci_enabled,
    "pciCommonPaperAgreementId": pci_common_paper_agreement_id
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



103
104
105
# File 'lib/vapi_server_sdk/types/subscription.rb', line 103

def additional_properties
  @additional_properties
end

#auto_reload_planVapi::AutoReloadPlan (readonly)

Returns This is the auto reload plan configured for the subscription.

Returns:



68
69
70
# File 'lib/vapi_server_sdk/types/subscription.rb', line 68

def auto_reload_plan
  @auto_reload_plan
end

#concurrency_counterFloat (readonly)

Returns This is the total number of active calls (concurrency) across all orgs under this subscription.

Returns:

  • (Float)

    This is the total number of active calls (concurrency) across all orgs under this subscription.



29
30
31
# File 'lib/vapi_server_sdk/types/subscription.rb', line 29

def concurrency_counter
  @concurrency_counter
end

#concurrency_limit_includedFloat (readonly)

Returns This is the default concurrency limit for the subscription.

Returns:

  • (Float)

    This is the default concurrency limit for the subscription.



31
32
33
# File 'lib/vapi_server_sdk/types/subscription.rb', line 31

def concurrency_limit_included
  @concurrency_limit_included
end

#concurrency_limit_purchasedFloat (readonly)

Returns This is the purchased add-on concurrency limit for the subscription.

Returns:

  • (Float)

    This is the purchased add-on concurrency limit for the subscription.



37
38
39
# File 'lib/vapi_server_sdk/types/subscription.rb', line 37

def concurrency_limit_purchased
  @concurrency_limit_purchased
end

#coupon_idsArray<String> (readonly)

Returns This is the IDs of the coupons applicable to this subscription.

Returns:

  • (Array<String>)

    This is the IDs of the coupons applicable to this subscription.



91
92
93
# File 'lib/vapi_server_sdk/types/subscription.rb', line 91

def coupon_ids
  @coupon_ids
end

#coupon_usage_leftString (readonly)

Returns This is the number of credits left obtained from a coupon.

Returns:

  • (String)

    This is the number of credits left obtained from a coupon.



93
94
95
# File 'lib/vapi_server_sdk/types/subscription.rb', line 93

def coupon_usage_left
  @coupon_usage_left
end

#created_atDateTime (readonly)

Returns This is the timestamp when the subscription was created.

Returns:

  • (DateTime)

    This is the timestamp when the subscription was created.



16
17
18
# File 'lib/vapi_server_sdk/types/subscription.rb', line 16

def created_at
  @created_at
end

#creditsString (readonly)

Returns This is the number of credits the subscription currently has. Note: This is a string to avoid floating point precision issues.

Returns:

  • (String)

    This is the number of credits the subscription currently has. Note: This is a string to avoid floating point precision issues.



26
27
28
# File 'lib/vapi_server_sdk/types/subscription.rb', line 26

def credits
  @credits
end

#hipaa_common_paper_agreement_idString (readonly)

Returns This is the ID for the Common Paper agreement outlining the HIPAA contract.

Returns:

  • (String)

    This is the ID for the Common Paper agreement outlining the HIPAA contract.



59
60
61
# File 'lib/vapi_server_sdk/types/subscription.rb', line 59

def hipaa_common_paper_agreement_id
  @hipaa_common_paper_agreement_id
end

#hipaa_enabledBoolean (readonly)

Returns This is the HIPAA enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable HIPAA compliance.

Returns:

  • (Boolean)

    This is the HIPAA enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable HIPAA compliance.



57
58
59
# File 'lib/vapi_server_sdk/types/subscription.rb', line 57

def hipaa_enabled
  @hipaa_enabled
end

#idString (readonly)

Returns This is the unique identifier for the subscription.

Returns:

  • (String)

    This is the unique identifier for the subscription.



14
15
16
# File 'lib/vapi_server_sdk/types/subscription.rb', line 14

def id
  @id
end

#invoice_planVapi::InvoicePlan (readonly)

Returns This is the invoice plan for the subscription.

Returns:



95
96
97
# File 'lib/vapi_server_sdk/types/subscription.rb', line 95

def invoice_plan
  @invoice_plan
end

#minutes_includedFloat (readonly)

Returns The number of minutes included in the subscription.

Returns:

  • (Float)

    The number of minutes included in the subscription.



70
71
72
# File 'lib/vapi_server_sdk/types/subscription.rb', line 70

def minutes_included
  @minutes_included
end

#minutes_overage_costFloat (readonly)

Returns The per minute charge on minutes that exceed the included minutes. Enterprise only.

Returns:

  • (Float)

    The per minute charge on minutes that exceed the included minutes. Enterprise only.



78
79
80
# File 'lib/vapi_server_sdk/types/subscription.rb', line 78

def minutes_overage_cost
  @minutes_overage_cost
end

#minutes_usedFloat (readonly)

Returns The number of minutes used in the subscription.

Returns:

  • (Float)

    The number of minutes used in the subscription.



72
73
74
# File 'lib/vapi_server_sdk/types/subscription.rb', line 72

def minutes_used
  @minutes_used
end

#minutes_used_next_reset_atDateTime (readonly)

Returns This is the timestamp at which the number of monthly free minutes is scheduled to reset at.

Returns:

  • (DateTime)

    This is the timestamp at which the number of monthly free minutes is scheduled to reset at.



75
76
77
# File 'lib/vapi_server_sdk/types/subscription.rb', line 75

def minutes_used_next_reset_at
  @minutes_used_next_reset_at
end

#monthly_charge_schedule_idFloat (readonly)

Returns This is the ID of the monthly job that charges for subscription add ons and phone numbers.

Returns:

  • (Float)

    This is the ID of the monthly job that charges for subscription add ons and phone numbers.



40
41
42
# File 'lib/vapi_server_sdk/types/subscription.rb', line 40

def monthly_charge_schedule_id
  @monthly_charge_schedule_id
end

#monthly_credit_check_schedule_idFloat (readonly)

Returns This is the ID of the monthly job that checks whether the credit balance of the subscription is sufficient for the monthly charge.

Returns:

  • (Float)

    This is the ID of the monthly job that checks whether the credit balance of the subscription is sufficient for the monthly charge.



44
45
46
# File 'lib/vapi_server_sdk/types/subscription.rb', line 44

def monthly_credit_check_schedule_id
  @monthly_credit_check_schedule_id
end

#outbound_calls_counterFloat (readonly)

Returns The current number of outbound calls the subscription has made in the current day.

Returns:

  • (Float)

    The current number of outbound calls the subscription has made in the current day.



86
87
88
# File 'lib/vapi_server_sdk/types/subscription.rb', line 86

def outbound_calls_counter
  @outbound_calls_counter
end

#outbound_calls_counter_next_reset_atDateTime (readonly)

Returns This is the timestamp at which the outbound calls counter is scheduled to reset at.

Returns:

  • (DateTime)

    This is the timestamp at which the outbound calls counter is scheduled to reset at.



89
90
91
# File 'lib/vapi_server_sdk/types/subscription.rb', line 89

def outbound_calls_counter_next_reset_at
  @outbound_calls_counter_next_reset_at
end

#outbound_calls_daily_limitFloat (readonly)

Returns The maximum number of outbound calls this subscription may make in a day. Resets every night.

Returns:

  • (Float)

    The maximum number of outbound calls this subscription may make in a day. Resets every night.



83
84
85
# File 'lib/vapi_server_sdk/types/subscription.rb', line 83

def outbound_calls_daily_limit
  @outbound_calls_daily_limit
end

#pci_common_paper_agreement_idString (readonly)

Returns This is the ID for the Common Paper agreement outlining the PCI contract.

Returns:

  • (String)

    This is the ID for the Common Paper agreement outlining the PCI contract.



101
102
103
# File 'lib/vapi_server_sdk/types/subscription.rb', line 101

def pci_common_paper_agreement_id
  @pci_common_paper_agreement_id
end

#pci_enabledBoolean (readonly)

Returns This is the PCI enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable PCI compliance.

Returns:

  • (Boolean)

    This is the PCI enabled flag for the subscription. It determines whether orgs under this subscription have the option to enable PCI compliance.



99
100
101
# File 'lib/vapi_server_sdk/types/subscription.rb', line 99

def pci_enabled
  @pci_enabled
end

#phone_numbers_counterFloat (readonly)

Returns This is the number of free phone numbers the subscription has.

Returns:

  • (Float)

    This is the number of free phone numbers the subscription has



33
34
35
# File 'lib/vapi_server_sdk/types/subscription.rb', line 33

def phone_numbers_counter
  @phone_numbers_counter
end

#phone_numbers_includedFloat (readonly)

Returns This is the maximum number of free phone numbers the subscription can have.

Returns:

  • (Float)

    This is the maximum number of free phone numbers the subscription can have



35
36
37
# File 'lib/vapi_server_sdk/types/subscription.rb', line 35

def phone_numbers_included
  @phone_numbers_included
end

#providers_includedArray<String> (readonly)

Returns The list of providers included in the subscription. Enterprise only.

Returns:

  • (Array<String>)

    The list of providers included in the subscription. Enterprise only.



80
81
82
# File 'lib/vapi_server_sdk/types/subscription.rb', line 80

def providers_included
  @providers_included
end

#referred_by_emailString (readonly)

Returns This is the email of the referrer for the subscription.

Returns:

  • (String)

    This is the email of the referrer for the subscription.



66
67
68
# File 'lib/vapi_server_sdk/types/subscription.rb', line 66

def referred_by_email
  @referred_by_email
end

#slack_channel_idString (readonly)

Returns If this subscription has a slack support subscription, the slack channel’s ID will be stored here.

Returns:

  • (String)

    If this subscription has a slack support subscription, the slack channel’s ID will be stored here.



53
54
55
# File 'lib/vapi_server_sdk/types/subscription.rb', line 53

def slack_channel_id
  @slack_channel_id
end

#slack_support_enabledBoolean (readonly)

Returns If this flag is true, then the user has purchased slack support.

Returns:

  • (Boolean)

    If this flag is true, then the user has purchased slack support.



50
51
52
# File 'lib/vapi_server_sdk/types/subscription.rb', line 50

def slack_support_enabled
  @slack_support_enabled
end

#statusVapi::SubscriptionStatus (readonly)

Returns This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.

Returns:

  • (Vapi::SubscriptionStatus)

    This is the status of the subscription. Past due subscriptions are subscriptions with past due payments.



23
24
25
# File 'lib/vapi_server_sdk/types/subscription.rb', line 23

def status
  @status
end

#stripe_customer_emailString (readonly)

Returns This is the customer’s email on Stripe.

Returns:

  • (String)

    This is the customer’s email on Stripe.



64
65
66
# File 'lib/vapi_server_sdk/types/subscription.rb', line 64

def stripe_customer_email
  @stripe_customer_email
end

#stripe_customer_idString (readonly)

Returns This is the Stripe customer ID.

Returns:

  • (String)

    This is the Stripe customer ID.



46
47
48
# File 'lib/vapi_server_sdk/types/subscription.rb', line 46

def stripe_customer_id
  @stripe_customer_id
end

#stripe_payment_method_fingerprintString (readonly)

Returns This is the Stripe fingerprint of the payment method (card). It allows us to detect users who try to abuse our system through multiple sign-ups.

Returns:

  • (String)

    This is the Stripe fingerprint of the payment method (card). It allows us to detect users who try to abuse our system through multiple sign-ups.



62
63
64
# File 'lib/vapi_server_sdk/types/subscription.rb', line 62

def stripe_payment_method_fingerprint
  @stripe_payment_method_fingerprint
end

#stripe_payment_method_idString (readonly)

Returns This is the Stripe payment ID.

Returns:

  • (String)

    This is the Stripe payment ID.



48
49
50
# File 'lib/vapi_server_sdk/types/subscription.rb', line 48

def stripe_payment_method_id
  @stripe_payment_method_id
end

#typeVapi::SubscriptionType (readonly)

Returns This is the type / tier of the subscription.

Returns:



20
21
22
# File 'lib/vapi_server_sdk/types/subscription.rb', line 20

def type
  @type
end

#updated_atDateTime (readonly)

Returns This is the timestamp when the subscription was last updated.

Returns:

  • (DateTime)

    This is the timestamp when the subscription was last updated.



18
19
20
# File 'lib/vapi_server_sdk/types/subscription.rb', line 18

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Subscription

Deserialize a JSON object to an instance of Subscription

Parameters:

  • json_object (String)

Returns:



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/vapi_server_sdk/types/subscription.rb', line 254

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
  type = parsed_json["type"]
  status = parsed_json["status"]
  credits = parsed_json["credits"]
  concurrency_counter = parsed_json["concurrencyCounter"]
  concurrency_limit_included = parsed_json["concurrencyLimitIncluded"]
  phone_numbers_counter = parsed_json["phoneNumbersCounter"]
  phone_numbers_included = parsed_json["phoneNumbersIncluded"]
  concurrency_limit_purchased = parsed_json["concurrencyLimitPurchased"]
  monthly_charge_schedule_id = parsed_json["monthlyChargeScheduleId"]
  monthly_credit_check_schedule_id = parsed_json["monthlyCreditCheckScheduleId"]
  stripe_customer_id = parsed_json["stripeCustomerId"]
  stripe_payment_method_id = parsed_json["stripePaymentMethodId"]
  slack_support_enabled = parsed_json["slackSupportEnabled"]
  slack_channel_id = parsed_json["slackChannelId"]
  hipaa_enabled = parsed_json["hipaaEnabled"]
  hipaa_common_paper_agreement_id = parsed_json["hipaaCommonPaperAgreementId"]
  stripe_payment_method_fingerprint = parsed_json["stripePaymentMethodFingerprint"]
  stripe_customer_email = parsed_json["stripeCustomerEmail"]
  referred_by_email = parsed_json["referredByEmail"]
  if parsed_json["autoReloadPlan"].nil?
    auto_reload_plan = nil
  else
    auto_reload_plan = parsed_json["autoReloadPlan"].to_json
    auto_reload_plan = Vapi::AutoReloadPlan.from_json(json_object: auto_reload_plan)
  end
  minutes_included = parsed_json["minutesIncluded"]
  minutes_used = parsed_json["minutesUsed"]
  minutes_used_next_reset_at = unless parsed_json["minutesUsedNextResetAt"].nil?
                                 DateTime.parse(parsed_json["minutesUsedNextResetAt"])
                               end
  minutes_overage_cost = parsed_json["minutesOverageCost"]
  providers_included = parsed_json["providersIncluded"]
  outbound_calls_daily_limit = parsed_json["outboundCallsDailyLimit"]
  outbound_calls_counter = parsed_json["outboundCallsCounter"]
  outbound_calls_counter_next_reset_at = unless parsed_json["outboundCallsCounterNextResetAt"].nil?
                                           DateTime.parse(parsed_json["outboundCallsCounterNextResetAt"])
                                         end
  coupon_ids = parsed_json["couponIds"]
  coupon_usage_left = parsed_json["couponUsageLeft"]
  if parsed_json["invoicePlan"].nil?
    invoice_plan = nil
  else
    invoice_plan = parsed_json["invoicePlan"].to_json
    invoice_plan = Vapi::InvoicePlan.from_json(json_object: invoice_plan)
  end
  pci_enabled = parsed_json["pciEnabled"]
  pci_common_paper_agreement_id = parsed_json["pciCommonPaperAgreementId"]
  new(
    id: id,
    created_at: created_at,
    updated_at: updated_at,
    type: type,
    status: status,
    credits: credits,
    concurrency_counter: concurrency_counter,
    concurrency_limit_included: concurrency_limit_included,
    phone_numbers_counter: phone_numbers_counter,
    phone_numbers_included: phone_numbers_included,
    concurrency_limit_purchased: concurrency_limit_purchased,
    monthly_charge_schedule_id: monthly_charge_schedule_id,
    monthly_credit_check_schedule_id: monthly_credit_check_schedule_id,
    stripe_customer_id: stripe_customer_id,
    stripe_payment_method_id: stripe_payment_method_id,
    slack_support_enabled: slack_support_enabled,
    slack_channel_id: slack_channel_id,
    hipaa_enabled: hipaa_enabled,
    hipaa_common_paper_agreement_id: hipaa_common_paper_agreement_id,
    stripe_payment_method_fingerprint: stripe_payment_method_fingerprint,
    stripe_customer_email: stripe_customer_email,
    referred_by_email: referred_by_email,
    auto_reload_plan: auto_reload_plan,
    minutes_included: minutes_included,
    minutes_used: minutes_used,
    minutes_used_next_reset_at: minutes_used_next_reset_at,
    minutes_overage_cost: minutes_overage_cost,
    providers_included: providers_included,
    outbound_calls_daily_limit: outbound_calls_daily_limit,
    outbound_calls_counter: outbound_calls_counter,
    outbound_calls_counter_next_reset_at: outbound_calls_counter_next_reset_at,
    coupon_ids: coupon_ids,
    coupon_usage_left: coupon_usage_left,
    invoice_plan: invoice_plan,
    pci_enabled: pci_enabled,
    pci_common_paper_agreement_id: pci_common_paper_agreement_id,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/vapi_server_sdk/types/subscription.rb', line 361

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.type.is_a?(Vapi::SubscriptionType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.status.is_a?(Vapi::SubscriptionStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.credits.is_a?(String) != false || raise("Passed value for field obj.credits is not the expected type, validation failed.")
  obj.concurrency_counter.is_a?(Float) != false || raise("Passed value for field obj.concurrency_counter is not the expected type, validation failed.")
  obj.concurrency_limit_included.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit_included is not the expected type, validation failed.")
  obj.phone_numbers_counter&.is_a?(Float) != false || raise("Passed value for field obj.phone_numbers_counter is not the expected type, validation failed.")
  obj.phone_numbers_included&.is_a?(Float) != false || raise("Passed value for field obj.phone_numbers_included is not the expected type, validation failed.")
  obj.concurrency_limit_purchased.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit_purchased is not the expected type, validation failed.")
  obj.monthly_charge_schedule_id&.is_a?(Float) != false || raise("Passed value for field obj.monthly_charge_schedule_id is not the expected type, validation failed.")
  obj.monthly_credit_check_schedule_id&.is_a?(Float) != false || raise("Passed value for field obj.monthly_credit_check_schedule_id is not the expected type, validation failed.")
  obj.stripe_customer_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_customer_id is not the expected type, validation failed.")
  obj.stripe_payment_method_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_payment_method_id is not the expected type, validation failed.")
  obj.slack_support_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.slack_support_enabled is not the expected type, validation failed.")
  obj.slack_channel_id&.is_a?(String) != false || raise("Passed value for field obj.slack_channel_id is not the expected type, validation failed.")
  obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.")
  obj.hipaa_common_paper_agreement_id&.is_a?(String) != false || raise("Passed value for field obj.hipaa_common_paper_agreement_id is not the expected type, validation failed.")
  obj.stripe_payment_method_fingerprint&.is_a?(String) != false || raise("Passed value for field obj.stripe_payment_method_fingerprint is not the expected type, validation failed.")
  obj.stripe_customer_email&.is_a?(String) != false || raise("Passed value for field obj.stripe_customer_email is not the expected type, validation failed.")
  obj.referred_by_email&.is_a?(String) != false || raise("Passed value for field obj.referred_by_email is not the expected type, validation failed.")
  obj.auto_reload_plan.nil? || Vapi::AutoReloadPlan.validate_raw(obj: obj.auto_reload_plan)
  obj.minutes_included&.is_a?(Float) != false || raise("Passed value for field obj.minutes_included is not the expected type, validation failed.")
  obj.minutes_used&.is_a?(Float) != false || raise("Passed value for field obj.minutes_used is not the expected type, validation failed.")
  obj.minutes_used_next_reset_at&.is_a?(DateTime) != false || raise("Passed value for field obj.minutes_used_next_reset_at is not the expected type, validation failed.")
  obj.minutes_overage_cost&.is_a?(Float) != false || raise("Passed value for field obj.minutes_overage_cost is not the expected type, validation failed.")
  obj.providers_included&.is_a?(Array) != false || raise("Passed value for field obj.providers_included is not the expected type, validation failed.")
  obj.outbound_calls_daily_limit&.is_a?(Float) != false || raise("Passed value for field obj.outbound_calls_daily_limit is not the expected type, validation failed.")
  obj.outbound_calls_counter&.is_a?(Float) != false || raise("Passed value for field obj.outbound_calls_counter is not the expected type, validation failed.")
  obj.outbound_calls_counter_next_reset_at&.is_a?(DateTime) != false || raise("Passed value for field obj.outbound_calls_counter_next_reset_at is not the expected type, validation failed.")
  obj.coupon_ids&.is_a?(Array) != false || raise("Passed value for field obj.coupon_ids is not the expected type, validation failed.")
  obj.coupon_usage_left&.is_a?(String) != false || raise("Passed value for field obj.coupon_usage_left is not the expected type, validation failed.")
  obj.invoice_plan.nil? || Vapi::InvoicePlan.validate_raw(obj: obj.invoice_plan)
  obj.pci_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.pci_enabled is not the expected type, validation failed.")
  obj.pci_common_paper_agreement_id&.is_a?(String) != false || raise("Passed value for field obj.pci_common_paper_agreement_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Subscription to a JSON object

Returns:

  • (String)


351
352
353
# File 'lib/vapi_server_sdk/types/subscription.rb', line 351

def to_json(*_args)
  @_field_set&.to_json
end