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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bcf4262163e03a08877a9fcd90c3ca632ed44a53507b49fd7ec1791aeb9f09a
4
- data.tar.gz: d139d65dc28028b48968c2445fe26a2002d9a648cf786c07d4e74dcde28c4dbd
3
+ metadata.gz: 68a828b5a78c2e840be0a77b50d429b1e59e88714cbbe50436934eaffaf73435
4
+ data.tar.gz: 41bee49be6e3419467fc60612ed97e70c6888d579882a2422a9835ca75b87719
5
5
  SHA512:
6
- metadata.gz: 328ad38f8a2d30478b298c05c9adfcd98202fade7632455005bef6f535a7ca8a1e48bff28405963b2957f4ef40f5b12cf79e92dcfdac3bda13ecfb76fded9382
7
- data.tar.gz: b1366be4e6662bb272b916a1ac1f2bc72b7182a97bc0fa1824a01a05b4a27c4e216bff5af55426a6ccd0ffac466dedabb4f084b472c3cdd9f2d169e5e7f0d6b0
6
+ metadata.gz: 0b825e5dbe10c69b2ffbf8961e8d060a467612d1c12ccbcf23e078d9403ee5306bd388121fdebdb0c3d309c3adbc470c86c0183c4c62a2352078df2c83349648
7
+ data.tar.gz: f077da231328da5cb860b63972bd9508ef959373ff91d4cc83a77cbc626fdc8bdfe4a56b1978729bf5366384a08c53647059e0a9bb6b429102352eb8f2ffc960
data/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1 (2026-11-04)
4
+
5
+ ### Changes
6
+
7
+ - `GET /v1/customers/{customerId}/licenses`: added the required property `data/items/customer` to the response with the `200` status
8
+ - `GET /v1/licenses/{id}`: added the required property `customer` to the response with the `200` status
9
+ - `PATCH /v1/licenses/{id}`: added the required property `customer` to the response with the `200` status
10
+ - `POST /v1/licenses/{id}/cancel`: added the required property `customer` to the response with the `200` status
11
+ - `GET /v1/products/{productId}/licenses`: added the required property `data/items/customer` to the response with the `200` status
12
+ - `POST /v1/products/{productId}/licenses`: added the required property `customer` to the response with the `201` status
13
+
14
+ ## 0.3.0 (2026-10-27)
15
+
16
+ ### Breaking changes
17
+
18
+ - `POST /v1/customers/{id}/tokens`: added the new `customer:billing` enum value to the `scope/items/` response property for the response status `201`
19
+ - `GET /v1/licenses/{id}/events`: added the new `license.payment_failed` enum value to the `data/items/type` response property for the response status `200`
20
+ - `GET /v1/licenses/{id}/events`: added the new `license.payment_succeeded` enum value to the `data/items/type` response property for the response status `200`
21
+ - `GET /v1/licenses/{id}/events`: added the new `license.subscription_ended` enum value to the `data/items/type` response property for the response status `200`
22
+ - `POST /v1/licenses/{id}/tokens`: added the new `customer:billing` enum value to the `scope/items/` response property for the response status `201`
23
+ - `POST /v1/machines/{id}/tokens`: added the new `customer:billing` enum value to the `scope/items/` response property for the response status `201`
24
+ - `GET /v1/policies/{id}/events`: added the new `license.payment_failed` enum value to the `data/items/type` response property for the response status `200`
25
+ - `GET /v1/policies/{id}/events`: added the new `license.payment_succeeded` enum value to the `data/items/type` response property for the response status `200`
26
+ - `GET /v1/policies/{id}/events`: added the new `license.subscription_ended` enum value to the `data/items/type` response property for the response status `200`
27
+
28
+ ### Changes
29
+
30
+ - `GET /v1/customers/{customerId}/licenses`: added the required property `data/items/subscription` to the response with the `200` status
31
+ - `POST /v1/customers/{id}/billing-portal-sessions`: endpoint added
32
+ - `POST /v1/customers/{id}/tokens`: added the new `customer:billing` enum value to the request property `scope/items/`
33
+ - `PATCH /v1/integration-mappings/{id}`: added the required property `recurring` to the response with the `200` status
34
+ - `PATCH /v1/integrations/{id}`: added the new optional request property `subscriptionGraceDays`
35
+ - `PATCH /v1/integrations/{id}`: added the required property `canBillingPortal` to the response with the `200` status
36
+ - `PATCH /v1/integrations/{id}`: added the required property `canManageSubscriptions` to the response with the `200` status
37
+ - `PATCH /v1/integrations/{id}`: added the required property `subscriptionGraceDays` to the response with the `200` status
38
+ - `POST /v1/integrations/{id}/check`: added the required property `canBillingPortal` to the response with the `200` status
39
+ - `POST /v1/integrations/{id}/check`: added the required property `canManageSubscriptions` to the response with the `200` status
40
+ - `POST /v1/integrations/{id}/check`: added the required property `subscriptionGraceDays` to the response with the `200` status
41
+ - `GET /v1/integrations/{id}/stripe/prices`: added the required property `data/items/recurring` to the response with the `200` status
42
+ - `GET /v1/licenses/{id}`: added the required property `subscription` to the response with the `200` status
43
+ - `PATCH /v1/licenses/{id}`: added the non-success response with the status `409`
44
+ - `PATCH /v1/licenses/{id}`: added the required property `subscription` to the response with the `200` status
45
+ - `POST /v1/licenses/{id}/cancel`: added the required property `subscription` to the response with the `200` status
46
+ - `GET /v1/licenses/{id}/events`: added the enum value `license.payment_failed` to the property `anyOf[#/components/schemas/EventType]/` of the `query` request parameter `type` (shared schema: `EventType`, also at `anyOf[#/components/schemas/EventType]`, `anyOf[subschema #2]/items`)
47
+ - `GET /v1/licenses/{id}/events`: added the enum value `license.payment_succeeded` to the property `anyOf[#/components/schemas/EventType]/` of the `query` request parameter `type` (shared schema: `EventType`, also at `anyOf[#/components/schemas/EventType]`, `anyOf[subschema #2]/items`)
48
+ - `GET /v1/licenses/{id}/events`: added the enum value `license.subscription_ended` to the property `anyOf[#/components/schemas/EventType]/` of the `query` request parameter `type` (shared schema: `EventType`, also at `anyOf[#/components/schemas/EventType]`, `anyOf[subschema #2]/items`)
49
+ - `POST /v1/licenses/{id}/tokens`: added the new `customer:billing` enum value to the request property `scope/items/`
50
+ - `POST /v1/machines/{id}/tokens`: added the new `customer:billing` enum value to the request property `scope/items/`
51
+ - `GET /v1/policies/{id}/events`: added the enum value `license.payment_failed` to the property `anyOf[#/components/schemas/EventType]/` of the `query` request parameter `type` (shared schema: `EventType`, also at `anyOf[#/components/schemas/EventType]`, `anyOf[subschema #2]/items`)
52
+ - `GET /v1/policies/{id}/events`: added the enum value `license.payment_succeeded` to the property `anyOf[#/components/schemas/EventType]/` of the `query` request parameter `type` (shared schema: `EventType`, also at `anyOf[#/components/schemas/EventType]`, `anyOf[subschema #2]/items`)
53
+ - `GET /v1/policies/{id}/events`: added the enum value `license.subscription_ended` to the property `anyOf[#/components/schemas/EventType]/` of the `query` request parameter `type` (shared schema: `EventType`, also at `anyOf[#/components/schemas/EventType]`, `anyOf[subschema #2]/items`)
54
+ - `GET /v1/products/{id}/stats`: added the required property `revenue/items/paymentCount` to the response with the `200` status
55
+ - `GET /v1/products/{id}/stats`: added the required property `revenue/items/subscriptionTotal` to the response with the `200` status
56
+ - `GET /v1/products/{id}/stats`: added the required property `subscriptions` to the response with the `200` status
57
+ - `GET /v1/products/{productId}/integrations/stripe`: added the required property `integration/anyOf[#/components/schemas/Integration]/canBillingPortal` to the response with the `200` status
58
+ - `GET /v1/products/{productId}/integrations/stripe`: added the required property `integration/anyOf[#/components/schemas/Integration]/canManageSubscriptions` to the response with the `200` status
59
+ - `GET /v1/products/{productId}/integrations/stripe`: added the required property `integration/anyOf[#/components/schemas/Integration]/subscriptionGraceDays` to the response with the `200` status
60
+ - `GET /v1/products/{productId}/integrations/stripe`: added the required property `mappings/items/recurring` to the response with the `200` status
61
+ - `GET /v1/products/{productId}/integrations/stripe`: added the required property `requiredPermissions/items/subscriptions` to the response with the `200` status
62
+ - `PUT /v1/products/{productId}/integrations/stripe`: added the required property `integration/anyOf[#/components/schemas/Integration]/canBillingPortal` to the response with the `200` status
63
+ - `PUT /v1/products/{productId}/integrations/stripe`: added the required property `integration/anyOf[#/components/schemas/Integration]/canManageSubscriptions` to the response with the `200` status
64
+ - `PUT /v1/products/{productId}/integrations/stripe`: added the required property `integration/anyOf[#/components/schemas/Integration]/subscriptionGraceDays` to the response with the `200` status
65
+ - `PUT /v1/products/{productId}/integrations/stripe`: added the required property `mappings/items/recurring` to the response with the `200` status
66
+ - `PUT /v1/products/{productId}/integrations/stripe`: added the required property `requiredPermissions/items/subscriptions` to the response with the `200` status
67
+ - `POST /v1/products/{productId}/integrations/stripe/mappings`: added the required property `recurring` to the response with the `201` status
68
+ - `GET /v1/products/{productId}/licenses`: added the required property `data/items/subscription` to the response with the `200` status
69
+ - `POST /v1/products/{productId}/licenses`: added the required property `subscription` to the response with the `201` status
70
+
3
71
  ## 0.2.0 (2026-10-27)
4
72
 
5
73
  ### Breaking changes
data/README.md CHANGED
@@ -77,7 +77,7 @@ Every method is documented, with its parameters and responses, in the [`docs`](d
77
77
  | Class | Methods |
78
78
  | --- | --- |
79
79
  | [`LicensesApi`](docs/LicensesApi.md) | `validate_key`, `list_licenses`, `create_license`, `list_customer_licenses`, `get_license`, `delete_license`, `update_license`, `get_license_stats`, `cancel_license`, `send_license_keys`, `get_signing_key` |
80
- | [`PortalApi`](docs/PortalApi.md) | `get_portal`, `request_portal_link`, `create_portal_link`, `send_portal_link` |
80
+ | [`PortalApi`](docs/PortalApi.md) | `get_portal`, `request_portal_link`, `create_portal_link`, `create_billing_portal_session`, `send_portal_link` |
81
81
  | [`ProductsApi`](docs/ProductsApi.md) | `list_products`, `create_product`, `get_product`, `delete_product`, `update_product`, `reset_product`, `upload_product_logo`, `delete_product_logo`, `get_product_stats` |
82
82
  | [`PoliciesApi`](docs/PoliciesApi.md) | `list_policies`, `create_policy`, `get_policy`, `delete_policy`, `update_policy` |
83
83
  | [`CustomersApi`](docs/CustomersApi.md) | `list_customers`, `create_customer`, `get_customer`, `delete_customer`, `update_customer` |
@@ -0,0 +1,18 @@
1
+ # LicenseManager::BillingPortalSession
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **url** | **String** | Link to the Stripe customer portal, to open right away: it expires shortly. | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'license_manager'
13
+
14
+ instance = LicenseManager::BillingPortalSession.new(
15
+ url: https://billing.stripe.com/p/session/test_YWNjdF8x
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # LicenseManager::CreateBillingPortalSession
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **return_url** | **String** | 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. | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'license_manager'
13
+
14
+ instance = LicenseManager::CreateBillingPortalSession.new(
15
+ return_url: https://example.com/account
16
+ )
17
+ ```
18
+
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **stripe_price_id** | **String** | Active one-time price of the Stripe account. | |
7
+ | **stripe_price_id** | **String** | Active one-time or licensed recurring price of the Stripe account. | |
8
8
  | **policy_id** | **String** | | |
9
9
 
10
10
  ## Example
data/docs/Integration.md CHANGED
@@ -16,6 +16,9 @@
16
16
  | **last_event_at** | **Time** | Last time it received an event from the provider. | |
17
17
  | **auto_refund** | **Boolean** | Whether canceling a license bought through Stripe refunds its payment. On by default, always off when `canRefund` is false. | |
18
18
  | **can_refund** | **Boolean** | Whether the API key has the optional Refunds: Write permission, checked when connecting and every day. Without it, canceled licenses aren't refunded: refund their payments from Stripe. | |
19
+ | **can_manage_subscriptions** | **Boolean** | Whether the API key has the optional Subscriptions: Write permission, checked when connecting and every day. Without it, subscription licenses can't be canceled from the app: cancel their subscriptions from Stripe. | |
20
+ | **can_billing_portal** | **Boolean** | Whether the API key has the optional Customer portal: Write permission, checked when connecting and every day. Without it, the license portal doesn't link to the Stripe customer portal. | |
21
+ | **subscription_grace_days** | **Integer** | Days a subscription license stays valid after its period ends while its renewal is unpaid, as Stripe retries the payment. 7 by default. | |
19
22
  | **created_at** | **Time** | | |
20
23
 
21
24
  ## Example
@@ -36,6 +39,9 @@ instance = LicenseManager::Integration.new(
36
39
  last_event_at: null,
37
40
  auto_refund: true,
38
41
  can_refund: true,
42
+ can_manage_subscriptions: true,
43
+ can_billing_portal: true,
44
+ subscription_grace_days: 7,
39
45
  created_at: null
40
46
  )
41
47
  ```
@@ -12,6 +12,7 @@
12
12
  | **stripe_price_id** | **String** | | |
13
13
  | **product_name** | **String** | Name of the Stripe product when it was mapped. | |
14
14
  | **price** | [**Price**](Price.md) | | |
15
+ | **recurring** | [**IntegrationMappingRecurring**](IntegrationMappingRecurring.md) | | |
15
16
  | **status** | **String** | `error` when the price can no longer be paid, explained by `statusReason`. | |
16
17
  | **status_reason** | **String** | | |
17
18
  | **created_at** | **Time** | | |
@@ -30,6 +31,7 @@ instance = LicenseManager::IntegrationMapping.new(
30
31
  stripe_price_id: price_1MoBy5LkdIwHu7ix,
31
32
  product_name: Acme Pro,
32
33
  price: null,
34
+ recurring: null,
33
35
  status: null,
34
36
  status_reason: The price is archived in Stripe,
35
37
  created_at: null
@@ -0,0 +1,20 @@
1
+ # LicenseManager::IntegrationMappingRecurring
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **interval** | **String** | | |
8
+ | **interval_count** | **Integer** | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'license_manager'
14
+
15
+ instance = LicenseManager::IntegrationMappingRecurring.new(
16
+ interval: null,
17
+ interval_count: 1
18
+ )
19
+ ```
20
+
data/docs/License.md CHANGED
@@ -8,6 +8,7 @@
8
8
  | **product_id** | **String** | | |
9
9
  | **policy_id** | **String** | | |
10
10
  | **customer_id** | **String** | | |
11
+ | **customer** | [**LicenseCustomer**](LicenseCustomer.md) | | |
11
12
  | **key** | **String** | Unique within the product. Case sensitive: `validateKey` compares keys exactly. | |
12
13
  | **created_at** | **Time** | | |
13
14
  | **expires_at** | **Time** | `null` when the license never expires. | |
@@ -23,6 +24,7 @@
23
24
  | **cancellable_until** | **Time** | End of the money back guarantee: until then, the customer can cancel the license from the customer portal, or with a token. Set from the policy's `moneyBackGuaranteeDays` when the license is created. `null` when the customer can't cancel it. | |
24
25
  | **canceled_at** | **Time** | When the license was canceled: validating its key fails since. `null` when it wasn't. | |
25
26
  | **cancellation_reason** | [**CancellationReason**](CancellationReason.md) | | |
27
+ | **subscription** | [**LicenseSubscription**](LicenseSubscription.md) | | |
26
28
  | **cancellation_comment** | **String** | Comment given when the license was canceled. `null` when there's none. | |
27
29
  | **stripe_refund_id** | **String** | Id of the Stripe refund of the license's payment once it was canceled, through the Stripe integration. `null` otherwise. | |
28
30
  | **updated_at** | **Time** | Last time the license's settings were edited, not when its key was validated. | |
@@ -37,6 +39,7 @@ instance = LicenseManager::License.new(
37
39
  product_id: x7Kp2QaZ,
38
40
  policy_id: p4Rt8LmQ,
39
41
  customer_id: c9Wd3RtE,
42
+ customer: null,
40
43
  key: 7KQ2M-X9ZPA-H4TRC-WN6EY-B3JDF,
41
44
  created_at: 2026-01-15T09:30:00.000Z,
42
45
  expires_at: 2027-01-15T09:30:00.000Z,
@@ -52,6 +55,7 @@ instance = LicenseManager::License.new(
52
55
  cancellable_until: 2026-02-14T09:30:00.000Z,
53
56
  canceled_at: 2026-01-20T16:12:00.000Z,
54
57
  cancellation_reason: null,
58
+ subscription: null,
55
59
  cancellation_comment: I only needed it for one project.,
56
60
  stripe_refund_id: re_3MtwBwLkdIwHu7ix0Bs5rA2b,
57
61
  updated_at: 2026-01-15T09:30:00.000Z
@@ -0,0 +1,22 @@
1
+ # LicenseManager::LicenseCustomer
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | |
8
+ | **email** | **String** | | |
9
+ | **name** | **String** | Display name of the customer. `null` when unknown. | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'license_manager'
15
+
16
+ instance = LicenseManager::LicenseCustomer.new(
17
+ id: c9Wd3RtE,
18
+ email: jane@example.com,
19
+ name: Jane Doe
20
+ )
21
+ ```
22
+
@@ -0,0 +1,34 @@
1
+ # LicenseManager::LicenseSubscription
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **stripe_subscription_id** | **String** | | |
8
+ | **status** | **String** | Status of the subscription in Stripe: `active`, `trialing`, `past_due` while a failed payment is retried, `canceled`, `unpaid`, `paused`, `incomplete` or `incomplete_expired`. | |
9
+ | **interval** | **String** | | |
10
+ | **interval_count** | **Integer** | Number of intervals between payments. | |
11
+ | **quantity** | **Integer** | Units subscribed, multiplying the policy's machines. | |
12
+ | **price** | [**Price**](Price.md) | Price of one unit for one period, before taxes. | |
13
+ | **current_period_end** | **Time** | End of the paid period, when the subscription renews or ends. | |
14
+ | **cancel_at_period_end** | **Boolean** | Whether the subscription ends at the end of the period. | |
15
+ | **ended_at** | **Time** | | |
16
+
17
+ ## Example
18
+
19
+ ```ruby
20
+ require 'license_manager'
21
+
22
+ instance = LicenseManager::LicenseSubscription.new(
23
+ stripe_subscription_id: sub_1MowQVLkdIwHu7ix,
24
+ status: active,
25
+ interval: null,
26
+ interval_count: 1,
27
+ quantity: 1,
28
+ price: null,
29
+ current_period_end: null,
30
+ cancel_at_period_end: null,
31
+ ended_at: null
32
+ )
33
+ ```
34
+
data/docs/LicensesApi.md CHANGED
@@ -23,7 +23,7 @@ All URIs are relative to *https://api.licensemanager.dev*
23
23
 
24
24
  Cancel a license
25
25
 
26
- 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.
26
+ 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.
27
27
 
28
28
  ### Examples
29
29
 
@@ -479,7 +479,7 @@ opts = {
479
479
  page: 1, # Integer | 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`.
480
480
  page_size: 20, # Integer | 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`.
481
481
  sort: 'key', # String | Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`.
482
- search: 'X9ZPA', # String | Case-insensitive text the key contains.
482
+ search: 'X9ZPA', # String | Case-insensitive text the key or the email of the customer contains.
483
483
  key: '7KQ2M-X9ZPA-H4TRC-WN6EY-B3JDF', # String | Only returns the license with this exact key, case included. Keys of test products start with `TEST-`.
484
484
  policy_id: 'p4Rt8LmQ', # String | Only returns the licenses following this policy.
485
485
  machine_version: '2.3.1', # String | Only returns the licenses with at least one active machine running this version of the product.
@@ -534,7 +534,7 @@ end
534
534
  | **page** | **Integer** | 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`. | [optional][default to 1] |
535
535
  | **page_size** | **Integer** | 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`. | [optional][default to 20] |
536
536
  | **sort** | **String** | Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. | [optional][default to '-createdAt'] |
537
- | **search** | **String** | Case-insensitive text the key contains. | [optional] |
537
+ | **search** | **String** | Case-insensitive text the key or the email of the customer contains. | [optional] |
538
538
  | **key** | **String** | Only returns the license with this exact key, case included. Keys of test products start with `TEST-`. | [optional] |
539
539
  | **policy_id** | **String** | Only returns the licenses following this policy. | [optional] |
540
540
  | **machine_version** | **String** | Only returns the licenses with at least one active machine running this version of the product. | [optional] |
@@ -594,7 +594,7 @@ opts = {
594
594
  page: 1, # Integer | 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`.
595
595
  page_size: 20, # Integer | 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`.
596
596
  sort: 'key', # String | Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`.
597
- search: 'X9ZPA', # String | Case-insensitive text the key contains.
597
+ search: 'X9ZPA', # String | Case-insensitive text the key or the email of the customer contains.
598
598
  key: '7KQ2M-X9ZPA-H4TRC-WN6EY-B3JDF', # String | Only returns the license with this exact key, case included. Keys of test products start with `TEST-`.
599
599
  policy_id: 'p4Rt8LmQ', # String | Only returns the licenses following this policy.
600
600
  customer_id: 'c9Wd3RtE', # String | Only returns the licenses of this customer.
@@ -650,7 +650,7 @@ end
650
650
  | **page** | **Integer** | 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`. | [optional][default to 1] |
651
651
  | **page_size** | **Integer** | 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`. | [optional][default to 20] |
652
652
  | **sort** | **String** | Field to sort by, prefixed with `-` for descending order. Defaults to `-createdAt`. | [optional][default to '-createdAt'] |
653
- | **search** | **String** | Case-insensitive text the key contains. | [optional] |
653
+ | **search** | **String** | Case-insensitive text the key or the email of the customer contains. | [optional] |
654
654
  | **key** | **String** | Only returns the license with this exact key, case included. Keys of test products start with `TEST-`. | [optional] |
655
655
  | **policy_id** | **String** | Only returns the licenses following this policy. | [optional] |
656
656
  | **customer_id** | **String** | Only returns the licenses of this customer. | [optional] |
data/docs/Mrr.md ADDED
@@ -0,0 +1,26 @@
1
+ # LicenseManager::Mrr
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **currency** | **String** | | |
8
+ | **mrr** | **Float** | Monthly recurring revenue: the price of every ongoing subscription in the currency, times its quantity, brought to one month (a year counts for a twelfth), before taxes and discounts. | |
9
+ | **by_interval** | [**Array<MrrByIntervalInner>**](MrrByIntervalInner.md) | Ongoing subscriptions and MRR of each billing period, like monthly and yearly, from the highest MRR. | |
10
+ | **by_policy** | [**Array<MrrByPolicyInner>**](MrrByPolicyInner.md) | MRR of each policy, from the highest. | |
11
+ | **by_month** | **Array<Float>** | MRR at the end of each month, aligned on `months`, today for this month, at the current prices of the subscriptions. | |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'license_manager'
17
+
18
+ instance = LicenseManager::Mrr.new(
19
+ currency: USD,
20
+ mrr: 1240,
21
+ by_interval: null,
22
+ by_policy: null,
23
+ by_month: [900, 1100, 1240]
24
+ )
25
+ ```
26
+
@@ -0,0 +1,24 @@
1
+ # LicenseManager::MrrByIntervalInner
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **interval** | **String** | | |
8
+ | **interval_count** | **Integer** | | |
9
+ | **subscription_count** | **Integer** | | |
10
+ | **mrr** | **Float** | | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'license_manager'
16
+
17
+ instance = LicenseManager::MrrByIntervalInner.new(
18
+ interval: null,
19
+ interval_count: 1,
20
+ subscription_count: 80,
21
+ mrr: 800
22
+ )
23
+ ```
24
+
@@ -0,0 +1,22 @@
1
+ # LicenseManager::MrrByPolicyInner
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **policy_id** | **String** | | |
8
+ | **subscription_count** | **Integer** | | |
9
+ | **mrr** | **Float** | | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'license_manager'
15
+
16
+ instance = LicenseManager::MrrByPolicyInner.new(
17
+ policy_id: p4Rt8LmQ,
18
+ subscription_count: 80,
19
+ mrr: 800
20
+ )
21
+ ```
22
+
data/docs/PortalApi.md CHANGED
@@ -4,12 +4,91 @@ All URIs are relative to *https://api.licensemanager.dev*
4
4
 
5
5
  | Method | HTTP request | Description |
6
6
  | ------ | ------------ | ----------- |
7
+ | [**create_billing_portal_session**](PortalApi.md#create_billing_portal_session) | **POST** /v1/customers/{id}/billing-portal-sessions | Open the Stripe customer portal of a customer |
7
8
  | [**create_portal_link**](PortalApi.md#create_portal_link) | **POST** /v1/customers/{id}/portal-links | Create a link to the customer portal |
8
9
  | [**get_portal**](PortalApi.md#get_portal) | **GET** /v1/portal/{productId} | Get the customer portal of a product |
9
10
  | [**request_portal_link**](PortalApi.md#request_portal_link) | **POST** /v1/portal/{productId}/request-link | Email a link to the customer portal |
10
11
  | [**send_portal_link**](PortalApi.md#send_portal_link) | **POST** /v1/customers/{id}/portal-links/send | Email a link to the customer portal to the customer |
11
12
 
12
13
 
14
+ ## create_billing_portal_session
15
+
16
+ > <BillingPortalSession> create_billing_portal_session(id, opts)
17
+
18
+ Open the Stripe customer portal of a customer
19
+
20
+ 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.
21
+
22
+ ### Examples
23
+
24
+ ```ruby
25
+ require 'time'
26
+ require 'license_manager'
27
+ # setup authorization
28
+ LicenseManager.configure do |config|
29
+ # Configure API key authorization: apiKey
30
+ config.api_key['x-api-key'] = 'YOUR API KEY'
31
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
32
+ # config.api_key_prefix['x-api-key'] = 'Bearer'
33
+
34
+ # Configure Bearer authorization (JWT): token
35
+ config.access_token = 'YOUR_BEARER_TOKEN'
36
+ end
37
+
38
+ api_instance = LicenseManager::PortalApi.new
39
+ id = 'c9Wd3RtE' # String |
40
+ opts = {
41
+ create_billing_portal_session: LicenseManager::CreateBillingPortalSession.new # CreateBillingPortalSession |
42
+ }
43
+
44
+ begin
45
+ # Open the Stripe customer portal of a customer
46
+ result = api_instance.create_billing_portal_session(id, opts)
47
+ p result
48
+ rescue LicenseManager::ApiError => e
49
+ puts "Error when calling PortalApi->create_billing_portal_session: #{e}"
50
+ end
51
+ ```
52
+
53
+ #### Using the create_billing_portal_session_with_http_info variant
54
+
55
+ This returns an Array which contains the response data, status code and headers.
56
+
57
+ > <Array(<BillingPortalSession>, Integer, Hash)> create_billing_portal_session_with_http_info(id, opts)
58
+
59
+ ```ruby
60
+ begin
61
+ # Open the Stripe customer portal of a customer
62
+ data, status_code, headers = api_instance.create_billing_portal_session_with_http_info(id, opts)
63
+ p status_code # => 2xx
64
+ p headers # => { ... }
65
+ p data # => <BillingPortalSession>
66
+ rescue LicenseManager::ApiError => e
67
+ puts "Error when calling PortalApi->create_billing_portal_session_with_http_info: #{e}"
68
+ end
69
+ ```
70
+
71
+ ### Parameters
72
+
73
+ | Name | Type | Description | Notes |
74
+ | ---- | ---- | ----------- | ----- |
75
+ | **id** | **String** | | |
76
+ | **create_billing_portal_session** | [**CreateBillingPortalSession**](CreateBillingPortalSession.md) | | [optional] |
77
+
78
+ ### Return type
79
+
80
+ [**BillingPortalSession**](BillingPortalSession.md)
81
+
82
+ ### Authorization
83
+
84
+ [apiKey](../README.md#apiKey), [token](../README.md#token)
85
+
86
+ ### HTTP request headers
87
+
88
+ - **Content-Type**: application/json
89
+ - **Accept**: application/json
90
+
91
+
13
92
  ## create_portal_link
14
93
 
15
94
  > <PortalLink> create_portal_link(id, create_portal_link)
data/docs/ProductStats.md CHANGED
@@ -20,6 +20,7 @@
20
20
  | **new_licenses_by_month** | **Array&lt;Integer&gt;** | Number of licenses created each month, aligned on &#x60;months&#x60;. | |
21
21
  | **new_licenses_by_policy** | [**Array&lt;ProductStatsNewLicensesByPolicyInner&gt;**](ProductStatsNewLicensesByPolicyInner.md) | Number of licenses of each policy created each day and each month, for the policies with licenses created over the covered months. | |
22
22
  | **cancellation** | [**CancellationStats**](CancellationStats.md) | Cancellations of the licenses with a money back guarantee. &#x60;null&#x60; when no license of the product has one. | |
23
+ | **subscriptions** | [**SubscriptionStats**](SubscriptionStats.md) | Subscriptions of the product. &#x60;null&#x60; when it has never had one. | |
23
24
  | **revenue** | [**Array&lt;Revenue&gt;**](Revenue.md) | Revenue in each currency licenses were sold in, from the one with the most licenses sold. Amounts aren&#39;t converted between currencies. | |
24
25
  | **activations_by_version** | [**Array&lt;ProductStatsActivationsByVersionInner&gt;**](ProductStatsActivationsByVersionInner.md) | Successful activations of the licenses of the product each day, per version of the application, from the most recent one. | |
25
26
  | **active_machines_by_version** | [**Array&lt;ProductStatsActiveMachinesByVersionInner&gt;**](ProductStatsActiveMachinesByVersionInner.md) | Number of active machines running each version of the application, from the most recent one. | |
@@ -47,6 +48,7 @@ instance = LicenseManager::ProductStats.new(
47
48
  new_licenses_by_month: [4, 9, 12],
48
49
  new_licenses_by_policy: null,
49
50
  cancellation: null,
51
+ subscriptions: null,
50
52
  revenue: null,
51
53
  activations_by_version: null,
52
54
  active_machines_by_version: null,
data/docs/Revenue.md CHANGED
@@ -5,10 +5,12 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **currency** | **String** | ISO 4217 code of the currency of the revenue. | |
8
- | **license_count** | **Integer** | Number of licenses sold in the currency, free ones included, canceled ones left out. | |
9
- | **total** | **Float** | Sum of the prices of the licenses sold in the currency, in major units, canceled ones left out. | |
10
- | **canceled_license_count** | **Integer** | Number of canceled licenses sold in the currency. | |
11
- | **canceled_total** | **Float** | Sum of the prices of the canceled licenses sold in the currency, in major units: revenue lost to cancellations. | |
8
+ | **license_count** | **Integer** | Number of licenses sold once in the currency, free ones included, canceled ones and subscription licenses left out. | |
9
+ | **total** | **Float** | Revenue in the currency, in major units: the prices of the licenses sold once, canceled ones left out, plus the payments of the subscriptions, &#x60;subscriptionTotal&#x60;. | |
10
+ | **subscription_total** | **Float** | Sum of the payments of the subscription licenses in the currency, before taxes, in major units. | |
11
+ | **payment_count** | **Integer** | Number of payments of the subscription licenses in the currency. | |
12
+ | **canceled_license_count** | **Integer** | Number of canceled licenses sold once in the currency. | |
13
+ | **canceled_total** | **Float** | Sum of the prices of the canceled licenses sold once in the currency, in major units: revenue lost to cancellations. | |
12
14
  | **this_month** | **Float** | Revenue of the current month, in UTC. | |
13
15
  | **last_month** | **Float** | Revenue of the previous month, in UTC. | |
14
16
  | **last30_days** | **Float** | Revenue of the last 30 days, today included, in UTC. | |
@@ -25,6 +27,8 @@ instance = LicenseManager::Revenue.new(
25
27
  currency: USD,
26
28
  license_count: 42,
27
29
  total: 2099.58,
30
+ subscription_total: 480,
31
+ payment_count: 48,
28
32
  canceled_license_count: 2,
29
33
  canceled_total: 99.98,
30
34
  this_month: 349.93,
@@ -8,6 +8,7 @@
8
8
  | **access** | **String** | | |
9
9
  | **reason** | **String** | | |
10
10
  | **optional** | **Boolean** | Whether the key can connect without it, losing what it&#39;s for, explained by &#x60;reason&#x60;. | |
11
+ | **subscriptions** | **Boolean** | Whether it&#39;s only needed to sell subscriptions: checked once a recurring price is mapped. | |
11
12
 
12
13
  ## Example
13
14
 
@@ -18,7 +19,8 @@ instance = LicenseManager::StripePermission.new(
18
19
  resource: Prices,
19
20
  access: null,
20
21
  reason: Lists your prices so you can choose which ones create licenses, and checks they can still be paid.,
21
- optional: false
22
+ optional: false,
23
+ subscriptions: false
22
24
  )
23
25
  ```
24
26
 
data/docs/StripePrice.md CHANGED
@@ -9,6 +9,7 @@
9
9
  | **product_name** | **String** | | |
10
10
  | **nickname** | **String** | | |
11
11
  | **price** | [**Price**](Price.md) | | |
12
+ | **recurring** | [**StripePriceRecurring**](StripePriceRecurring.md) | | |
12
13
  | **mapped** | **Boolean** | Whether the price already creates licenses of a product. | |
13
14
 
14
15
  ## Example
@@ -22,6 +23,7 @@ instance = LicenseManager::StripePrice.new(
22
23
  product_name: Acme Pro,
23
24
  nickname: Launch price,
24
25
  price: null,
26
+ recurring: null,
25
27
  mapped: null
26
28
  )
27
29
  ```
@@ -0,0 +1,20 @@
1
+ # LicenseManager::StripePriceRecurring
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **interval** | **String** | | |
8
+ | **interval_count** | **Integer** | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'license_manager'
14
+
15
+ instance = LicenseManager::StripePriceRecurring.new(
16
+ interval: null,
17
+ interval_count: 1
18
+ )
19
+ ```
20
+