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
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class ChargeNativeInvoiceResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class ConvertCompanyTrialResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyTrialResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -6,6 +6,8 @@ module Schematic
6
6
  class CreateBillingSubscriptionRequestBody < Internal::Types::Model
7
7
  field :application_id, -> { String }, optional: true, nullable: false
8
8
 
9
+ field :billing_cycle_anchor, -> { String }, optional: true, nullable: false
10
+
9
11
  field :cancel_at, -> { Integer }, optional: true, nullable: false
10
12
 
11
13
  field :cancel_at_period_end, -> { Internal::Types::Boolean }, optional: false, nullable: false
@@ -28,6 +30,10 @@ module Schematic
28
30
 
29
31
  field :metadata, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
30
32
 
33
+ field :pause_behavior, -> { Schematic::Types::BillingSubscriptionPauseBehavior }, optional: true, nullable: false
34
+
35
+ field :pause_resumes_at, -> { Integer }, optional: true, nullable: false
36
+
31
37
  field :period_end, -> { Integer }, optional: true, nullable: false
32
38
 
33
39
  field :period_start, -> { Integer }, optional: true, nullable: false
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class DeleteContractDocumentResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class EndCompanyTrialResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyTrialResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class GetCompanyContractResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyBillingProfileContractResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class GetCompanyTrialResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyTrialResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class GetCompanyUpcomingInvoicesResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::BillingUpcomingInvoicesResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class MoveToDefaultPlanResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::BillingMovedToDefaultPlanResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class ReissueNativeInvoiceLinkResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class RevokeNativeInvoiceLinkResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::BillingInvoiceDetailResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class StartCompanyTrialRequestBody < Internal::Types::Model
7
+ field :company_id, -> { String }, optional: false, nullable: false
8
+
9
+ field :cadence, -> { Schematic::Types::BillingProductPriceInterval }, optional: false, nullable: false
10
+
11
+ field :cadence_interval_count, -> { Integer }, optional: true, nullable: false
12
+
13
+ field :end_behavior, -> { Schematic::Types::BillingSubscriptionTrialEndSetting }, optional: true, nullable: false
14
+
15
+ field :plan_id, -> { String }, optional: false, nullable: false
16
+
17
+ field :trial_end, -> { String }, optional: true, nullable: false
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class StartCompanyTrialResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyTrialResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,7 +4,11 @@ module Schematic
4
4
  module Billing
5
5
  module Types
6
6
  class UpdateBillingSettingsRequestBody < Internal::Types::Model
7
+ field :default_collector, -> { Schematic::Types::Collector }, optional: true, nullable: false
8
+
7
9
  field :default_provider_type, -> { Schematic::Types::BillingProviderType }, optional: true, nullable: false
10
+
11
+ field :invoice_reply_to_email, -> { String }, optional: true, nullable: false
8
12
  end
9
13
  end
10
14
  end
@@ -6,8 +6,12 @@ module Schematic
6
6
  class UpdateCompanyBillingProfileRequestBody < Internal::Types::Model
7
7
  field :billing_profile_id, -> { String }, optional: false, nullable: false
8
8
 
9
+ field :billing_details, -> { Schematic::Types::ContractBillingDetailsRequestBody }, optional: true, nullable: false
10
+
9
11
  field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: false, nullable: false
10
12
 
13
+ field :collector, -> { Schematic::Types::Collector }, optional: true, nullable: false
14
+
11
15
  field :currency, -> { Schematic::Types::Currency }, optional: true, nullable: false
12
16
 
13
17
  field :days_until_due, -> { Integer }, optional: true, nullable: false
@@ -25,6 +29,8 @@ module Schematic
25
29
  field :payment_method_id, -> { String }, optional: true, nullable: false
26
30
 
27
31
  field :proration_behavior, -> { Schematic::Types::ProrationBehavior }, optional: true, nullable: false
32
+
33
+ field :purchase_order, -> { String }, optional: true, nullable: false
28
34
  end
29
35
  end
30
36
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class UpdateCompanyTrialRequestBody < Internal::Types::Model
7
+ field :company_id, -> { String }, optional: false, nullable: false
8
+
9
+ field :end_behavior, -> { Schematic::Types::BillingSubscriptionTrialEndSetting }, optional: true, nullable: false
10
+
11
+ field :trial_end, -> { String }, optional: true, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class UpdateCompanyTrialResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyTrialResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Schematic
4
+ module Billing
5
+ module Types
6
+ class UploadContractDocumentRequest < Internal::Types::Model
7
+ field :billing_profile_id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../schematic"
4
+
5
+ module Schematic
6
+ module Billing
7
+ module Types
8
+ class UploadContractDocumentResponse < Internal::Types::Model
9
+ field :data, -> { Schematic::Types::CompanyBillingProfileContractResponseData }, optional: false, nullable: false
10
+
11
+ field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -14,6 +14,9 @@ module Schematic
14
14
  raise NotImplementedError
15
15
  end
16
16
 
17
+ # Optional: `set_keep_ttl(key, value)` overwrites a value without changing
18
+ # its expiry. Providers that don't define it are written with `set`.
19
+
17
20
  # Remove all keys matching `scope` that are NOT in `keys_to_keep`.
18
21
  # `scope:` is required so shared caches (e.g. Redis) only prune their own
19
22
  # namespace instead of wiping sibling caches that share a base key_prefix.
@@ -69,6 +72,20 @@ module Schematic
69
72
  end
70
73
  end
71
74
 
75
+ # Overwrites the value but keeps a live entry's expiry. A missing or
76
+ # expired entry gets the default TTL.
77
+ def set_keep_ttl(key, value)
78
+ kept = @mutex.synchronize do
79
+ entry = @cache[key]
80
+ next false unless entry && !entry.expired?
81
+
82
+ @cache.delete(key)
83
+ @cache[key] = CacheEntry.new(value, entry.ttl, created_at: entry.created_at)
84
+ true
85
+ end
86
+ set(key, value) unless kept
87
+ end
88
+
72
89
  def delete(key)
73
90
  @mutex.synchronize do
74
91
  @cache.delete(key)
@@ -122,10 +139,10 @@ module Schematic
122
139
  class CacheEntry
123
140
  attr_reader :value, :ttl, :created_at
124
141
 
125
- def initialize(value, ttl)
142
+ def initialize(value, ttl, created_at: nil)
126
143
  @value = value
127
144
  @ttl = ttl
128
- @created_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
145
+ @created_at = created_at || Process.clock_gettime(Process::CLOCK_MONOTONIC)
129
146
  end
130
147
 
131
148
  def expired?
@@ -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
 
@@ -107,7 +107,7 @@ module Schematic
107
107
  500 => Schematic::Types::ApiError
108
108
  }
109
109
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
110
- raise error_class.new(response.body, code: code, body: error_body)
110
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
111
111
  end
112
112
  end
113
113
 
@@ -149,7 +149,7 @@ module Schematic
149
149
  500 => Schematic::Types::ApiError
150
150
  }
151
151
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
152
- raise error_class.new(response.body, code: code, body: error_body)
152
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
153
153
  end
154
154
  end
155
155
 
@@ -197,7 +197,7 @@ module Schematic
197
197
  500 => Schematic::Types::ApiError
198
198
  }
199
199
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
200
- raise error_class.new(response.body, code: code, body: error_body)
200
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
201
201
  end
202
202
  end
203
203
 
@@ -240,7 +240,7 @@ module Schematic
240
240
  500 => Schematic::Types::ApiError
241
241
  }
242
242
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
243
- raise error_class.new(response.body, code: code, body: error_body)
243
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
244
244
  end
245
245
  end
246
246
 
@@ -282,7 +282,7 @@ module Schematic
282
282
  500 => Schematic::Types::ApiError
283
283
  }
284
284
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
285
- raise error_class.new(response.body, code: code, body: error_body)
285
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
286
286
  end
287
287
  end
288
288
 
@@ -330,7 +330,7 @@ module Schematic
330
330
  500 => Schematic::Types::ApiError
331
331
  }
332
332
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
333
- raise error_class.new(response.body, code: code, body: error_body)
333
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
334
334
  end
335
335
  end
336
336
 
@@ -372,7 +372,7 @@ module Schematic
372
372
  500 => Schematic::Types::ApiError
373
373
  }
374
374
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
375
- raise error_class.new(response.body, code: code, body: error_body)
375
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
376
376
  end
377
377
  end
378
378
 
@@ -418,7 +418,7 @@ module Schematic
418
418
  500 => Schematic::Types::ApiError
419
419
  }
420
420
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
421
- raise error_class.new(response.body, code: code, body: error_body)
421
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
422
422
  end
423
423
 
424
424
  # @param request_options [Hash]
@@ -463,7 +463,7 @@ module Schematic
463
463
  500 => Schematic::Types::ApiError
464
464
  }
465
465
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
466
- raise error_class.new(response.body, code: code, body: error_body)
466
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
467
467
  end
468
468
 
469
469
  # @param request_options [Hash]
@@ -504,7 +504,7 @@ module Schematic
504
504
  500 => Schematic::Types::ApiError
505
505
  }
506
506
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
507
- raise error_class.new(response.body, code: code, body: error_body)
507
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
508
508
  end
509
509
  end
510
510
 
@@ -546,7 +546,7 @@ module Schematic
546
546
  500 => Schematic::Types::ApiError
547
547
  }
548
548
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
549
- raise error_class.new(response.body, code: code, body: error_body)
549
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
550
550
  end
551
551
  end
552
552
 
@@ -592,7 +592,7 @@ module Schematic
592
592
  500 => Schematic::Types::ApiError
593
593
  }
594
594
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
595
- raise error_class.new(response.body, code: code, body: error_body)
595
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
596
596
  end
597
597
 
598
598
  # @param request_options [Hash]
@@ -637,7 +637,7 @@ module Schematic
637
637
  500 => Schematic::Types::ApiError
638
638
  }
639
639
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
640
- raise error_class.new(response.body, code: code, body: error_body)
640
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
641
641
  end
642
642
 
643
643
  # @param request_options [Hash]
@@ -676,7 +676,7 @@ module Schematic
676
676
  500 => Schematic::Types::ApiError
677
677
  }
678
678
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
679
- raise error_class.new(response.body, code: code, body: error_body)
679
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
680
680
  end
681
681
  end
682
682
 
@@ -718,7 +718,7 @@ module Schematic
718
718
  500 => Schematic::Types::ApiError
719
719
  }
720
720
  error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
721
- raise error_class.new(response.body, code: code, body: error_body)
721
+ raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash)
722
722
  end
723
723
  end
724
724
  end
@@ -10,6 +10,8 @@ module Schematic
10
10
 
11
11
  field :custom_plan_cta_url, -> { String }, optional: true, nullable: false
12
12
 
13
+ field :custom_plan_id, -> { String }, optional: true, nullable: false
14
+
13
15
  field :custom_plan_price_text, -> { String }, optional: true, nullable: false
14
16
 
15
17
  field :custom_plans_visible, -> { Internal::Types::Boolean }, optional: true, nullable: false