metronome-sdk 3.4.0 → 3.6.0

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +84 -0
  3. data/README.md +1 -1
  4. data/lib/metronome_sdk/client.rb +15 -1
  5. data/lib/metronome_sdk/internal/transport/base_client.rb +2 -0
  6. data/lib/metronome_sdk/internal/util.rb +22 -7
  7. data/lib/metronome_sdk/models/base_threshold_commit.rb +10 -1
  8. data/lib/metronome_sdk/models/contract_v2.rb +443 -15
  9. data/lib/metronome_sdk/models/credit.rb +74 -4
  10. data/lib/metronome_sdk/models/override.rb +9 -8
  11. data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration.rb +27 -1
  12. data/lib/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rb +28 -2
  13. data/lib/metronome_sdk/models/spend_threshold_configuration.rb +26 -1
  14. data/lib/metronome_sdk/models/spend_threshold_configuration_v2.rb +30 -4
  15. data/lib/metronome_sdk/models/update_base_threshold_commit.rb +11 -1
  16. data/lib/metronome_sdk/models/v1/alert_create_params.rb +1 -0
  17. data/lib/metronome_sdk/models/v1/contract_amend_params.rb +2 -189
  18. data/lib/metronome_sdk/models/v1/contract_create_params.rb +3 -191
  19. data/lib/metronome_sdk/models/v1/contract_list_seat_balances_params.rb +119 -0
  20. data/lib/metronome_sdk/models/v1/contract_list_seat_balances_response.rb +315 -0
  21. data/lib/metronome_sdk/models/v1/contracts/product_create_params.rb +31 -1
  22. data/lib/metronome_sdk/models/v1/contracts/product_update_params.rb +31 -1
  23. data/lib/metronome_sdk/models/v1/customers/customer_alert.rb +1 -0
  24. data/lib/metronome_sdk/models/v1/customers/invoice.rb +8 -1
  25. data/lib/metronome_sdk/models/v1/customers/invoice_list_params.rb +29 -1
  26. data/lib/metronome_sdk/models/v1/package_create_params.rb +2 -30
  27. data/lib/metronome_sdk/models/v1/package_list_response.rb +28 -9
  28. data/lib/metronome_sdk/models/v1/package_retrieve_response.rb +29 -9
  29. data/lib/metronome_sdk/models/v2/contract_edit_params.rb +67 -20
  30. data/lib/metronome_sdk/models/v2/contract_get_edit_history_response.rb +496 -15
  31. data/lib/metronome_sdk/resources/v1/contracts/products.rb +6 -2
  32. data/lib/metronome_sdk/resources/v1/contracts.rb +76 -2
  33. data/lib/metronome_sdk/resources/v1/customers/invoices.rb +5 -1
  34. data/lib/metronome_sdk/resources/v1/packages.rb +1 -3
  35. data/lib/metronome_sdk/version.rb +1 -1
  36. data/lib/metronome_sdk.rb +3 -1
  37. data/rbi/metronome_sdk/internal/util.rbi +8 -0
  38. data/rbi/metronome_sdk/models/base_threshold_commit.rbi +24 -5
  39. data/rbi/metronome_sdk/models/contract_v2.rbi +916 -19
  40. data/rbi/metronome_sdk/models/credit.rbi +139 -3
  41. data/rbi/metronome_sdk/models/override.rbi +9 -12
  42. data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration.rbi +54 -3
  43. data/rbi/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbi +55 -4
  44. data/rbi/metronome_sdk/models/spend_threshold_configuration.rbi +54 -3
  45. data/rbi/metronome_sdk/models/spend_threshold_configuration_v2.rbi +58 -9
  46. data/rbi/metronome_sdk/models/update_base_threshold_commit.rbi +22 -4
  47. data/rbi/metronome_sdk/models/v1/alert_create_params.rbi +5 -0
  48. data/rbi/metronome_sdk/models/v1/contract_amend_params.rbi +3 -416
  49. data/rbi/metronome_sdk/models/v1/contract_create_params.rbi +5 -418
  50. data/rbi/metronome_sdk/models/v1/contract_list_seat_balances_params.rbi +179 -0
  51. data/rbi/metronome_sdk/models/v1/contract_list_seat_balances_response.rbi +714 -0
  52. data/rbi/metronome_sdk/models/v1/contracts/product_create_params.rbi +74 -0
  53. data/rbi/metronome_sdk/models/v1/contracts/product_update_params.rbi +74 -0
  54. data/rbi/metronome_sdk/models/v1/customers/customer_alert.rbi +5 -0
  55. data/rbi/metronome_sdk/models/v1/customers/invoice.rbi +9 -0
  56. data/rbi/metronome_sdk/models/v1/customers/invoice_list_params.rbi +75 -0
  57. data/rbi/metronome_sdk/models/v1/package_create_params.rbi +3 -76
  58. data/rbi/metronome_sdk/models/v1/package_list_response.rbi +72 -15
  59. data/rbi/metronome_sdk/models/v1/package_retrieve_response.rbi +72 -17
  60. data/rbi/metronome_sdk/models/v2/contract_edit_params.rbi +133 -28
  61. data/rbi/metronome_sdk/models/v2/contract_get_edit_history_response.rbi +1174 -145
  62. data/rbi/metronome_sdk/resources/v1/contracts/products.rbi +18 -0
  63. data/rbi/metronome_sdk/resources/v1/contracts.rbi +88 -3
  64. data/rbi/metronome_sdk/resources/v1/customers/invoices.rbi +7 -0
  65. data/rbi/metronome_sdk/resources/v1/packages.rbi +0 -3
  66. data/sig/metronome_sdk/internal/util.rbs +4 -0
  67. data/sig/metronome_sdk/models/base_threshold_commit.rbs +13 -3
  68. data/sig/metronome_sdk/models/contract_v2.rbs +401 -16
  69. data/sig/metronome_sdk/models/credit.rbs +69 -0
  70. data/sig/metronome_sdk/models/override.rbs +8 -10
  71. data/sig/metronome_sdk/models/prepaid_balance_threshold_configuration.rbs +22 -3
  72. data/sig/metronome_sdk/models/prepaid_balance_threshold_configuration_v2.rbs +23 -4
  73. data/sig/metronome_sdk/models/spend_threshold_configuration.rbs +22 -3
  74. data/sig/metronome_sdk/models/spend_threshold_configuration_v2.rbs +26 -7
  75. data/sig/metronome_sdk/models/update_base_threshold_commit.rbs +15 -2
  76. data/sig/metronome_sdk/models/v1/alert_create_params.rbs +3 -1
  77. data/sig/metronome_sdk/models/v1/contract_amend_params.rbs +3 -147
  78. data/sig/metronome_sdk/models/v1/contract_create_params.rbs +3 -147
  79. data/sig/metronome_sdk/models/v1/contract_list_seat_balances_params.rbs +96 -0
  80. data/sig/metronome_sdk/models/v1/contract_list_seat_balances_response.rbs +299 -0
  81. data/sig/metronome_sdk/models/v1/contracts/product_create_params.rbs +20 -0
  82. data/sig/metronome_sdk/models/v1/contracts/product_update_params.rbs +20 -0
  83. data/sig/metronome_sdk/models/v1/customers/customer_alert.rbs +3 -1
  84. data/sig/metronome_sdk/models/v1/customers/invoice.rbs +7 -0
  85. data/sig/metronome_sdk/models/v1/customers/invoice_list_params.rbs +29 -1
  86. data/sig/metronome_sdk/models/v1/package_create_params.rbs +3 -30
  87. data/sig/metronome_sdk/models/v1/package_list_response.rbs +33 -15
  88. data/sig/metronome_sdk/models/v1/package_retrieve_response.rbs +33 -15
  89. data/sig/metronome_sdk/models/v2/contract_edit_params.rbs +33 -10
  90. data/sig/metronome_sdk/models/v2/contract_get_edit_history_response.rbs +409 -19
  91. data/sig/metronome_sdk/resources/v1/contracts/products.rbs +2 -0
  92. data/sig/metronome_sdk/resources/v1/contracts.rbs +15 -0
  93. data/sig/metronome_sdk/resources/v1/customers/invoices.rbs +2 -0
  94. data/sig/metronome_sdk/resources/v1/packages.rbs +0 -1
  95. metadata +8 -2
@@ -105,7 +105,7 @@ module MetronomeSDK
105
105
  # @!attribute package_id
106
106
  # If provided, provisions a customer on a package instead of creating a
107
107
  # traditional contract. When specified, only customer_id, starting_at, package_id,
108
- # and uniqueness_key are allowed.
108
+ # uniqueness_key, transition, and custom_fields are allowed.
109
109
  #
110
110
  # @return [String, nil]
111
111
  optional :package_id, String
@@ -451,12 +451,6 @@ module MetronomeSDK
451
451
  # @return [String, nil]
452
452
  optional :netsuite_sales_order_id, String
453
453
 
454
- # @!attribute payment_gate_config
455
- # optionally payment gate this commit
456
- #
457
- # @return [MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig, nil]
458
- optional :payment_gate_config, -> { MetronomeSDK::V1::ContractCreateParams::Commit::PaymentGateConfig }
459
-
460
454
  # @!attribute priority
461
455
  # If multiple commits are applicable, the one with the lower priority will apply
462
456
  # first.
@@ -491,7 +485,7 @@ module MetronomeSDK
491
485
  # @return [String, nil]
492
486
  optional :temporary_id, String
493
487
 
494
- # @!method initialize(product_id:, type:, access_schedule: nil, amount: nil, applicable_product_ids: nil, applicable_product_tags: nil, custom_fields: nil, description: nil, hierarchy_configuration: nil, invoice_schedule: nil, name: nil, netsuite_sales_order_id: nil, payment_gate_config: nil, priority: nil, rate_type: nil, rollover_fraction: nil, specifiers: nil, temporary_id: nil)
488
+ # @!method initialize(product_id:, type:, access_schedule: nil, amount: nil, applicable_product_ids: nil, applicable_product_tags: nil, custom_fields: nil, description: nil, hierarchy_configuration: nil, invoice_schedule: nil, name: nil, netsuite_sales_order_id: nil, priority: nil, rate_type: nil, rollover_fraction: nil, specifiers: nil, temporary_id: nil)
495
489
  # Some parameter documentations has been truncated, see
496
490
  # {MetronomeSDK::Models::V1::ContractCreateParams::Commit} for more details.
497
491
  #
@@ -519,8 +513,6 @@ module MetronomeSDK
519
513
  #
520
514
  # @param netsuite_sales_order_id [String] This field's availability is dependent on your client's configuration.
521
515
  #
522
- # @param payment_gate_config [MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig] optionally payment gate this commit
523
- #
524
516
  # @param priority [Float] If multiple commits are applicable, the one with the lower priority will apply f
525
517
  #
526
518
  # @param rate_type [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::RateType]
@@ -786,175 +778,6 @@ module MetronomeSDK
786
778
  end
787
779
  end
788
780
 
789
- # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit#payment_gate_config
790
- class PaymentGateConfig < MetronomeSDK::Internal::Type::BaseModel
791
- # @!attribute payment_gate_type
792
- # Gate access to the commit balance based on successful collection of payment.
793
- # Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
794
- # facilitate payment using your own payment integration. Select NONE if you do not
795
- # wish to payment gate the commit balance.
796
- #
797
- # @return [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::PaymentGateType]
798
- required :payment_gate_type,
799
- enum: -> { MetronomeSDK::V1::ContractCreateParams::Commit::PaymentGateConfig::PaymentGateType }
800
-
801
- # @!attribute precalculated_tax_config
802
- # Only applicable if using PRECALCULATED as your tax type.
803
- #
804
- # @return [MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::PrecalculatedTaxConfig, nil]
805
- optional :precalculated_tax_config,
806
- -> { MetronomeSDK::V1::ContractCreateParams::Commit::PaymentGateConfig::PrecalculatedTaxConfig }
807
-
808
- # @!attribute stripe_config
809
- # Only applicable if using STRIPE as your payment gate type.
810
- #
811
- # @return [MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig, nil]
812
- optional :stripe_config,
813
- -> { MetronomeSDK::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig }
814
-
815
- # @!attribute tax_type
816
- # Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
817
- # not wish Metronome to calculate tax on your behalf. Leaving this field blank
818
- # will default to NONE.
819
- #
820
- # @return [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::TaxType, nil]
821
- optional :tax_type,
822
- enum: -> { MetronomeSDK::V1::ContractCreateParams::Commit::PaymentGateConfig::TaxType }
823
-
824
- # @!method initialize(payment_gate_type:, precalculated_tax_config: nil, stripe_config: nil, tax_type: nil)
825
- # Some parameter documentations has been truncated, see
826
- # {MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig} for
827
- # more details.
828
- #
829
- # optionally payment gate this commit
830
- #
831
- # @param payment_gate_type [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::PaymentGateType] Gate access to the commit balance based on successful collection of payment. Sel
832
- #
833
- # @param precalculated_tax_config [MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::PrecalculatedTaxConfig] Only applicable if using PRECALCULATED as your tax type.
834
- #
835
- # @param stripe_config [MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig] Only applicable if using STRIPE as your payment gate type.
836
- #
837
- # @param tax_type [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::TaxType] Stripe tax is only supported for Stripe payment gateway. Select NONE if you do n
838
-
839
- # Gate access to the commit balance based on successful collection of payment.
840
- # Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
841
- # facilitate payment using your own payment integration. Select NONE if you do not
842
- # wish to payment gate the commit balance.
843
- #
844
- # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig#payment_gate_type
845
- module PaymentGateType
846
- extend MetronomeSDK::Internal::Type::Enum
847
-
848
- NONE = :NONE
849
- STRIPE = :STRIPE
850
- EXTERNAL = :EXTERNAL
851
-
852
- # @!method self.values
853
- # @return [Array<Symbol>]
854
- end
855
-
856
- # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig#precalculated_tax_config
857
- class PrecalculatedTaxConfig < MetronomeSDK::Internal::Type::BaseModel
858
- # @!attribute tax_amount
859
- # Amount of tax to be applied. This should be in the same currency and
860
- # denomination as the commit's invoice schedule
861
- #
862
- # @return [Float]
863
- required :tax_amount, Float
864
-
865
- # @!attribute tax_name
866
- # Name of the tax to be applied. This may be used in an invoice line item
867
- # description.
868
- #
869
- # @return [String, nil]
870
- optional :tax_name, String
871
-
872
- # @!method initialize(tax_amount:, tax_name: nil)
873
- # Some parameter documentations has been truncated, see
874
- # {MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::PrecalculatedTaxConfig}
875
- # for more details.
876
- #
877
- # Only applicable if using PRECALCULATED as your tax type.
878
- #
879
- # @param tax_amount [Float] Amount of tax to be applied. This should be in the same currency and denominatio
880
- #
881
- # @param tax_name [String] Name of the tax to be applied. This may be used in an invoice line item descript
882
- end
883
-
884
- # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig#stripe_config
885
- class StripeConfig < MetronomeSDK::Internal::Type::BaseModel
886
- # @!attribute payment_type
887
- # If left blank, will default to INVOICE
888
- #
889
- # @return [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig::PaymentType]
890
- required :payment_type,
891
- enum: -> { MetronomeSDK::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig::PaymentType }
892
-
893
- # @!attribute invoice_metadata
894
- # Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
895
- # your payment type.
896
- #
897
- # @return [Hash{Symbol=>String}, nil]
898
- optional :invoice_metadata, MetronomeSDK::Internal::Type::HashOf[String]
899
-
900
- # @!attribute on_session_payment
901
- # If true, the payment will be made assuming the customer is present (i.e. on
902
- # session).
903
- #
904
- # If false, the payment will be made assuming the customer is not present (i.e.
905
- # off session). For cardholders from a country with an e-mandate requirement (e.g.
906
- # India), the payment may be declined.
907
- #
908
- # If left blank, will default to false.
909
- #
910
- # @return [Boolean, nil]
911
- optional :on_session_payment, MetronomeSDK::Internal::Type::Boolean
912
-
913
- # @!method initialize(payment_type:, invoice_metadata: nil, on_session_payment: nil)
914
- # Some parameter documentations has been truncated, see
915
- # {MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig}
916
- # for more details.
917
- #
918
- # Only applicable if using STRIPE as your payment gate type.
919
- #
920
- # @param payment_type [Symbol, MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig::PaymentType] If left blank, will default to INVOICE
921
- #
922
- # @param invoice_metadata [Hash{Symbol=>String}] Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
923
- #
924
- # @param on_session_payment [Boolean] If true, the payment will be made assuming the customer is present (i.e. on sess
925
-
926
- # If left blank, will default to INVOICE
927
- #
928
- # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig::StripeConfig#payment_type
929
- module PaymentType
930
- extend MetronomeSDK::Internal::Type::Enum
931
-
932
- INVOICE = :INVOICE
933
- PAYMENT_INTENT = :PAYMENT_INTENT
934
-
935
- # @!method self.values
936
- # @return [Array<Symbol>]
937
- end
938
- end
939
-
940
- # Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
941
- # not wish Metronome to calculate tax on your behalf. Leaving this field blank
942
- # will default to NONE.
943
- #
944
- # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit::PaymentGateConfig#tax_type
945
- module TaxType
946
- extend MetronomeSDK::Internal::Type::Enum
947
-
948
- NONE = :NONE
949
- STRIPE = :STRIPE
950
- ANROK = :ANROK
951
- PRECALCULATED = :PRECALCULATED
952
-
953
- # @!method self.values
954
- # @return [Array<Symbol>]
955
- end
956
- end
957
-
958
781
  # @see MetronomeSDK::Models::V1::ContractCreateParams::Commit#rate_type
959
782
  module RateType
960
783
  extend MetronomeSDK::Internal::Type::Enum
@@ -1706,16 +1529,7 @@ module MetronomeSDK
1706
1529
  # @return [Array<String>, nil]
1707
1530
  optional :recurring_commit_ids, MetronomeSDK::Internal::Type::ArrayOf[String]
1708
1531
 
1709
- # @!attribute recurring_credit_ids
1710
- # Can only be used for commit specific overrides. Must be used in conjunction with
1711
- # one of `product_id`, `product_tags`, `pricing_group_values`, or
1712
- # `presentation_group_values`. If provided, the override will only apply to
1713
- # credits created by the specified recurring credit ids.
1714
- #
1715
- # @return [Array<String>, nil]
1716
- optional :recurring_credit_ids, MetronomeSDK::Internal::Type::ArrayOf[String]
1717
-
1718
- # @!method initialize(billing_frequency: nil, commit_ids: nil, presentation_group_values: nil, pricing_group_values: nil, product_id: nil, product_tags: nil, recurring_commit_ids: nil, recurring_credit_ids: nil)
1532
+ # @!method initialize(billing_frequency: nil, commit_ids: nil, presentation_group_values: nil, pricing_group_values: nil, product_id: nil, product_tags: nil, recurring_commit_ids: nil)
1719
1533
  # Some parameter documentations has been truncated, see
1720
1534
  # {MetronomeSDK::Models::V1::ContractCreateParams::Override::OverrideSpecifier}
1721
1535
  # for more details.
@@ -1733,8 +1547,6 @@ module MetronomeSDK
1733
1547
  # @param product_tags [Array<String>] If provided, the override will only apply to products with all the specified tag
1734
1548
  #
1735
1549
  # @param recurring_commit_ids [Array<String>] Can only be used for commit specific overrides. Must be used in conjunction with
1736
- #
1737
- # @param recurring_credit_ids [Array<String>] Can only be used for commit specific overrides. Must be used in conjunction with
1738
1550
 
1739
1551
  # @see MetronomeSDK::Models::V1::ContractCreateParams::Override::OverrideSpecifier#billing_frequency
1740
1552
  module BillingFrequency
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MetronomeSDK
4
+ module Models
5
+ module V1
6
+ # @see MetronomeSDK::Resources::V1::Contracts#list_seat_balances
7
+ class ContractListSeatBalancesParams < MetronomeSDK::Internal::Type::BaseModel
8
+ extend MetronomeSDK::Internal::Type::RequestParameters::Converter
9
+ include MetronomeSDK::Internal::Type::RequestParameters
10
+
11
+ # @!attribute contract_id
12
+ # The contract ID to retrieve seat balances for
13
+ #
14
+ # @return [String]
15
+ required :contract_id, String
16
+
17
+ # @!attribute customer_id
18
+ # The customer ID to retrieve seat balances for
19
+ #
20
+ # @return [String]
21
+ required :customer_id, String
22
+
23
+ # @!attribute covering_date
24
+ # Include only commits or credits with access that cover this specific date
25
+ # (cannot be used with starting_at or ending_before).
26
+ #
27
+ # @return [Time, nil]
28
+ optional :covering_date, Time
29
+
30
+ # @!attribute cursor
31
+ # Page token from a previous response to retrieve the next page
32
+ #
33
+ # @return [String, nil]
34
+ optional :cursor, String
35
+
36
+ # @!attribute effective_before
37
+ # Include only commits or credits with access effective on or before this date
38
+ # (cannot be used with covering_date).
39
+ #
40
+ # @return [Time, nil]
41
+ optional :effective_before, Time
42
+
43
+ # @!attribute include_credits_and_commits
44
+ # Include credits and commits in the response
45
+ #
46
+ # @return [Boolean, nil]
47
+ optional :include_credits_and_commits, MetronomeSDK::Internal::Type::Boolean
48
+
49
+ # @!attribute include_ledgers
50
+ # Include ledger entries for each commit and commit. `include_credits_and_commits`
51
+ # must be set to `true` for `include_ledgers=true` to apply.
52
+ #
53
+ # @return [Boolean, nil]
54
+ optional :include_ledgers, MetronomeSDK::Internal::Type::Boolean
55
+
56
+ # @!attribute limit
57
+ # Maximum number of seats to return. Range: 1-100. Default: 25. When
58
+ # `include_credits_and_commits = true`, if the total commits/credits across all
59
+ # seats exceeds 100, a limit of 100 applies to the total credits and commits.
60
+ # Seats are included greedily to maximize the number of seats returned. Example:
61
+ # if seat 1 has 98 commits and seat 2 has 10 commits, both seats will be returned
62
+ # (total: 108 commits). Each returned seat includes all of its associated credits
63
+ # and commits.
64
+ #
65
+ # @return [Integer, nil]
66
+ optional :limit, Integer
67
+
68
+ # @!attribute seat_ids
69
+ # Optional filter to only include specific seats.
70
+ #
71
+ # @return [Array<String>, nil]
72
+ optional :seat_ids, MetronomeSDK::Internal::Type::ArrayOf[String]
73
+
74
+ # @!attribute starting_at
75
+ # Include only commits or credits with access effective on or after this date
76
+ # (cannot be used with covering_date).
77
+ #
78
+ # @return [Time, nil]
79
+ optional :starting_at, Time
80
+
81
+ # @!attribute subscription_ids
82
+ # Optional filter to only include seats from specific subscriptions. If
83
+ # subscriptions ids are not mapped to SEAT_BASED subscriptions, error will be
84
+ # returned.
85
+ #
86
+ # @return [Array<String>, nil]
87
+ optional :subscription_ids, MetronomeSDK::Internal::Type::ArrayOf[String]
88
+
89
+ # @!method initialize(contract_id:, customer_id:, covering_date: nil, cursor: nil, effective_before: nil, include_credits_and_commits: nil, include_ledgers: nil, limit: nil, seat_ids: nil, starting_at: nil, subscription_ids: nil, request_options: {})
90
+ # Some parameter documentations has been truncated, see
91
+ # {MetronomeSDK::Models::V1::ContractListSeatBalancesParams} for more details.
92
+ #
93
+ # @param contract_id [String] The contract ID to retrieve seat balances for
94
+ #
95
+ # @param customer_id [String] The customer ID to retrieve seat balances for
96
+ #
97
+ # @param covering_date [Time] Include only commits or credits with access that cover this specific date (canno
98
+ #
99
+ # @param cursor [String] Page token from a previous response to retrieve the next page
100
+ #
101
+ # @param effective_before [Time] Include only commits or credits with access effective on or before this date (ca
102
+ #
103
+ # @param include_credits_and_commits [Boolean] Include credits and commits in the response
104
+ #
105
+ # @param include_ledgers [Boolean] Include ledger entries for each commit and commit. `include_credits_and_commits`
106
+ #
107
+ # @param limit [Integer] Maximum number of seats to return. Range: 1-100. Default: 25.
108
+ #
109
+ # @param seat_ids [Array<String>] Optional filter to only include specific seats.
110
+ #
111
+ # @param starting_at [Time] Include only commits or credits with access effective on or after this date (can
112
+ #
113
+ # @param subscription_ids [Array<String>] Optional filter to only include seats from specific subscriptions. If subscripti
114
+ #
115
+ # @param request_options [MetronomeSDK::RequestOptions, Hash{Symbol=>Object}]
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,315 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MetronomeSDK
4
+ module Models
5
+ module V1
6
+ # @see MetronomeSDK::Resources::V1::Contracts#list_seat_balances
7
+ class ContractListSeatBalancesResponse < MetronomeSDK::Internal::Type::BaseModel
8
+ # @!attribute data
9
+ #
10
+ # @return [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data>]
11
+ required :data,
12
+ -> { MetronomeSDK::Internal::Type::ArrayOf[MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data] }
13
+
14
+ # @!attribute pagination
15
+ #
16
+ # @return [MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Pagination]
17
+ required :pagination, -> { MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Pagination }
18
+
19
+ # @!method initialize(data:, pagination:)
20
+ # @param data [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data>]
21
+ # @param pagination [MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Pagination]
22
+
23
+ class Data < MetronomeSDK::Internal::Type::BaseModel
24
+ # @!attribute balances
25
+ #
26
+ # @return [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Balance>]
27
+ required :balances,
28
+ -> { MetronomeSDK::Internal::Type::ArrayOf[MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Balance] }
29
+
30
+ # @!attribute seat_id
31
+ # The unique identifier for the seat
32
+ #
33
+ # @return [String]
34
+ required :seat_id, String
35
+
36
+ # @!attribute commits
37
+ # Array of commits applicable to this seat with their balances
38
+ #
39
+ # @return [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit>, nil]
40
+ optional :commits,
41
+ -> { MetronomeSDK::Internal::Type::ArrayOf[MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit] },
42
+ nil?: true
43
+
44
+ # @!attribute credits
45
+ # Array of credits applicable to this seat with their balances
46
+ #
47
+ # @return [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit>, nil]
48
+ optional :credits,
49
+ -> { MetronomeSDK::Internal::Type::ArrayOf[MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit] }
50
+
51
+ # @!method initialize(balances:, seat_id:, commits: nil, credits: nil)
52
+ # @param balances [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Balance>]
53
+ #
54
+ # @param seat_id [String] The unique identifier for the seat
55
+ #
56
+ # @param commits [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit>, nil] Array of commits applicable to this seat with their balances
57
+ #
58
+ # @param credits [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit>] Array of credits applicable to this seat with their balances
59
+
60
+ class Balance < MetronomeSDK::Internal::Type::BaseModel
61
+ # @!attribute balance
62
+ # The total balance across all commits and credits for this seat, of this credit
63
+ # type.
64
+ #
65
+ # @return [Float]
66
+ required :balance, Float
67
+
68
+ # @!attribute credit_type_id
69
+ #
70
+ # @return [String]
71
+ required :credit_type_id, String
72
+
73
+ # @!attribute starting_balance
74
+ # The total initial balances of all commits and credits for this seat, of this
75
+ # credit type.
76
+ #
77
+ # @return [Float]
78
+ required :starting_balance, Float
79
+
80
+ # @!method initialize(balance:, credit_type_id:, starting_balance:)
81
+ # Some parameter documentations has been truncated, see
82
+ # {MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Balance} for
83
+ # more details.
84
+ #
85
+ # @param balance [Float] The total balance across all commits and credits for this seat, of this credit t
86
+ #
87
+ # @param credit_type_id [String]
88
+ #
89
+ # @param starting_balance [Float] The total initial balances of all commits and credits for this seat, of this cre
90
+ end
91
+
92
+ class Commit < MetronomeSDK::Internal::Type::BaseModel
93
+ # @!attribute id
94
+ # The commit or credit ID
95
+ #
96
+ # @return [String]
97
+ required :id, String
98
+
99
+ # @!attribute balance
100
+ # The current balance for this commit for this specific seat
101
+ #
102
+ # @return [Float]
103
+ required :balance, Float
104
+
105
+ # @!attribute start_date
106
+ # The datetime when the commit becomes active
107
+ #
108
+ # @return [Time]
109
+ required :start_date, Time
110
+
111
+ # @!attribute end_date
112
+ # The datetime when the commit expires
113
+ #
114
+ # @return [Time, nil]
115
+ optional :end_date, Time, nil?: true
116
+
117
+ # @!attribute ledger_entries
118
+ # Transaction history for this commit for this seat (only included if
119
+ # include_ledgers=true)
120
+ #
121
+ # @return [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry>, nil]
122
+ optional :ledger_entries,
123
+ -> { MetronomeSDK::Internal::Type::ArrayOf[MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry] }
124
+
125
+ # @!method initialize(id:, balance:, start_date:, end_date: nil, ledger_entries: nil)
126
+ # Some parameter documentations has been truncated, see
127
+ # {MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit} for
128
+ # more details.
129
+ #
130
+ # @param id [String] The commit or credit ID
131
+ #
132
+ # @param balance [Float] The current balance for this commit for this specific seat
133
+ #
134
+ # @param start_date [Time] The datetime when the commit becomes active
135
+ #
136
+ # @param end_date [Time, nil] The datetime when the commit expires
137
+ #
138
+ # @param ledger_entries [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry>] Transaction history for this commit for this seat (only included if include_ledg
139
+
140
+ class LedgerEntry < MetronomeSDK::Internal::Type::BaseModel
141
+ # @!attribute amount
142
+ # Amount of the ledger entry
143
+ #
144
+ # @return [Float]
145
+ required :amount, Float
146
+
147
+ # @!attribute timestamp
148
+ # The datetime when the ledger is created
149
+ #
150
+ # @return [Time]
151
+ required :timestamp, Time
152
+
153
+ # @!attribute type
154
+ # Commit ledger type
155
+ #
156
+ # @return [Symbol, MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry::Type]
157
+ required :type,
158
+ enum: -> { MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry::Type }
159
+
160
+ # @!method initialize(amount:, timestamp:, type:)
161
+ # @param amount [Float] Amount of the ledger entry
162
+ #
163
+ # @param timestamp [Time] The datetime when the ledger is created
164
+ #
165
+ # @param type [Symbol, MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry::Type] Commit ledger type
166
+
167
+ # Commit ledger type
168
+ #
169
+ # @see MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Commit::LedgerEntry#type
170
+ module Type
171
+ extend MetronomeSDK::Internal::Type::Enum
172
+
173
+ PREPAID_COMMIT_SEGMENT_START = :PREPAID_COMMIT_SEGMENT_START
174
+ PREPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION = :PREPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION
175
+ PREPAID_COMMIT_ROLLOVER = :PREPAID_COMMIT_ROLLOVER
176
+ PREPAID_COMMIT_EXPIRATION = :PREPAID_COMMIT_EXPIRATION
177
+ PREPAID_COMMIT_CANCELED = :PREPAID_COMMIT_CANCELED
178
+ PREPAID_COMMIT_CREDITED = :PREPAID_COMMIT_CREDITED
179
+ PREPAID_COMMIT_MANUAL = :PREPAID_COMMIT_MANUAL
180
+ PREPAID_COMMIT_SEAT_BASED_ADJUSTMENT = :PREPAID_COMMIT_SEAT_BASED_ADJUSTMENT
181
+
182
+ # @!method self.values
183
+ # @return [Array<Symbol>]
184
+ end
185
+ end
186
+ end
187
+
188
+ class Credit < MetronomeSDK::Internal::Type::BaseModel
189
+ # @!attribute id
190
+ # The credit ID
191
+ #
192
+ # @return [String]
193
+ required :id, String
194
+
195
+ # @!attribute balance
196
+ # The current balance for this credit for this specific seat
197
+ #
198
+ # @return [Float]
199
+ required :balance, Float
200
+
201
+ # @!attribute start_date
202
+ # The datetime when the credit becomes active
203
+ #
204
+ # @return [Time]
205
+ required :start_date, Time
206
+
207
+ # @!attribute end_date
208
+ # The datetime when the credit expires
209
+ #
210
+ # @return [Time, nil]
211
+ optional :end_date, Time, nil?: true
212
+
213
+ # @!attribute ledger_entries
214
+ # Transaction history for this credit for this seat (only included if
215
+ # include_ledgers=true)
216
+ #
217
+ # @return [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry>, nil]
218
+ optional :ledger_entries,
219
+ -> { MetronomeSDK::Internal::Type::ArrayOf[MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry] }
220
+
221
+ # @!method initialize(id:, balance:, start_date:, end_date: nil, ledger_entries: nil)
222
+ # Some parameter documentations has been truncated, see
223
+ # {MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit} for
224
+ # more details.
225
+ #
226
+ # @param id [String] The credit ID
227
+ #
228
+ # @param balance [Float] The current balance for this credit for this specific seat
229
+ #
230
+ # @param start_date [Time] The datetime when the credit becomes active
231
+ #
232
+ # @param end_date [Time, nil] The datetime when the credit expires
233
+ #
234
+ # @param ledger_entries [Array<MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry>] Transaction history for this credit for this seat (only included if include_ledg
235
+
236
+ class LedgerEntry < MetronomeSDK::Internal::Type::BaseModel
237
+ # @!attribute amount
238
+ # Amount of the ledger entry
239
+ #
240
+ # @return [Float]
241
+ required :amount, Float
242
+
243
+ # @!attribute timestamp
244
+ # The datetime when the ledger is created
245
+ #
246
+ # @return [Time]
247
+ required :timestamp, Time
248
+
249
+ # @!attribute type
250
+ # Credit ledger type
251
+ #
252
+ # @return [Symbol, MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry::Type]
253
+ required :type,
254
+ enum: -> { MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry::Type }
255
+
256
+ # @!method initialize(amount:, timestamp:, type:)
257
+ # @param amount [Float] Amount of the ledger entry
258
+ #
259
+ # @param timestamp [Time] The datetime when the ledger is created
260
+ #
261
+ # @param type [Symbol, MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry::Type] Credit ledger type
262
+
263
+ # Credit ledger type
264
+ #
265
+ # @see MetronomeSDK::Models::V1::ContractListSeatBalancesResponse::Data::Credit::LedgerEntry#type
266
+ module Type
267
+ extend MetronomeSDK::Internal::Type::Enum
268
+
269
+ CREDIT_SEGMENT_START = :CREDIT_SEGMENT_START
270
+ CREDIT_AUTOMATED_INVOICE_DEDUCTION = :CREDIT_AUTOMATED_INVOICE_DEDUCTION
271
+ CREDIT_EXPIRATION = :CREDIT_EXPIRATION
272
+ CREDIT_CANCELED = :CREDIT_CANCELED
273
+ CREDIT_CREDITED = :CREDIT_CREDITED
274
+ CREDIT_MANUAL = :CREDIT_MANUAL
275
+ CREDIT_SEAT_BASED_ADJUSTMENT = :CREDIT_SEAT_BASED_ADJUSTMENT
276
+ CREDIT_ROLLOVER = :CREDIT_ROLLOVER
277
+
278
+ # @!method self.values
279
+ # @return [Array<Symbol>]
280
+ end
281
+ end
282
+ end
283
+ end
284
+
285
+ # @see MetronomeSDK::Models::V1::ContractListSeatBalancesResponse#pagination
286
+ class Pagination < MetronomeSDK::Internal::Type::BaseModel
287
+ # @!attribute seats_available_for_next_page
288
+ # Number of seats available to fetch in the next page
289
+ #
290
+ # @return [Float]
291
+ required :seats_available_for_next_page, Float
292
+
293
+ # @!attribute seats_included
294
+ # Number of seats included in this response
295
+ #
296
+ # @return [Float]
297
+ required :seats_included, Float
298
+
299
+ # @!attribute next_page
300
+ # Token to retrieve the next page of results. Null if no more pages available
301
+ #
302
+ # @return [String, nil]
303
+ optional :next_page, String, nil?: true
304
+
305
+ # @!method initialize(seats_available_for_next_page:, seats_included:, next_page: nil)
306
+ # @param seats_available_for_next_page [Float] Number of seats available to fetch in the next page
307
+ #
308
+ # @param seats_included [Float] Number of seats included in this response
309
+ #
310
+ # @param next_page [String, nil] Token to retrieve the next page of results. Null if no more pages available
311
+ end
312
+ end
313
+ end
314
+ end
315
+ end