schematichq 1.5.7 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.fern/metadata.json +5 -5
  3. data/.fern/replay.lock +13 -1
  4. data/README.md +7 -1
  5. data/lib/schematic/accesstokens/client.rb +1 -1
  6. data/lib/schematic/accounts/client.rb +15 -15
  7. data/lib/schematic/billing/client.rb +706 -83
  8. data/lib/schematic/billing/types/charge_native_invoice_response.rb +15 -0
  9. data/lib/schematic/billing/types/convert_company_trial_response.rb +15 -0
  10. data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +6 -0
  11. data/lib/schematic/billing/types/delete_contract_document_response.rb +15 -0
  12. data/lib/schematic/billing/types/end_company_trial_response.rb +15 -0
  13. data/lib/schematic/billing/types/get_company_contract_response.rb +15 -0
  14. data/lib/schematic/billing/types/get_company_trial_response.rb +15 -0
  15. data/lib/schematic/billing/types/get_company_upcoming_invoices_response.rb +15 -0
  16. data/lib/schematic/billing/types/move_to_default_plan_response.rb +15 -0
  17. data/lib/schematic/billing/types/reissue_native_invoice_link_response.rb +15 -0
  18. data/lib/schematic/billing/types/revoke_native_invoice_link_response.rb +15 -0
  19. data/lib/schematic/billing/types/start_company_trial_request_body.rb +21 -0
  20. data/lib/schematic/billing/types/start_company_trial_response.rb +15 -0
  21. data/lib/schematic/billing/types/update_billing_settings_request_body.rb +4 -0
  22. data/lib/schematic/billing/types/update_company_billing_profile_request_body.rb +6 -0
  23. data/lib/schematic/billing/types/update_company_trial_request_body.rb +15 -0
  24. data/lib/schematic/billing/types/update_company_trial_response.rb +15 -0
  25. data/lib/schematic/billing/types/upload_contract_document_request.rb +11 -0
  26. data/lib/schematic/billing/types/upload_contract_document_response.rb +15 -0
  27. data/lib/schematic/cache.rb +19 -2
  28. data/lib/schematic/catalogs/client.rb +16 -16
  29. data/lib/schematic/catalogs/types/update_catalog_configuration_request_body.rb +2 -0
  30. data/lib/schematic/checkout/client.rb +98 -9
  31. data/lib/schematic/checkout/types/checkout_data_request_body.rb +2 -0
  32. data/lib/schematic/checkout/types/pause_subscription_request.rb +15 -0
  33. data/lib/schematic/checkout/types/pause_subscription_response.rb +15 -0
  34. data/lib/schematic/checkout/types/resume_subscription_request.rb +13 -0
  35. data/lib/schematic/checkout/types/resume_subscription_response.rb +15 -0
  36. data/lib/schematic/client.rb +7 -196
  37. data/lib/schematic/companies/client.rb +140 -44
  38. data/lib/schematic/companies/types/get_billing_entity_settings_response.rb +15 -0
  39. data/lib/schematic/companies/types/list_users_params.rb +4 -0
  40. data/lib/schematic/companies/types/list_users_request.rb +4 -0
  41. data/lib/schematic/companies/types/update_billing_entity_settings_request_body.rb +13 -0
  42. data/lib/schematic/companies/types/update_billing_entity_settings_response.rb +15 -0
  43. data/lib/schematic/components/client.rb +8 -8
  44. data/lib/schematic/componentspublic/client.rb +1 -1
  45. data/lib/schematic/credits/client.rb +41 -41
  46. data/lib/schematic/customplangrouprollouts/client.rb +258 -0
  47. data/lib/schematic/customplangrouprollouts/types/copy_custom_plan_request_body.rb +15 -0
  48. data/lib/schematic/customplangrouprollouts/types/copy_custom_plan_response.rb +15 -0
  49. data/lib/schematic/customplangrouprollouts/types/get_group_rollout_response.rb +15 -0
  50. data/lib/schematic/customplangrouprollouts/types/list_group_rollouts_params.rb +14 -0
  51. data/lib/schematic/customplangrouprollouts/types/list_group_rollouts_request.rb +11 -0
  52. data/lib/schematic/customplangrouprollouts/types/list_group_rollouts_response.rb +15 -0
  53. data/lib/schematic/customplangrouprollouts/types/preview_group_rollout_params.rb +16 -0
  54. data/lib/schematic/customplangrouprollouts/types/preview_group_rollout_request.rb +15 -0
  55. data/lib/schematic/customplangrouprollouts/types/preview_group_rollout_response.rb +15 -0
  56. data/lib/schematic/customplangrouprollouts/types/start_group_rollout_request_body.rb +17 -0
  57. data/lib/schematic/customplangrouprollouts/types/start_group_rollout_response.rb +15 -0
  58. data/lib/schematic/dataexports/client.rb +4 -4
  59. data/lib/schematic/datastream/client.rb +52 -22
  60. data/lib/schematic/datastream/resource_cache.rb +13 -3
  61. data/lib/schematic/entitlements/client.rb +28 -28
  62. data/lib/schematic/entitlements/types/create_billing_linked_plan_entitlement_request_body.rb +2 -0
  63. data/lib/schematic/entitlements/types/create_company_override_request_body.rb +2 -0
  64. data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +2 -0
  65. data/lib/schematic/entitlements/types/update_company_override_request_body.rb +2 -0
  66. data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +2 -0
  67. data/lib/schematic/errors/response_error.rb +4 -2
  68. data/lib/schematic/events/client.rb +213 -9
  69. data/lib/schematic/events/types/create_account_inference_cost_rate_request_body.rb +19 -0
  70. data/lib/schematic/events/types/create_account_inference_cost_rate_response.rb +15 -0
  71. data/lib/schematic/events/types/delete_account_inference_cost_rate_response.rb +15 -0
  72. data/lib/schematic/events/types/list_account_inference_cost_rates_params.rb +20 -0
  73. data/lib/schematic/events/types/list_account_inference_cost_rates_request.rb +17 -0
  74. data/lib/schematic/events/types/list_account_inference_cost_rates_response.rb +15 -0
  75. data/lib/schematic/events/types/update_account_inference_cost_rate_request_body.rb +13 -0
  76. data/lib/schematic/events/types/update_account_inference_cost_rate_response.rb +15 -0
  77. data/lib/schematic/features/client.rb +18 -18
  78. data/lib/schematic/insights/client.rb +6 -6
  79. data/lib/schematic/integrationsapi/client.rb +14 -14
  80. data/lib/schematic/internal/http/raw_client.rb +2 -2
  81. data/lib/schematic/internal/iterators/offset_page_iterator.rb +2 -0
  82. data/lib/schematic/licenses/client.rb +3 -3
  83. data/lib/schematic/planbundle/client.rb +3 -3
  84. data/lib/schematic/plangroups/client.rb +3 -3
  85. data/lib/schematic/planmigrations/client.rb +11 -11
  86. data/lib/schematic/plans/client.rb +20 -20
  87. data/lib/schematic/redis_cache.rb +10 -1
  88. data/lib/schematic/scheduledcheckout/client.rb +4 -4
  89. data/lib/schematic/schematic_client.rb +21 -3
  90. data/lib/schematic/types/account_inference_cost_rate_response_data.rb +29 -0
  91. data/lib/schematic/types/billing_customer_subscription.rb +2 -0
  92. data/lib/schematic/types/billing_invoice_billing_details_response_data.rb +2 -0
  93. data/lib/schematic/types/billing_invoice_detail_response_data.rb +2 -0
  94. data/lib/schematic/types/billing_moved_to_default_plan_response_data.rb +15 -0
  95. data/lib/schematic/types/billing_native_subscription_response_data.rb +4 -0
  96. data/lib/schematic/types/billing_product_for_subscription_response_data.rb +2 -0
  97. data/lib/schematic/types/billing_product_plan_response_data.rb +2 -0
  98. data/lib/schematic/types/billing_settings_response_data.rb +4 -0
  99. data/lib/schematic/types/billing_subscription_pause_behavior.rb +15 -0
  100. data/lib/schematic/types/billing_subscription_response_data.rb +6 -0
  101. data/lib/schematic/types/billing_subscription_view.rb +6 -0
  102. data/lib/schematic/types/billing_upcoming_invoice_response_data.rb +43 -0
  103. data/lib/schematic/types/billing_upcoming_invoices_response_data.rb +13 -0
  104. data/lib/schematic/types/catalog_configuration_response_data.rb +2 -0
  105. data/lib/schematic/types/catalog_plan_response_data.rb +4 -0
  106. data/lib/schematic/types/catalog_response_data.rb +2 -0
  107. data/lib/schematic/types/checkout_subscription.rb +6 -0
  108. data/lib/schematic/types/company_billing_entity_settings_response_data.rb +15 -0
  109. data/lib/schematic/types/company_billing_entity_subscription_response_data.rb +10 -0
  110. data/lib/schematic/types/company_billing_profile_contract_response_data.rb +55 -0
  111. data/lib/schematic/types/company_billing_profile_document_response_data.rb +15 -0
  112. data/lib/schematic/types/company_override_response_data.rb +2 -0
  113. data/lib/schematic/types/company_subscription_response_data.rb +10 -0
  114. data/lib/schematic/types/company_trial_response_data.rb +35 -0
  115. data/lib/schematic/types/company_trial_status.rb +16 -0
  116. data/lib/schematic/types/contract_billing_details_request_body.rb +19 -0
  117. data/lib/schematic/types/contract_postpaid_credit_response_data.rb +23 -0
  118. data/lib/schematic/types/contract_postpaid_response_data.rb +15 -0
  119. data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +2 -0
  120. data/lib/schematic/types/create_entitlement_req_common.rb +2 -0
  121. data/lib/schematic/types/credit_burn_breakdown_line.rb +4 -0
  122. data/lib/schematic/types/credit_ledger_export_metadata.rb +25 -0
  123. data/lib/schematic/types/credit_ledger_export_metadata_event_type.rb +19 -0
  124. data/lib/schematic/types/credit_model_rate.rb +17 -0
  125. data/lib/schematic/types/custom_plan_billing_response_data.rb +2 -0
  126. data/lib/schematic/types/data_export_metadata.rb +2 -0
  127. data/lib/schematic/types/data_export_type.rb +1 -0
  128. data/lib/schematic/types/group_rollout_change_response_data.rb +13 -0
  129. data/lib/schematic/types/group_rollout_changes_response_data.rb +23 -0
  130. data/lib/schematic/types/group_rollout_company_response_data.rb +15 -0
  131. data/lib/schematic/types/group_rollout_company_result_response_data.rb +19 -0
  132. data/lib/schematic/types/group_rollout_preview_response_data.rb +19 -0
  133. data/lib/schematic/types/group_rollout_response_data.rb +25 -0
  134. data/lib/schematic/types/group_rollout_versions_request_body.rb +13 -0
  135. data/lib/schematic/types/manage_plan_request.rb +4 -0
  136. data/lib/schematic/types/manage_plan_response_response_data.rb +2 -0
  137. data/lib/schematic/types/migration_error_code.rb +1 -0
  138. data/lib/schematic/types/plan_change_action.rb +2 -0
  139. data/lib/schematic/types/plan_change_response_data.rb +4 -0
  140. data/lib/schematic/types/plan_entitlement_response_data.rb +2 -0
  141. data/lib/schematic/types/publish_plan_version_request_body.rb +8 -0
  142. data/lib/schematic/types/publish_preview_interval_change_response_data.rb +13 -0
  143. data/lib/schematic/types/publish_preview_response_data.rb +6 -0
  144. data/lib/schematic/types/scheduled_downgrade_response_data.rb +4 -0
  145. data/lib/schematic/types/stripe_integration_config.rb +2 -0
  146. data/lib/schematic/types/trial_source.rb +15 -0
  147. data/lib/schematic/types/update_entitlement_req_common.rb +2 -0
  148. data/lib/schematic/types/web_scheduled_downgrade_webhook_output.rb +2 -0
  149. data/lib/schematic/version.rb +1 -1
  150. data/lib/schematic/webhooks/client.rb +10 -10
  151. data/lib/schematic.rb +79 -5
  152. data/reference.md +5208 -3800
  153. metadata +70 -2
@@ -48,7 +48,7 @@ module Schematic
48
48
  500 => Schematic::Types::ApiError
49
49
  }
50
50
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
51
- raise error_class.new(response.body, code: code, body: error_body)
51
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
52
52
  end
53
53
  end
54
54
 
@@ -115,7 +115,7 @@ module Schematic
115
115
  500 => Schematic::Types::ApiError
116
116
  }
117
117
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
118
- raise error_class.new(response.body, code: code, body: error_body)
118
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
119
119
  end
120
120
  end
121
121
 
@@ -157,7 +157,7 @@ module Schematic
157
157
  500 => Schematic::Types::ApiError
158
158
  }
159
159
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
160
- raise error_class.new(response.body, code: code, body: error_body)
160
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
161
161
  end
162
162
  end
163
163
 
@@ -200,7 +200,7 @@ module Schematic
200
200
  500 => Schematic::Types::ApiError
201
201
  }
202
202
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
203
- raise error_class.new(response.body, code: code, body: error_body)
203
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
204
204
  end
205
205
  end
206
206
 
@@ -243,7 +243,7 @@ module Schematic
243
243
  500 => Schematic::Types::ApiError
244
244
  }
245
245
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
246
- raise error_class.new(response.body, code: code, body: error_body)
246
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
247
247
  end
248
248
  end
249
249
 
@@ -283,7 +283,7 @@ module Schematic
283
283
  500 => Schematic::Types::ApiError
284
284
  }
285
285
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
286
- raise error_class.new(response.body, code: code, body: error_body)
286
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
287
287
  end
288
288
  end
289
289
 
@@ -323,7 +323,7 @@ module Schematic
323
323
  500 => Schematic::Types::ApiError
324
324
  }
325
325
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
326
- raise error_class.new(response.body, code: code, body: error_body)
326
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
327
327
  end
328
328
  end
329
329
 
@@ -363,7 +363,7 @@ module Schematic
363
363
  500 => Schematic::Types::ApiError
364
364
  }
365
365
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
366
- raise error_class.new(response.body, code: code, body: error_body)
366
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
367
367
  end
368
368
  end
369
369
 
@@ -406,7 +406,7 @@ module Schematic
406
406
  500 => Schematic::Types::ApiError
407
407
  }
408
408
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
409
- raise error_class.new(response.body, code: code, body: error_body)
409
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
410
410
  end
411
411
  end
412
412
 
@@ -449,7 +449,7 @@ module Schematic
449
449
  500 => Schematic::Types::ApiError
450
450
  }
451
451
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
452
- raise error_class.new(response.body, code: code, body: error_body)
452
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
453
453
  end
454
454
  end
455
455
 
@@ -492,7 +492,7 @@ module Schematic
492
492
  500 => Schematic::Types::ApiError
493
493
  }
494
494
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
495
- raise error_class.new(response.body, code: code, body: error_body)
495
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
496
496
  end
497
497
  end
498
498
 
@@ -535,7 +535,7 @@ module Schematic
535
535
  500 => Schematic::Types::ApiError
536
536
  }
537
537
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
538
- raise error_class.new(response.body, code: code, body: error_body)
538
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
539
539
  end
540
540
  end
541
541
 
@@ -575,7 +575,7 @@ module Schematic
575
575
  500 => Schematic::Types::ApiError
576
576
  }
577
577
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
578
- raise error_class.new(response.body, code: code, body: error_body)
578
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
579
579
  end
580
580
  end
581
581
 
@@ -618,7 +618,7 @@ module Schematic
618
618
  500 => Schematic::Types::ApiError
619
619
  }
620
620
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
621
- raise error_class.new(response.body, code: code, body: error_body)
621
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
622
622
  end
623
623
  end
624
624
  end
@@ -35,7 +35,7 @@ module Schematic
35
35
  @default_headers = {
36
36
  "X-Fern-Language": "Ruby",
37
37
  "X-Fern-SDK-Name": "schematic",
38
- "X-Fern-SDK-Version": "0.0.1"
38
+ "X-Fern-SDK-Version": Schematic::VERSION
39
39
  }.merge(headers)
40
40
  @overridable_headers = overridable_headers.to_set { |name| name.to_s.downcase }
41
41
  end
@@ -237,7 +237,7 @@ module Schematic
237
237
  )
238
238
 
239
239
  request_headers = @default_headers.merge(auth_headers).merge(headers)
240
- request_headers.each { |name, value| request[name] = value }
240
+ request_headers.each { |name, value| request[name] = value == false ? "false" : value }
241
241
  request.body = body if body
242
242
 
243
243
  # Net::HTTP disables its transparent gzip/deflate decoding as soon as an
@@ -84,6 +84,8 @@ module Schematic
84
84
  #
85
85
  # @return [Boolean]
86
86
  def next?
87
+ return false if @page_number.nil?
88
+
87
89
  return @has_next_page unless @has_next_page.nil?
88
90
  return true if @next_page && page_has_items?(@next_page)
89
91
  return @has_next_page = false if @next_page
@@ -67,7 +67,7 @@ module Schematic
67
67
  500 => Schematic::Types::ApiError
68
68
  }
69
69
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
70
- raise error_class.new(response.body, code: code, body: error_body)
70
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
71
71
  end
72
72
  end
73
73
 
@@ -109,7 +109,7 @@ module Schematic
109
109
  500 => Schematic::Types::ApiError
110
110
  }
111
111
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
112
- raise error_class.new(response.body, code: code, body: error_body)
112
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
113
113
  end
114
114
  end
115
115
 
@@ -170,7 +170,7 @@ module Schematic
170
170
  500 => Schematic::Types::ApiError
171
171
  }
172
172
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
173
- raise error_class.new(response.body, code: code, body: error_body)
173
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
174
174
  end
175
175
  end
176
176
  end
@@ -61,7 +61,7 @@ module Schematic
61
61
  500 => Schematic::Types::ApiError
62
62
  }
63
63
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
64
- raise error_class.new(response.body, code: code, body: error_body)
64
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
65
65
  end
66
66
  end
67
67
 
@@ -112,7 +112,7 @@ module Schematic
112
112
  500 => Schematic::Types::ApiError
113
113
  }
114
114
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
115
- raise error_class.new(response.body, code: code, body: error_body)
115
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
116
116
  end
117
117
  end
118
118
 
@@ -168,7 +168,7 @@ module Schematic
168
168
  500 => Schematic::Types::ApiError
169
169
  }
170
170
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
171
- raise error_class.new(response.body, code: code, body: error_body)
171
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
172
172
  end
173
173
  end
174
174
  end
@@ -52,7 +52,7 @@ module Schematic
52
52
  500 => Schematic::Types::ApiError
53
53
  }
54
54
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
55
- raise error_class.new(response.body, code: code, body: error_body)
55
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
56
56
  end
57
57
  end
58
58
 
@@ -123,7 +123,7 @@ module Schematic
123
123
  500 => Schematic::Types::ApiError
124
124
  }
125
125
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
126
- raise error_class.new(response.body, code: code, body: error_body)
126
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
127
127
  end
128
128
  end
129
129
 
@@ -200,7 +200,7 @@ module Schematic
200
200
  500 => Schematic::Types::ApiError
201
201
  }
202
202
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
203
- raise error_class.new(response.body, code: code, body: error_body)
203
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
204
204
  end
205
205
  end
206
206
  end
@@ -67,7 +67,7 @@ module Schematic
67
67
  500 => Schematic::Types::ApiError
68
68
  }
69
69
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
70
- raise error_class.new(response.body, code: code, body: error_body)
70
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
71
71
  end
72
72
  end
73
73
 
@@ -110,7 +110,7 @@ module Schematic
110
110
  500 => Schematic::Types::ApiError
111
111
  }
112
112
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
113
- raise error_class.new(response.body, code: code, body: error_body)
113
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
114
114
  end
115
115
  end
116
116
 
@@ -171,7 +171,7 @@ module Schematic
171
171
  500 => Schematic::Types::ApiError
172
172
  }
173
173
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
174
- raise error_class.new(response.body, code: code, body: error_body)
174
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
175
175
  end
176
176
  end
177
177
 
@@ -235,7 +235,7 @@ module Schematic
235
235
  500 => Schematic::Types::ApiError
236
236
  }
237
237
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
238
- raise error_class.new(response.body, code: code, body: error_body)
238
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
239
239
  end
240
240
  end
241
241
 
@@ -283,7 +283,7 @@ module Schematic
283
283
  500 => Schematic::Types::ApiError
284
284
  }
285
285
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
286
- raise error_class.new(response.body, code: code, body: error_body)
286
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
287
287
  end
288
288
  end
289
289
 
@@ -325,7 +325,7 @@ module Schematic
325
325
  500 => Schematic::Types::ApiError
326
326
  }
327
327
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
328
- raise error_class.new(response.body, code: code, body: error_body)
328
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
329
329
  end
330
330
  end
331
331
 
@@ -368,7 +368,7 @@ module Schematic
368
368
  500 => Schematic::Types::ApiError
369
369
  }
370
370
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
371
- raise error_class.new(response.body, code: code, body: error_body)
371
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
372
372
  end
373
373
  end
374
374
 
@@ -416,7 +416,7 @@ module Schematic
416
416
  500 => Schematic::Types::ApiError
417
417
  }
418
418
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
419
- raise error_class.new(response.body, code: code, body: error_body)
419
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
420
420
  end
421
421
  end
422
422
 
@@ -467,7 +467,7 @@ module Schematic
467
467
  500 => Schematic::Types::ApiError
468
468
  }
469
469
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
470
- raise error_class.new(response.body, code: code, body: error_body)
470
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
471
471
  end
472
472
  end
473
473
 
@@ -531,7 +531,7 @@ module Schematic
531
531
  500 => Schematic::Types::ApiError
532
532
  }
533
533
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
534
- raise error_class.new(response.body, code: code, body: error_body)
534
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
535
535
  end
536
536
  end
537
537
 
@@ -578,7 +578,7 @@ module Schematic
578
578
  500 => Schematic::Types::ApiError
579
579
  }
580
580
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
581
- raise error_class.new(response.body, code: code, body: error_body)
581
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
582
582
  end
583
583
  end
584
584
  end
@@ -57,7 +57,7 @@ module Schematic
57
57
  500 => Schematic::Types::ApiError
58
58
  }
59
59
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
60
- raise error_class.new(response.body, code: code, body: error_body)
60
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
61
61
  end
62
62
  end
63
63
 
@@ -130,7 +130,7 @@ module Schematic
130
130
  500 => Schematic::Types::ApiError
131
131
  }
132
132
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
133
- raise error_class.new(response.body, code: code, body: error_body)
133
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
134
134
  end
135
135
  end
136
136
 
@@ -182,7 +182,7 @@ module Schematic
182
182
  500 => Schematic::Types::ApiError
183
183
  }
184
184
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
185
- raise error_class.new(response.body, code: code, body: error_body)
185
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
186
186
  end
187
187
  end
188
188
 
@@ -233,7 +233,7 @@ module Schematic
233
233
  500 => Schematic::Types::ApiError
234
234
  }
235
235
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
236
- raise error_class.new(response.body, code: code, body: error_body)
236
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
237
237
  end
238
238
  end
239
239
 
@@ -279,7 +279,7 @@ module Schematic
279
279
  500 => Schematic::Types::ApiError
280
280
  }
281
281
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
282
- raise error_class.new(response.body, code: code, body: error_body)
282
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
283
283
  end
284
284
  end
285
285
 
@@ -385,7 +385,7 @@ module Schematic
385
385
  500 => Schematic::Types::ApiError
386
386
  }
387
387
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
388
- raise error_class.new(response.body, code: code, body: error_body)
388
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
389
389
  end
390
390
  end
391
391
 
@@ -431,7 +431,7 @@ module Schematic
431
431
  500 => Schematic::Types::ApiError
432
432
  }
433
433
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
434
- raise error_class.new(response.body, code: code, body: error_body)
434
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
435
435
  end
436
436
  end
437
437
 
@@ -481,7 +481,7 @@ module Schematic
481
481
  500 => Schematic::Types::ApiError
482
482
  }
483
483
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
484
- raise error_class.new(response.body, code: code, body: error_body)
484
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
485
485
  end
486
486
  end
487
487
 
@@ -531,7 +531,7 @@ module Schematic
531
531
  500 => Schematic::Types::ApiError
532
532
  }
533
533
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
534
- raise error_class.new(response.body, code: code, body: error_body)
534
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
535
535
  end
536
536
  end
537
537
 
@@ -574,7 +574,7 @@ module Schematic
574
574
  500 => Schematic::Types::ApiError
575
575
  }
576
576
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
577
- raise error_class.new(response.body, code: code, body: error_body)
577
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
578
578
  end
579
579
  end
580
580
 
@@ -625,7 +625,7 @@ module Schematic
625
625
  500 => Schematic::Types::ApiError
626
626
  }
627
627
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
628
- raise error_class.new(response.body, code: code, body: error_body)
628
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
629
629
  end
630
630
  end
631
631
 
@@ -673,7 +673,7 @@ module Schematic
673
673
  500 => Schematic::Types::ApiError
674
674
  }
675
675
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
676
- raise error_class.new(response.body, code: code, body: error_body)
676
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
677
677
  end
678
678
  end
679
679
 
@@ -731,7 +731,7 @@ module Schematic
731
731
  500 => Schematic::Types::ApiError
732
732
  }
733
733
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
734
- raise error_class.new(response.body, code: code, body: error_body)
734
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
735
735
  end
736
736
  end
737
737
 
@@ -789,7 +789,7 @@ module Schematic
789
789
  500 => Schematic::Types::ApiError
790
790
  }
791
791
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
792
- raise error_class.new(response.body, code: code, body: error_body)
792
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
793
793
  end
794
794
  end
795
795
 
@@ -895,7 +895,7 @@ module Schematic
895
895
  500 => Schematic::Types::ApiError
896
896
  }
897
897
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
898
- raise error_class.new(response.body, code: code, body: error_body)
898
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
899
899
  end
900
900
  end
901
901
 
@@ -947,7 +947,7 @@ module Schematic
947
947
  500 => Schematic::Types::ApiError
948
948
  }
949
949
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
950
- raise error_class.new(response.body, code: code, body: error_body)
950
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
951
951
  end
952
952
  end
953
953
 
@@ -998,7 +998,7 @@ module Schematic
998
998
  500 => Schematic::Types::ApiError
999
999
  }
1000
1000
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1001
- raise error_class.new(response.body, code: code, body: error_body)
1001
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1002
1002
  end
1003
1003
  end
1004
1004
 
@@ -1048,7 +1048,7 @@ module Schematic
1048
1048
  500 => Schematic::Types::ApiError
1049
1049
  }
1050
1050
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1051
- raise error_class.new(response.body, code: code, body: error_body)
1051
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1052
1052
  end
1053
1053
  end
1054
1054
 
@@ -1099,7 +1099,7 @@ module Schematic
1099
1099
  500 => Schematic::Types::ApiError
1100
1100
  }
1101
1101
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1102
- raise error_class.new(response.body, code: code, body: error_body)
1102
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1103
1103
  end
1104
1104
  end
1105
1105
 
@@ -1150,7 +1150,7 @@ module Schematic
1150
1150
  500 => Schematic::Types::ApiError
1151
1151
  }
1152
1152
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
1153
- raise error_class.new(response.body, code: code, body: error_body)
1153
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
1154
1154
  end
1155
1155
  end
1156
1156
  end
@@ -14,7 +14,8 @@ module Schematic
14
14
  raise NotImplementedError
15
15
  end
16
16
 
17
- def set(key, value)
17
+ # Must accept `keepttl: true` (redis gem 4.2+), used by RedisCacheProvider#set_keep_ttl.
18
+ def set(key, value, **options)
18
19
  raise NotImplementedError
19
20
  end
20
21
 
@@ -62,6 +63,14 @@ module Schematic
62
63
  end
63
64
  end
64
65
 
66
+ # Overwrites the value but leaves the key's current expiry alone (Redis
67
+ # SET ... KEEPTTL, 6.0+). A key with no expiry, or a new key, gets none.
68
+ def set_keep_ttl(key, value)
69
+ full_key = prefixed_key(key)
70
+ serialized = JSON.generate(value.respond_to?(:to_h) ? value.to_h : value)
71
+ @client.set(full_key, serialized, keepttl: true)
72
+ end
73
+
65
74
  def delete(key)
66
75
  full_key = prefixed_key(key)
67
76
  @client.del(full_key)
@@ -64,7 +64,7 @@ module Schematic
64
64
  500 => Schematic::Types::ApiError
65
65
  }
66
66
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
67
- raise error_class.new(response.body, code: code, body: error_body)
67
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
68
68
  end
69
69
  end
70
70
 
@@ -112,7 +112,7 @@ module Schematic
112
112
  500 => Schematic::Types::ApiError
113
113
  }
114
114
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
115
- raise error_class.new(response.body, code: code, body: error_body)
115
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
116
116
  end
117
117
  end
118
118
 
@@ -154,7 +154,7 @@ module Schematic
154
154
  500 => Schematic::Types::ApiError
155
155
  }
156
156
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
157
- raise error_class.new(response.body, code: code, body: error_body)
157
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
158
158
  end
159
159
  end
160
160
 
@@ -202,7 +202,7 @@ module Schematic
202
202
  500 => Schematic::Types::ApiError
203
203
  }
204
204
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
205
- raise error_class.new(response.body, code: code, body: error_body)
205
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
206
206
  end
207
207
  end
208
208
  end
@@ -191,7 +191,7 @@ module Schematic
191
191
  end
192
192
 
193
193
  # DataStream path
194
- if @datastream_client&.connected?
194
+ if use_datastream_cache?
195
195
  begin
196
196
  eval_ctx = build_eval_context(company, user)
197
197
  # Only widen the call when there is something to pass: a DataStream
@@ -245,7 +245,7 @@ module Schematic
245
245
 
246
246
  begin
247
247
  # DataStream path — try evaluating all requested keys locally
248
- if @datastream_client&.connected? && keys&.any?
248
+ if use_datastream_cache? && keys&.any?
249
249
  ds_results = check_flags_via_datastream(keys, company, user)
250
250
  return ds_results if ds_results
251
251
  end
@@ -781,6 +781,18 @@ module Schematic
781
781
  parts.join(";")
782
782
  end
783
783
 
784
+ # The single gate for evaluating flag checks from the DataStream cache,
785
+ # shared by check_flag_with_entitlement and check_flags so the two can't
786
+ # drift. In replicator mode it stays false until the replicator reports its
787
+ # cache ready, and checks take the API path instead of reading a partial
788
+ # cache. connected? keeps websocket mode's existing gate on the connection;
789
+ # in replicator mode it reports the same readiness as cache_ready?.
790
+ def use_datastream_cache?
791
+ return false unless @datastream_client
792
+
793
+ @datastream_client.connected? && @datastream_client.cache_ready?
794
+ end
795
+
784
796
  def build_eval_context(company, user)
785
797
  ctx = {}
786
798
  ctx[:company] = company if company&.any?
@@ -1199,7 +1211,13 @@ module Schematic
1199
1211
 
1200
1212
  @event_buffer.push(build_event("track", body, options, TRACK_OPTION_KEYS))
1201
1213
 
1202
- if update_metrics && @datastream_client&.connected? && body[:company]
1214
+ # Not gated on connected?: a cached company outlives a WebSocket
1215
+ # disconnect or a not-ready replicator, and usage tracked in the meantime
1216
+ # has to count against it, or its metered limits stay frozen at the last
1217
+ # pushed value. Whatever the stream or replicator writes next replaces the
1218
+ # metric outright, so the bump is never counted twice. A company that
1219
+ # isn't cached is left alone.
1220
+ if update_metrics && @datastream_client && body[:company]
1203
1221
  event_name = body[:event] || body["event"]
1204
1222
  quantity = body[:quantity] || body["quantity"] || 1
1205
1223
  @datastream_client.update_company_metrics(body[:company], event_name, quantity)
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../schematic"
4
+
5
+ module Schematic
6
+ module Types
7
+ class AccountInferenceCostRateResponseData < Internal::Types::Model
8
+ field :created_at, -> { String }, optional: false, nullable: false
9
+
10
+ field :currency, -> { String }, optional: false, nullable: false
11
+
12
+ field :environment_id, -> { String }, optional: false, nullable: false
13
+
14
+ field :id, -> { String }, optional: false, nullable: false
15
+
16
+ field :provider, -> { String }, optional: false, nullable: false
17
+
18
+ field :rates, -> { Internal::Types::Hash[String, Float] }, optional: false, nullable: false
19
+
20
+ field :repriced_at, -> { String }, optional: true, nullable: false
21
+
22
+ field :response_model, -> { String }, optional: false, nullable: false
23
+
24
+ field :starting_at, -> { String }, optional: false, nullable: false
25
+
26
+ field :updated_at, -> { String }, optional: false, nullable: false
27
+ end
28
+ end
29
+ end
@@ -11,6 +11,8 @@ module Schematic
11
11
 
12
12
  field :interval, -> { String }, optional: false, nullable: false
13
13
 
14
+ field :interval_count, -> { Integer }, optional: false, nullable: false
15
+
14
16
  field :metered_usage, -> { Internal::Types::Boolean }, optional: false, nullable: false
15
17
 
16
18
  field :per_unit_price, -> { Integer }, optional: false, nullable: false
@@ -9,6 +9,8 @@ module Schematic
9
9
 
10
10
  field :email, -> { String }, optional: true, nullable: false
11
11
 
12
+ field :legal_name, -> { String }, optional: true, nullable: false
13
+
12
14
  field :phone, -> { String }, optional: true, nullable: false
13
15
 
14
16
  field :tax_ids, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceTaxIdResponseData] }, optional: false, nullable: false