license_manager 0.2.0 → 0.3.1

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/README.md +1 -1
  4. data/docs/BillingPortalSession.md +18 -0
  5. data/docs/CreateBillingPortalSession.md +18 -0
  6. data/docs/CreateIntegrationMapping.md +1 -1
  7. data/docs/Integration.md +6 -0
  8. data/docs/IntegrationMapping.md +2 -0
  9. data/docs/IntegrationMappingRecurring.md +20 -0
  10. data/docs/License.md +4 -0
  11. data/docs/LicenseCustomer.md +22 -0
  12. data/docs/LicenseSubscription.md +34 -0
  13. data/docs/LicensesApi.md +5 -5
  14. data/docs/Mrr.md +26 -0
  15. data/docs/MrrByIntervalInner.md +24 -0
  16. data/docs/MrrByPolicyInner.md +22 -0
  17. data/docs/PortalApi.md +79 -0
  18. data/docs/ProductStats.md +2 -0
  19. data/docs/Revenue.md +8 -4
  20. data/docs/StripePermission.md +3 -1
  21. data/docs/StripePrice.md +2 -0
  22. data/docs/StripePriceRecurring.md +20 -0
  23. data/docs/SubscriptionStats.md +38 -0
  24. data/docs/UpdateIntegration.md +3 -1
  25. data/lib/license_manager/api/licenses_api.rb +6 -6
  26. data/lib/license_manager/api/portal_api.rb +70 -0
  27. data/lib/license_manager/models/billing_portal_session.rb +178 -0
  28. data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
  29. data/lib/license_manager/models/create_integration_mapping.rb +1 -1
  30. data/lib/license_manager/models/event_type.rb +4 -1
  31. data/lib/license_manager/models/integration.rb +82 -1
  32. data/lib/license_manager/models/integration_mapping.rb +13 -1
  33. data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
  34. data/lib/license_manager/models/license.rb +39 -1
  35. data/lib/license_manager/models/license_customer.rb +217 -0
  36. data/lib/license_manager/models/license_subscription.rb +388 -0
  37. data/lib/license_manager/models/mrr.rb +291 -0
  38. data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
  39. data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
  40. data/lib/license_manager/models/product_stats.rb +14 -1
  41. data/lib/license_manager/models/revenue.rb +60 -6
  42. data/lib/license_manager/models/stripe_permission.rb +31 -4
  43. data/lib/license_manager/models/stripe_price.rb +13 -1
  44. data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
  45. data/lib/license_manager/models/subscription_stats.rb +456 -0
  46. data/lib/license_manager/models/update_integration.rb +42 -4
  47. data/lib/license_manager/version.rb +1 -1
  48. data/lib/license_manager.rb +10 -0
  49. data/openapi.json +599 -14
  50. data/spec/api/licenses_api_spec.rb +3 -3
  51. data/spec/api/portal_api_spec.rb +13 -0
  52. data/spec/models/billing_portal_session_spec.rb +36 -0
  53. data/spec/models/create_billing_portal_session_spec.rb +36 -0
  54. data/spec/models/create_token_spec.rb +1 -1
  55. data/spec/models/integration_mapping_recurring_spec.rb +46 -0
  56. data/spec/models/integration_mapping_spec.rb +6 -0
  57. data/spec/models/integration_spec.rb +18 -0
  58. data/spec/models/license_customer_spec.rb +48 -0
  59. data/spec/models/license_spec.rb +12 -0
  60. data/spec/models/license_subscription_spec.rb +88 -0
  61. data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
  62. data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
  63. data/spec/models/mrr_spec.rb +60 -0
  64. data/spec/models/product_stats_spec.rb +6 -0
  65. data/spec/models/revenue_spec.rb +12 -0
  66. data/spec/models/stripe_permission_spec.rb +6 -0
  67. data/spec/models/stripe_price_recurring_spec.rb +46 -0
  68. data/spec/models/stripe_price_spec.rb +6 -0
  69. data/spec/models/subscription_stats_spec.rb +96 -0
  70. data/spec/models/token_spec.rb +1 -1
  71. data/spec/models/update_integration_spec.rb +6 -0
  72. metadata +41 -1
@@ -0,0 +1,38 @@
1
+ # LicenseManager::SubscriptionStats
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **active_count** | **Integer** | Number of ongoing subscriptions: `active`, `trialing` or `past_due`. | |
8
+ | **trialing_count** | **Integer** | | |
9
+ | **past_due_count** | **Integer** | Number of them whose renewal failed, as Stripe retries it: their licenses stay valid for the integration's grace days. | |
10
+ | **canceling_count** | **Integer** | Number of them set to end at the end of their period. | |
11
+ | **new_count** | **Integer** | Number of subscriptions started in the last 30 days. | |
12
+ | **ended_count** | **Integer** | Number of subscriptions that ended in the last 30 days. | |
13
+ | **churn_rate** | **Float** | Share of the subscriptions ongoing 30 days ago that ended since, from 0 to 1. | |
14
+ | **new_by_month** | **Array<Integer>** | Number of subscriptions started each month, aligned on `months`. | |
15
+ | **ended_by_month** | **Array<Integer>** | Number of subscriptions that ended each month, aligned on `months`. | |
16
+ | **active_by_month** | **Array<Integer>** | Number of ongoing subscriptions at the end of each month, aligned on `months`, today for this month. | |
17
+ | **mrr** | [**Array<Mrr>**](Mrr.md) | MRR in each currency, from the highest number of subscriptions. Amounts aren't converted between currencies. | |
18
+
19
+ ## Example
20
+
21
+ ```ruby
22
+ require 'license_manager'
23
+
24
+ instance = LicenseManager::SubscriptionStats.new(
25
+ active_count: 120,
26
+ trialing_count: 4,
27
+ past_due_count: 3,
28
+ canceling_count: 5,
29
+ new_count: 14,
30
+ ended_count: 3,
31
+ churn_rate: 0.025,
32
+ new_by_month: [3, 5, 8],
33
+ ended_by_month: [0, 1, 2],
34
+ active_by_month: [90, 104, 120],
35
+ mrr: null
36
+ )
37
+ ```
38
+
@@ -5,6 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **auto_refund** | **Boolean** | Whether canceling a license bought through Stripe refunds its payment. Can only be turned on when the integration's `canRefund` is true: the API key has the Refunds: Write permission. | [optional] |
8
+ | **subscription_grace_days** | **Integer** | Days a subscription license stays valid after its period ends while its renewal is unpaid, as Stripe retries the payment. | [optional] |
8
9
 
9
10
  ## Example
10
11
 
@@ -12,7 +13,8 @@
12
13
  require 'license_manager'
13
14
 
14
15
  instance = LicenseManager::UpdateIntegration.new(
15
- auto_refund: false
16
+ auto_refund: false,
17
+ subscription_grace_days: 7
16
18
  )
17
19
  ```
18
20
 
@@ -20,7 +20,7 @@ module LicenseManager
20
20
  @api_client = api_client
21
21
  end
22
22
  # Cancel a license
23
- # Cancels the license right away: validating its key then fails with `license_expired`, like an expired license, and its status is `canceled`. A cancellation can't be undone. Customers can cancel their licenses until their `cancellableUntil`, the end of their money back guarantee: tokens can't cancel a license past it, or without one. API keys and sessions can cancel any license. When the license was bought through the Stripe integration, its payment is refunded in the background, unless the integration disables `autoRefund`, its API key lacks the optional Refunds: Write permission (`canRefund`), or `refund` is `false`: the refund is its price paid, taxes included, and its id is set as `stripeRefundId`. The customer is emailed a confirmation, and the owners and admins of the organization are told about the cancellation and its refund. In test products, the customer is only emailed when their email is a member's of the organization. Records a `license.canceled` event, then a `license.refunded` or `license.refund_failed` one once the refund is done. **Token access**: customer, license tokens with the `license:cancel` permission (or the matching write one). A token reaches the license it's scoped to, or the licenses of its customer. **Required role permission**: `license:cancel` when called with a session, granted by the member's role. API keys aren't limited by roles.
23
+ # Cancels the license right away: validating its key then fails with `license_expired`, like an expired license, and its status is `canceled`. A cancellation can't be undone. Customers can cancel their licenses until their `cancellableUntil`, the end of their money back guarantee: tokens can't cancel a license past it, or without one. API keys and sessions can cancel any license. When the license was bought through the Stripe integration, its payment is refunded in the background, unless the integration disables `autoRefund`, its API key lacks the optional Refunds: Write permission (`canRefund`), or `refund` is `false`: the refund is its price paid, taxes included, and its id is set as `stripeRefundId`. The customer is emailed a confirmation, and the owners and admins of the organization are told about the cancellation and its refund. In test products, the customer is only emailed when their email is a member's of the organization. A subscription license isn't refunded: its Stripe subscription is canceled at once, without proration, which needs the integration's `canManageSubscriptions`. Records a `license.canceled` event, then a `license.refunded` or `license.refund_failed` one once the refund is done. **Token access**: customer, license tokens with the `license:cancel` permission (or the matching write one). A token reaches the license it's scoped to, or the licenses of its customer. **Required role permission**: `license:cancel` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
24
  # @param id [String]
25
25
  # @param cancel_license [CancelLicense]
26
26
  # @param [Hash] opts the optional parameters
@@ -31,7 +31,7 @@ module LicenseManager
31
31
  end
32
32
 
33
33
  # Cancel a license
34
- # Cancels the license right away: validating its key then fails with `license_expired`, like an expired license, and its status is `canceled`. A cancellation can't be undone. Customers can cancel their licenses until their `cancellableUntil`, the end of their money back guarantee: tokens can't cancel a license past it, or without one. API keys and sessions can cancel any license. When the license was bought through the Stripe integration, its payment is refunded in the background, unless the integration disables `autoRefund`, its API key lacks the optional Refunds: Write permission (`canRefund`), or `refund` is `false`: the refund is its price paid, taxes included, and its id is set as `stripeRefundId`. The customer is emailed a confirmation, and the owners and admins of the organization are told about the cancellation and its refund. In test products, the customer is only emailed when their email is a member's of the organization. Records a `license.canceled` event, then a `license.refunded` or `license.refund_failed` one once the refund is done. **Token access**: customer, license tokens with the `license:cancel` permission (or the matching write one). A token reaches the license it's scoped to, or the licenses of its customer. **Required role permission**: `license:cancel` when called with a session, granted by the member's role. API keys aren't limited by roles.
34
+ # Cancels the license right away: validating its key then fails with `license_expired`, like an expired license, and its status is `canceled`. A cancellation can't be undone. Customers can cancel their licenses until their `cancellableUntil`, the end of their money back guarantee: tokens can't cancel a license past it, or without one. API keys and sessions can cancel any license. When the license was bought through the Stripe integration, its payment is refunded in the background, unless the integration disables `autoRefund`, its API key lacks the optional Refunds: Write permission (`canRefund`), or `refund` is `false`: the refund is its price paid, taxes included, and its id is set as `stripeRefundId`. The customer is emailed a confirmation, and the owners and admins of the organization are told about the cancellation and its refund. In test products, the customer is only emailed when their email is a member's of the organization. A subscription license isn't refunded: its Stripe subscription is canceled at once, without proration, which needs the integration's `canManageSubscriptions`. Records a `license.canceled` event, then a `license.refunded` or `license.refund_failed` one once the refund is done. **Token access**: customer, license tokens with the `license:cancel` permission (or the matching write one). A token reaches the license it's scoped to, or the licenses of its customer. **Required role permission**: `license:cancel` when called with a session, granted by the member's role. API keys aren't limited by roles.
35
35
  # @param id [String]
36
36
  # @param cancel_license [CancelLicense]
37
37
  # @param [Hash] opts the optional parameters
@@ -420,7 +420,7 @@ module LicenseManager
420
420
  # @option opts [Integer] :page Page to return. Pages are numbered from 1: `1` is the first page. A page past the last one returns an empty `data`, not an error. Defaults to `1`. (default to 1)
421
421
  # @option opts [Integer] :page_size Maximum number of items per page, from 1 to 100. Every page holds this many items except the last one, which can hold fewer. Defaults to `20`. (default to 20)
422
422
  # @option opts [String] :sort Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. (default to '-createdAt')
423
- # @option opts [String] :search Case-insensitive text the key contains.
423
+ # @option opts [String] :search Case-insensitive text the key or the email of the customer contains.
424
424
  # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with `TEST-`.
425
425
  # @option opts [String] :policy_id Only returns the licenses following this policy.
426
426
  # @option opts [String] :machine_version Only returns the licenses with at least one active machine running this version of the product.
@@ -451,7 +451,7 @@ module LicenseManager
451
451
  # @option opts [Integer] :page Page to return. Pages are numbered from 1: `1` is the first page. A page past the last one returns an empty `data`, not an error. Defaults to `1`. (default to 1)
452
452
  # @option opts [Integer] :page_size Maximum number of items per page, from 1 to 100. Every page holds this many items except the last one, which can hold fewer. Defaults to `20`. (default to 20)
453
453
  # @option opts [String] :sort Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. (default to '-createdAt')
454
- # @option opts [String] :search Case-insensitive text the key contains.
454
+ # @option opts [String] :search Case-insensitive text the key or the email of the customer contains.
455
455
  # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with `TEST-`.
456
456
  # @option opts [String] :policy_id Only returns the licenses following this policy.
457
457
  # @option opts [String] :machine_version Only returns the licenses with at least one active machine running this version of the product.
@@ -582,7 +582,7 @@ module LicenseManager
582
582
  # @option opts [Integer] :page Page to return. Pages are numbered from 1: `1` is the first page. A page past the last one returns an empty `data`, not an error. Defaults to `1`. (default to 1)
583
583
  # @option opts [Integer] :page_size Maximum number of items per page, from 1 to 100. Every page holds this many items except the last one, which can hold fewer. Defaults to `20`. (default to 20)
584
584
  # @option opts [String] :sort Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. (default to '-createdAt')
585
- # @option opts [String] :search Case-insensitive text the key contains.
585
+ # @option opts [String] :search Case-insensitive text the key or the email of the customer contains.
586
586
  # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with `TEST-`.
587
587
  # @option opts [String] :policy_id Only returns the licenses following this policy.
588
588
  # @option opts [String] :customer_id Only returns the licenses of this customer.
@@ -614,7 +614,7 @@ module LicenseManager
614
614
  # @option opts [Integer] :page Page to return. Pages are numbered from 1: `1` is the first page. A page past the last one returns an empty `data`, not an error. Defaults to `1`. (default to 1)
615
615
  # @option opts [Integer] :page_size Maximum number of items per page, from 1 to 100. Every page holds this many items except the last one, which can hold fewer. Defaults to `20`. (default to 20)
616
616
  # @option opts [String] :sort Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. (default to '-createdAt')
617
- # @option opts [String] :search Case-insensitive text the key contains.
617
+ # @option opts [String] :search Case-insensitive text the key or the email of the customer contains.
618
618
  # @option opts [String] :key Only returns the license with this exact key, case included. Keys of test products start with `TEST-`.
619
619
  # @option opts [String] :policy_id Only returns the licenses following this policy.
620
620
  # @option opts [String] :customer_id Only returns the licenses of this customer.
@@ -19,6 +19,76 @@ module LicenseManager
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Open the Stripe customer portal of a customer
23
+ # Link to the Stripe customer portal of the customer's Stripe customer, where they manage their subscriptions: change their plan or payment method, see their invoices, cancel. Needs the Stripe integration's `canBillingPortal`, and the customer portal configured in the Stripe account's settings. The changes come back through the integration's webhook, keeping the subscription licenses in line. **Token access**: customer tokens with the `customer:billing` permission (or the matching write one). A customer token reaches its own customer. **Required role permission**: `portalLink:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
+ # @param id [String]
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [CreateBillingPortalSession] :create_billing_portal_session
27
+ # @return [BillingPortalSession]
28
+ def create_billing_portal_session(id, opts = {})
29
+ data, _status_code, _headers = create_billing_portal_session_with_http_info(id, opts)
30
+ data
31
+ end
32
+
33
+ # Open the Stripe customer portal of a customer
34
+ # Link to the Stripe customer portal of the customer's Stripe customer, where they manage their subscriptions: change their plan or payment method, see their invoices, cancel. Needs the Stripe integration's `canBillingPortal`, and the customer portal configured in the Stripe account's settings. The changes come back through the integration's webhook, keeping the subscription licenses in line. **Token access**: customer tokens with the `customer:billing` permission (or the matching write one). A customer token reaches its own customer. **Required role permission**: `portalLink:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
35
+ # @param id [String]
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [CreateBillingPortalSession] :create_billing_portal_session
38
+ # @return [Array<(BillingPortalSession, Integer, Hash)>] BillingPortalSession data, response status code and response headers
39
+ def create_billing_portal_session_with_http_info(id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: PortalApi.create_billing_portal_session ...'
42
+ end
43
+ # verify the required parameter 'id' is set
44
+ if @api_client.config.client_side_validation && id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'id' when calling PortalApi.create_billing_portal_session"
46
+ end
47
+ # resource path
48
+ local_var_path = '/v1/customers/{id}/billing-portal-sessions'.sub('{id}', CGI.escape(id.to_s))
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
57
+ # HTTP header 'Content-Type'
58
+ content_type = @api_client.select_header_content_type(['application/json'])
59
+ if !content_type.nil?
60
+ header_params['Content-Type'] = content_type
61
+ end
62
+
63
+ # form parameters
64
+ form_params = opts[:form_params] || {}
65
+
66
+ # http body (model)
67
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_billing_portal_session'])
68
+
69
+ # return_type
70
+ return_type = opts[:debug_return_type] || 'BillingPortalSession'
71
+
72
+ # auth_names
73
+ auth_names = opts[:debug_auth_names] || ['apiKey', 'token']
74
+
75
+ new_options = opts.merge(
76
+ :operation => :"PortalApi.create_billing_portal_session",
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: PortalApi#create_billing_portal_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
22
92
  # Create a link to the customer portal
23
93
  # Link letting the customer see their licenses, cancel them during their money back guarantee, and deactivate their machines in the customer portal, without signing in. Anyone with the link can, until it expires or the customer is deleted: it can't be revoked otherwise. The token also works with the API endpoints that accept customer tokens. Links can be created while the product's customer portal is disabled, but the portal answers `404` until it's enabled, and `sendPortalLink` refuses to email them. **Required role permission**: `portalLink:create` when called with a session, granted by the member's role. API keys aren't limited by roles.
24
94
  # @param id [String]
@@ -0,0 +1,178 @@
1
+ =begin
2
+ #LicenseManager API
3
+
4
+ #Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LicenseManager
17
+ class BillingPortalSession < ApiModelBase
18
+ # Link to the Stripe customer portal, to open right away: it expires shortly.
19
+ attr_accessor :url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'url' => :'url'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Returns attribute type mapping
52
+ def self.acceptable_openapi_types
53
+ openapi_types
54
+ end
55
+
56
+ # Returns the nullable attributes
57
+ def self.acceptable_openapi_nullable
58
+ openapi_nullable
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::BillingPortalSession` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::BillingPortalSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'url')
78
+ self.url = attributes[:'url']
79
+ else
80
+ self.url = nil
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ if @url.nil?
90
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ return false if @url.nil?
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] url Value to be assigned
106
+ def url=(url)
107
+ if url.nil?
108
+ fail ArgumentError, 'url cannot be nil'
109
+ end
110
+
111
+ @url = url
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ url == o.url
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [url].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ # include attributes inherited from allOf parents (the nearest declaration wins)
141
+ map = acceptable_attribute_map
142
+ transformed_hash = {}
143
+ acceptable_openapi_types.each_pair do |key, type|
144
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ # include attributes inherited from allOf parents (the nearest declaration wins)
164
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
165
+ value = self.send(attr)
166
+ if value.nil?
167
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
168
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
169
+ end
170
+
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ end
177
+
178
+ end
@@ -0,0 +1,161 @@
1
+ =begin
2
+ #LicenseManager API
3
+
4
+ #Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LicenseManager
17
+ class CreateBillingPortalSession < ApiModelBase
18
+ # Where the Stripe customer portal links back to: a page of the customer portal, or of one of the product's `returnDomains`. The customer portal of the product by default.
19
+ attr_accessor :return_url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'return_url' => :'returnUrl'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'return_url' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Returns attribute type mapping
52
+ def self.acceptable_openapi_types
53
+ openapi_types
54
+ end
55
+
56
+ # Returns the nullable attributes
57
+ def self.acceptable_openapi_nullable
58
+ openapi_nullable
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::CreateBillingPortalSession` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::CreateBillingPortalSession`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'return_url')
78
+ self.return_url = attributes[:'return_url']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ return_url == o.return_url
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [return_url].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ # include attributes inherited from allOf parents (the nearest declaration wins)
124
+ map = acceptable_attribute_map
125
+ transformed_hash = {}
126
+ acceptable_openapi_types.each_pair do |key, type|
127
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Returns the object in the form of hash
143
+ # @return [Hash] Returns the object in the form of hash
144
+ def to_hash
145
+ hash = {}
146
+ # include attributes inherited from allOf parents (the nearest declaration wins)
147
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
148
+ value = self.send(attr)
149
+ if value.nil?
150
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
151
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
152
+ end
153
+
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ end
160
+
161
+ end
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module LicenseManager
17
17
  class CreateIntegrationMapping < ApiModelBase
18
- # Active one-time price of the Stripe account.
18
+ # Active one-time or licensed recurring price of the Stripe account.
19
19
  attr_accessor :stripe_price_id
20
20
 
21
21
  attr_accessor :policy_id
@@ -24,11 +24,14 @@ module LicenseManager
24
24
  LICENSE_CANCELED = "license.canceled".freeze
25
25
  LICENSE_REFUNDED = "license.refunded".freeze
26
26
  LICENSE_REFUND_FAILED = "license.refund_failed".freeze
27
+ LICENSE_PAYMENT_SUCCEEDED = "license.payment_succeeded".freeze
28
+ LICENSE_PAYMENT_FAILED = "license.payment_failed".freeze
29
+ LICENSE_SUBSCRIPTION_ENDED = "license.subscription_ended".freeze
27
30
  MACHINE_DEACTIVATED = "machine.deactivated".freeze
28
31
  UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
29
32
 
30
33
  def self.all_vars
31
- @all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_FAILED, LICENSE_CANCELED, LICENSE_REFUNDED, LICENSE_REFUND_FAILED, MACHINE_DEACTIVATED, UNKNOWN_DEFAULT_OPEN_API].freeze
34
+ @all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_FAILED, LICENSE_CANCELED, LICENSE_REFUNDED, LICENSE_REFUND_FAILED, LICENSE_PAYMENT_SUCCEEDED, LICENSE_PAYMENT_FAILED, LICENSE_SUBSCRIPTION_ENDED, MACHINE_DEACTIVATED, UNKNOWN_DEFAULT_OPEN_API].freeze
32
35
  end
33
36
 
34
37
  # Builds the enum from string