orb-billing 1.24.0 → 1.26.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/orb/models/alert.rb +4 -2
  5. data/lib/orb/models/alert_update_params.rb +5 -3
  6. data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +530 -6
  7. data/lib/orb/models/beta_create_plan_version_params.rb +526 -6
  8. data/lib/orb/models/changed_subscription_resources.rb +5 -5
  9. data/lib/orb/models/invoice.rb +5 -5
  10. data/lib/orb/models/invoice_fetch_upcoming_response.rb +5 -5
  11. data/lib/orb/models/invoice_issue_summary_response.rb +3 -3
  12. data/lib/orb/models/invoice_line_item_create_response.rb +2 -2
  13. data/lib/orb/models/invoice_list_summary_response.rb +3 -3
  14. data/lib/orb/models/per_price_cost.rb +2 -2
  15. data/lib/orb/models/plan.rb +2 -2
  16. data/lib/orb/models/plan_create_params.rb +259 -3
  17. data/lib/orb/models/plan_version.rb +2 -2
  18. data/lib/orb/models/price.rb +433 -1
  19. data/lib/orb/models/price_create_params.rb +244 -3
  20. data/lib/orb/models/price_evaluate_multiple_params.rb +255 -3
  21. data/lib/orb/models/price_evaluate_preview_events_params.rb +255 -3
  22. data/lib/orb/models/price_interval.rb +2 -2
  23. data/lib/orb/models/subscription_create_params.rb +521 -6
  24. data/lib/orb/models/subscription_price_intervals_params.rb +251 -3
  25. data/lib/orb/models/subscription_schedule_plan_change_params.rb +530 -6
  26. data/lib/orb/resources/alerts.rb +5 -2
  27. data/lib/orb/resources/customers/costs.rb +20 -0
  28. data/lib/orb/resources/licenses/external_licenses.rb +7 -0
  29. data/lib/orb/resources/licenses/usage.rb +3 -0
  30. data/lib/orb/resources/prices/external_price_id.rb +2 -2
  31. data/lib/orb/resources/prices.rb +5 -5
  32. data/lib/orb/resources/subscriptions.rb +39 -6
  33. data/lib/orb/version.rb +1 -1
  34. data/rbi/orb/models/alert.rbi +6 -2
  35. data/rbi/orb/models/alert_update_params.rbi +8 -4
  36. data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +2789 -1903
  37. data/rbi/orb/models/beta_create_plan_version_params.rbi +2788 -1902
  38. data/rbi/orb/models/changed_subscription_resources.rbi +7 -6
  39. data/rbi/orb/models/invoice.rbi +7 -6
  40. data/rbi/orb/models/invoice_fetch_upcoming_response.rbi +7 -6
  41. data/rbi/orb/models/invoice_issue_summary_response.rbi +6 -6
  42. data/rbi/orb/models/invoice_line_item_create_response.rbi +1 -0
  43. data/rbi/orb/models/invoice_list_summary_response.rbi +6 -6
  44. data/rbi/orb/models/per_price_cost.rbi +1 -0
  45. data/rbi/orb/models/plan.rbi +1 -0
  46. data/rbi/orb/models/plan_create_params.rbi +443 -0
  47. data/rbi/orb/models/plan_version.rbi +1 -0
  48. data/rbi/orb/models/price.rbi +766 -0
  49. data/rbi/orb/models/price_create_params.rbi +431 -0
  50. data/rbi/orb/models/price_evaluate_multiple_params.rbi +431 -0
  51. data/rbi/orb/models/price_evaluate_preview_events_params.rbi +431 -0
  52. data/rbi/orb/models/price_interval.rbi +1 -0
  53. data/rbi/orb/models/subscription_create_params.rbi +2489 -1603
  54. data/rbi/orb/models/subscription_price_intervals_params.rbi +431 -0
  55. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +2483 -1597
  56. data/rbi/orb/resources/alerts.rbi +8 -3
  57. data/rbi/orb/resources/customers/costs.rbi +20 -0
  58. data/rbi/orb/resources/licenses/external_licenses.rbi +7 -0
  59. data/rbi/orb/resources/licenses/usage.rbi +3 -0
  60. data/rbi/orb/resources/prices.rbi +1 -0
  61. data/rbi/orb/resources/subscriptions.rbi +39 -6
  62. data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +366 -0
  63. data/sig/orb/models/beta_create_plan_version_params.rbs +366 -0
  64. data/sig/orb/models/plan_create_params.rbs +183 -0
  65. data/sig/orb/models/price.rbs +327 -0
  66. data/sig/orb/models/price_create_params.rbs +173 -0
  67. data/sig/orb/models/price_evaluate_multiple_params.rbs +178 -0
  68. data/sig/orb/models/price_evaluate_preview_events_params.rbs +178 -0
  69. data/sig/orb/models/subscription_create_params.rbs +366 -0
  70. data/sig/orb/models/subscription_price_intervals_params.rbs +178 -0
  71. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +366 -0
  72. metadata +2 -2
@@ -23,6 +23,7 @@ module Orb
23
23
  Orb::NewFloatingTieredPackagePrice,
24
24
  Orb::NewFloatingTieredWithMinimumPrice,
25
25
  Orb::NewFloatingGroupedTieredPrice,
26
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix,
26
27
  Orb::NewFloatingTieredPackageWithMinimumPrice,
27
28
  Orb::NewFloatingPackageWithAllocationPrice,
28
29
  Orb::NewFloatingUnitWithPercentPrice,
@@ -66,6 +67,7 @@ module Orb
66
67
  Orb::NewFloatingTieredPackagePrice::OrHash,
67
68
  Orb::NewFloatingTieredWithMinimumPrice::OrHash,
68
69
  Orb::NewFloatingGroupedTieredPrice::OrHash,
70
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::OrHash,
69
71
  Orb::NewFloatingTieredPackageWithMinimumPrice::OrHash,
70
72
  Orb::NewFloatingPackageWithAllocationPrice::OrHash,
71
73
  Orb::NewFloatingUnitWithPercentPrice::OrHash,
@@ -116,6 +118,7 @@ module Orb
116
118
  Orb::NewFloatingTieredPackagePrice,
117
119
  Orb::NewFloatingTieredWithMinimumPrice,
118
120
  Orb::NewFloatingGroupedTieredPrice,
121
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix,
119
122
  Orb::NewFloatingTieredPackageWithMinimumPrice,
120
123
  Orb::NewFloatingPackageWithAllocationPrice,
121
124
  Orb::NewFloatingUnitWithPercentPrice,
@@ -165,6 +168,7 @@ module Orb
165
168
  Orb::NewFloatingTieredPackagePrice,
166
169
  Orb::NewFloatingTieredWithMinimumPrice,
167
170
  Orb::NewFloatingGroupedTieredPrice,
171
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix,
168
172
  Orb::NewFloatingTieredPackageWithMinimumPrice,
169
173
  Orb::NewFloatingPackageWithAllocationPrice,
170
174
  Orb::NewFloatingUnitWithPercentPrice,
@@ -652,6 +656,433 @@ module Orb
652
656
  end
653
657
  end
654
658
 
659
+ class GroupedTieredMatrix < Orb::Internal::Type::BaseModel
660
+ OrHash =
661
+ T.type_alias do
662
+ T.any(
663
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix,
664
+ Orb::Internal::AnyHash
665
+ )
666
+ end
667
+
668
+ # The cadence to bill for this price on.
669
+ sig do
670
+ returns(
671
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::OrSymbol
672
+ )
673
+ end
674
+ attr_accessor :cadence
675
+
676
+ # An ISO 4217 currency string for which this price is billed in.
677
+ sig { returns(String) }
678
+ attr_accessor :currency
679
+
680
+ # Configuration for grouped_tiered_matrix pricing
681
+ sig do
682
+ returns(
683
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig
684
+ )
685
+ end
686
+ attr_reader :grouped_tiered_matrix_config
687
+
688
+ sig do
689
+ params(
690
+ grouped_tiered_matrix_config:
691
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig::OrHash
692
+ ).void
693
+ end
694
+ attr_writer :grouped_tiered_matrix_config
695
+
696
+ # The id of the item the price will be associated with.
697
+ sig { returns(String) }
698
+ attr_accessor :item_id
699
+
700
+ # The pricing model type
701
+ sig { returns(Symbol) }
702
+ attr_accessor :model_type
703
+
704
+ # The name of the price.
705
+ sig { returns(String) }
706
+ attr_accessor :name
707
+
708
+ # The id of the billable metric for the price. Only needed if the price is
709
+ # usage-based.
710
+ sig { returns(T.nilable(String)) }
711
+ attr_accessor :billable_metric_id
712
+
713
+ # If the Price represents a fixed cost, the price will be billed in-advance if
714
+ # this is true, and in-arrears if this is false.
715
+ sig { returns(T.nilable(T::Boolean)) }
716
+ attr_accessor :billed_in_advance
717
+
718
+ # For custom cadence: specifies the duration of the billing period in days or
719
+ # months.
720
+ sig { returns(T.nilable(Orb::NewBillingCycleConfiguration)) }
721
+ attr_reader :billing_cycle_configuration
722
+
723
+ sig do
724
+ params(
725
+ billing_cycle_configuration:
726
+ T.nilable(Orb::NewBillingCycleConfiguration::OrHash)
727
+ ).void
728
+ end
729
+ attr_writer :billing_cycle_configuration
730
+
731
+ # The per unit conversion rate of the price currency to the invoicing currency.
732
+ sig { returns(T.nilable(Float)) }
733
+ attr_accessor :conversion_rate
734
+
735
+ # The configuration for the rate of the price currency to the invoicing currency.
736
+ sig do
737
+ returns(
738
+ T.nilable(
739
+ T.any(
740
+ Orb::UnitConversionRateConfig,
741
+ Orb::TieredConversionRateConfig
742
+ )
743
+ )
744
+ )
745
+ end
746
+ attr_accessor :conversion_rate_config
747
+
748
+ # For dimensional price: specifies a price group and dimension values
749
+ sig { returns(T.nilable(Orb::NewDimensionalPriceConfiguration)) }
750
+ attr_reader :dimensional_price_configuration
751
+
752
+ sig do
753
+ params(
754
+ dimensional_price_configuration:
755
+ T.nilable(Orb::NewDimensionalPriceConfiguration::OrHash)
756
+ ).void
757
+ end
758
+ attr_writer :dimensional_price_configuration
759
+
760
+ # An alias for the price.
761
+ sig { returns(T.nilable(String)) }
762
+ attr_accessor :external_price_id
763
+
764
+ # If the Price represents a fixed cost, this represents the quantity of units
765
+ # applied.
766
+ sig { returns(T.nilable(Float)) }
767
+ attr_accessor :fixed_price_quantity
768
+
769
+ # The property used to group this price on an invoice
770
+ sig { returns(T.nilable(String)) }
771
+ attr_accessor :invoice_grouping_key
772
+
773
+ # Within each billing cycle, specifies the cadence at which invoices are produced.
774
+ # If unspecified, a single invoice is produced per billing cycle.
775
+ sig { returns(T.nilable(Orb::NewBillingCycleConfiguration)) }
776
+ attr_reader :invoicing_cycle_configuration
777
+
778
+ sig do
779
+ params(
780
+ invoicing_cycle_configuration:
781
+ T.nilable(Orb::NewBillingCycleConfiguration::OrHash)
782
+ ).void
783
+ end
784
+ attr_writer :invoicing_cycle_configuration
785
+
786
+ # The ID of the license type to associate with this price.
787
+ sig { returns(T.nilable(String)) }
788
+ attr_accessor :license_type_id
789
+
790
+ # User-specified key/value pairs for the resource. Individual keys can be removed
791
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
792
+ # by setting `metadata` to `null`.
793
+ sig { returns(T.nilable(T::Hash[Symbol, T.nilable(String)])) }
794
+ attr_accessor :metadata
795
+
796
+ sig do
797
+ params(
798
+ cadence:
799
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::OrSymbol,
800
+ currency: String,
801
+ grouped_tiered_matrix_config:
802
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig::OrHash,
803
+ item_id: String,
804
+ name: String,
805
+ billable_metric_id: T.nilable(String),
806
+ billed_in_advance: T.nilable(T::Boolean),
807
+ billing_cycle_configuration:
808
+ T.nilable(Orb::NewBillingCycleConfiguration::OrHash),
809
+ conversion_rate: T.nilable(Float),
810
+ conversion_rate_config:
811
+ T.nilable(
812
+ T.any(
813
+ Orb::UnitConversionRateConfig::OrHash,
814
+ Orb::TieredConversionRateConfig::OrHash
815
+ )
816
+ ),
817
+ dimensional_price_configuration:
818
+ T.nilable(Orb::NewDimensionalPriceConfiguration::OrHash),
819
+ external_price_id: T.nilable(String),
820
+ fixed_price_quantity: T.nilable(Float),
821
+ invoice_grouping_key: T.nilable(String),
822
+ invoicing_cycle_configuration:
823
+ T.nilable(Orb::NewBillingCycleConfiguration::OrHash),
824
+ license_type_id: T.nilable(String),
825
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)]),
826
+ model_type: Symbol
827
+ ).returns(T.attached_class)
828
+ end
829
+ def self.new(
830
+ # The cadence to bill for this price on.
831
+ cadence:,
832
+ # An ISO 4217 currency string for which this price is billed in.
833
+ currency:,
834
+ # Configuration for grouped_tiered_matrix pricing
835
+ grouped_tiered_matrix_config:,
836
+ # The id of the item the price will be associated with.
837
+ item_id:,
838
+ # The name of the price.
839
+ name:,
840
+ # The id of the billable metric for the price. Only needed if the price is
841
+ # usage-based.
842
+ billable_metric_id: nil,
843
+ # If the Price represents a fixed cost, the price will be billed in-advance if
844
+ # this is true, and in-arrears if this is false.
845
+ billed_in_advance: nil,
846
+ # For custom cadence: specifies the duration of the billing period in days or
847
+ # months.
848
+ billing_cycle_configuration: nil,
849
+ # The per unit conversion rate of the price currency to the invoicing currency.
850
+ conversion_rate: nil,
851
+ # The configuration for the rate of the price currency to the invoicing currency.
852
+ conversion_rate_config: nil,
853
+ # For dimensional price: specifies a price group and dimension values
854
+ dimensional_price_configuration: nil,
855
+ # An alias for the price.
856
+ external_price_id: nil,
857
+ # If the Price represents a fixed cost, this represents the quantity of units
858
+ # applied.
859
+ fixed_price_quantity: nil,
860
+ # The property used to group this price on an invoice
861
+ invoice_grouping_key: nil,
862
+ # Within each billing cycle, specifies the cadence at which invoices are produced.
863
+ # If unspecified, a single invoice is produced per billing cycle.
864
+ invoicing_cycle_configuration: nil,
865
+ # The ID of the license type to associate with this price.
866
+ license_type_id: nil,
867
+ # User-specified key/value pairs for the resource. Individual keys can be removed
868
+ # by setting the value to `null`, and the entire metadata mapping can be cleared
869
+ # by setting `metadata` to `null`.
870
+ metadata: nil,
871
+ # The pricing model type
872
+ model_type: :grouped_tiered_matrix
873
+ )
874
+ end
875
+
876
+ sig do
877
+ override.returns(
878
+ {
879
+ cadence:
880
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::OrSymbol,
881
+ currency: String,
882
+ grouped_tiered_matrix_config:
883
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig,
884
+ item_id: String,
885
+ model_type: Symbol,
886
+ name: String,
887
+ billable_metric_id: T.nilable(String),
888
+ billed_in_advance: T.nilable(T::Boolean),
889
+ billing_cycle_configuration:
890
+ T.nilable(Orb::NewBillingCycleConfiguration),
891
+ conversion_rate: T.nilable(Float),
892
+ conversion_rate_config:
893
+ T.nilable(
894
+ T.any(
895
+ Orb::UnitConversionRateConfig,
896
+ Orb::TieredConversionRateConfig
897
+ )
898
+ ),
899
+ dimensional_price_configuration:
900
+ T.nilable(Orb::NewDimensionalPriceConfiguration),
901
+ external_price_id: T.nilable(String),
902
+ fixed_price_quantity: T.nilable(Float),
903
+ invoice_grouping_key: T.nilable(String),
904
+ invoicing_cycle_configuration:
905
+ T.nilable(Orb::NewBillingCycleConfiguration),
906
+ license_type_id: T.nilable(String),
907
+ metadata: T.nilable(T::Hash[Symbol, T.nilable(String)])
908
+ }
909
+ )
910
+ end
911
+ def to_hash
912
+ end
913
+
914
+ # The cadence to bill for this price on.
915
+ module Cadence
916
+ extend Orb::Internal::Type::Enum
917
+
918
+ TaggedSymbol =
919
+ T.type_alias do
920
+ T.all(
921
+ Symbol,
922
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence
923
+ )
924
+ end
925
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
926
+
927
+ ANNUAL =
928
+ T.let(
929
+ :annual,
930
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
931
+ )
932
+ SEMI_ANNUAL =
933
+ T.let(
934
+ :semi_annual,
935
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
936
+ )
937
+ MONTHLY =
938
+ T.let(
939
+ :monthly,
940
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
941
+ )
942
+ QUARTERLY =
943
+ T.let(
944
+ :quarterly,
945
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
946
+ )
947
+ ONE_TIME =
948
+ T.let(
949
+ :one_time,
950
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
951
+ )
952
+ CUSTOM =
953
+ T.let(
954
+ :custom,
955
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
956
+ )
957
+
958
+ sig do
959
+ override.returns(
960
+ T::Array[
961
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::Cadence::TaggedSymbol
962
+ ]
963
+ )
964
+ end
965
+ def self.values
966
+ end
967
+ end
968
+
969
+ class GroupedTieredMatrixConfig < Orb::Internal::Type::BaseModel
970
+ OrHash =
971
+ T.type_alias do
972
+ T.any(
973
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig,
974
+ Orb::Internal::AnyHash
975
+ )
976
+ end
977
+
978
+ # Per unit rate for usage whose dimension value has no configured tiers
979
+ sig { returns(String) }
980
+ attr_accessor :default_unit_amount
981
+
982
+ # The billable metric property used to group usage before tiering
983
+ sig { returns(String) }
984
+ attr_accessor :dimension
985
+
986
+ # Graduated tiers keyed by dimension value; usage for a value is tiered only
987
+ # against its own rows
988
+ sig do
989
+ returns(
990
+ T::Array[
991
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig::Tier
992
+ ]
993
+ )
994
+ end
995
+ attr_accessor :tiers
996
+
997
+ # Configuration for grouped_tiered_matrix pricing
998
+ sig do
999
+ params(
1000
+ default_unit_amount: String,
1001
+ dimension: String,
1002
+ tiers:
1003
+ T::Array[
1004
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig::Tier::OrHash
1005
+ ]
1006
+ ).returns(T.attached_class)
1007
+ end
1008
+ def self.new(
1009
+ # Per unit rate for usage whose dimension value has no configured tiers
1010
+ default_unit_amount:,
1011
+ # The billable metric property used to group usage before tiering
1012
+ dimension:,
1013
+ # Graduated tiers keyed by dimension value; usage for a value is tiered only
1014
+ # against its own rows
1015
+ tiers:
1016
+ )
1017
+ end
1018
+
1019
+ sig do
1020
+ override.returns(
1021
+ {
1022
+ default_unit_amount: String,
1023
+ dimension: String,
1024
+ tiers:
1025
+ T::Array[
1026
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig::Tier
1027
+ ]
1028
+ }
1029
+ )
1030
+ end
1031
+ def to_hash
1032
+ end
1033
+
1034
+ class Tier < Orb::Internal::Type::BaseModel
1035
+ OrHash =
1036
+ T.type_alias do
1037
+ T.any(
1038
+ Orb::PriceCreateParams::Body::GroupedTieredMatrix::GroupedTieredMatrixConfig::Tier,
1039
+ Orb::Internal::AnyHash
1040
+ )
1041
+ end
1042
+
1043
+ # The dimension value this tier applies to
1044
+ sig { returns(String) }
1045
+ attr_accessor :dimension_value
1046
+
1047
+ sig { returns(String) }
1048
+ attr_accessor :tier_lower_bound
1049
+
1050
+ # Per unit amount
1051
+ sig { returns(String) }
1052
+ attr_accessor :unit_amount
1053
+
1054
+ # Configuration for a single tier scoped to a dimension value
1055
+ sig do
1056
+ params(
1057
+ dimension_value: String,
1058
+ tier_lower_bound: String,
1059
+ unit_amount: String
1060
+ ).returns(T.attached_class)
1061
+ end
1062
+ def self.new(
1063
+ # The dimension value this tier applies to
1064
+ dimension_value:,
1065
+ tier_lower_bound:,
1066
+ # Per unit amount
1067
+ unit_amount:
1068
+ )
1069
+ end
1070
+
1071
+ sig do
1072
+ override.returns(
1073
+ {
1074
+ dimension_value: String,
1075
+ tier_lower_bound: String,
1076
+ unit_amount: String
1077
+ }
1078
+ )
1079
+ end
1080
+ def to_hash
1081
+ end
1082
+ end
1083
+ end
1084
+ end
1085
+
655
1086
  class MatrixWithThresholdDiscounts < Orb::Internal::Type::BaseModel
656
1087
  OrHash =
657
1088
  T.type_alias do