Class: Stripe::V2::Billing::RateCardModifyRatesParams::RatesToCreate

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb

Defined Under Namespace

Classes: MeteredItemData, Tier, TransformQuantity

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

attr_accessor, coerce_params, coerce_value, new, #to_h

Constructor Details

#initialize(metadata: nil, metered_item: nil, metered_item_data: nil, tiering_mode: nil, tiers: nil, transform_quantity: nil, unit_amount: nil) ⇒ RatesToCreate

Returns a new instance of RatesToCreate.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 110

def initialize(
  metadata: nil,
  metered_item: nil,
  metered_item_data: nil,
  tiering_mode: nil,
  tiers: nil,
  transform_quantity: nil,
  unit_amount: nil
)
  @metadata = 
  @metered_item = metered_item
  @metered_item_data = metered_item_data
  @tiering_mode = tiering_mode
  @tiers = tiers
  @transform_quantity = transform_quantity
  @unit_amount = unit_amount
end

Instance Attribute Details

#metadataObject

Set of [key-value pairs](/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



93
94
95
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 93

def 
  @metadata
end

#metered_itemObject

The Metered Item that this rate binds to. Cannot be set if ‘metered_item_data` is provided, and must be set if it isn’t.



95
96
97
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 95

def metered_item
  @metered_item
end

#metered_item_dataObject

The data to create a metered item that binds to this rate. Cannot be set if ‘metered_item` is provided, and must be set if it isn’t.



97
98
99
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 97

def metered_item_data
  @metered_item_data
end

#tiering_modeObject

Defines whether the tiered price should be graduated or volume-based. In volume-based tiering, the maximum quantity within a period determines the per-unit price. In graduated tiering, the pricing changes as the quantity grows into new tiers. Can only be set if ‘tiers` is set.



101
102
103
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 101

def tiering_mode
  @tiering_mode
end

#tiersObject

Each element represents a pricing tier. Cannot be set if ‘unit_amount` is provided.



103
104
105
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 103

def tiers
  @tiers
end

#transform_quantityObject

Apply a transformation to the reported usage or set quantity before computing the amount billed.



105
106
107
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 105

def transform_quantity
  @transform_quantity
end

#unit_amountObject

The per-unit amount to be charged, represented as a decimal string in minor currency units with at most 12 decimal places. Cannot be set if ‘tiers` is provided.



108
109
110
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 108

def unit_amount
  @unit_amount
end

Class Method Details

.field_encodingsObject



128
129
130
131
132
133
134
135
136
# File 'lib/stripe/params/v2/billing/rate_card_modify_rates_params.rb', line 128

def self.field_encodings
  @field_encodings = {
    tiers: {
      kind: :array,
      element: { kind: :object, fields: { up_to_decimal: :decimal_string } },
    },
    transform_quantity: { kind: :object, fields: { divide_by: :int64_string } },
  }
end