Class: Google::Apis::CloudbillingV1::PricingExpression
- Inherits:
-
Object
- Object
- Google::Apis::CloudbillingV1::PricingExpression
- Defined in:
- generated/google/apis/cloudbilling_v1/classes.rb,
generated/google/apis/cloudbilling_v1/representations.rb,
generated/google/apis/cloudbilling_v1/representations.rb
Overview
Expresses a mathematical pricing formula. For Example:-
usage_unit: GBy
tiered_rates:
[start_usage_amount: 20, unit_price: $10]
[start_usage_amount: 100, unit_price: $5]
The above expresses a pricing formula where the first 20GB is free, the
next 80GB is priced at $10 per GB followed by $5 per GB for additional
usage.
Instance Attribute Summary collapse
-
#base_unit ⇒ String
The base unit for the SKU which is the unit used in usage exports.
-
#base_unit_conversion_factor ⇒ Float
Conversion factor for converting from price per usage_unit to price per base_unit, and start_usage_amount to start_usage_amount in base_unit.
-
#base_unit_description ⇒ String
The base unit in human readable form.
-
#display_quantity ⇒ Float
The recommended quantity of units for displaying pricing info.
-
#tiered_rates ⇒ Array<Google::Apis::CloudbillingV1::TierRate>
The list of tiered rates for this pricing.
-
#usage_unit ⇒ String
The short hand for unit of usage this pricing is specified in.
-
#usage_unit_description ⇒ String
The unit of usage in human readable form.
Instance Method Summary collapse
-
#initialize(**args) ⇒ PricingExpression
constructor
A new instance of PricingExpression.
-
#update!(**args) ⇒ Object
Update properties of this object.
Methods included from Google::Apis::Core::JsonObjectSupport
Methods included from Google::Apis::Core::Hashable
Constructor Details
#initialize(**args) ⇒ PricingExpression
Returns a new instance of PricingExpression
650 651 652 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 650 def initialize(**args) update!(**args) end |
Instance Attribute Details
#base_unit ⇒ String
The base unit for the SKU which is the unit used in usage exports.
Example: "By"
Corresponds to the JSON property baseUnit
602 603 604 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 602 def base_unit @base_unit end |
#base_unit_conversion_factor ⇒ Float
Conversion factor for converting from price per usage_unit to price per
base_unit, and start_usage_amount to start_usage_amount in base_unit.
unit_price / base_unit_conversion_factor = price per base_unit.
start_usage_amount * base_unit_conversion_factor = start_usage_amount in
base_unit.
Corresponds to the JSON property baseUnitConversionFactor
611 612 613 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 611 def base_unit_conversion_factor @base_unit_conversion_factor end |
#base_unit_description ⇒ String
The base unit in human readable form.
Example: "byte".
Corresponds to the JSON property baseUnitDescription
617 618 619 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 617 def base_unit_description @base_unit_description end |
#display_quantity ⇒ Float
The recommended quantity of units for displaying pricing info. When
displaying pricing info it is recommended to display:
(unit_price * display_quantity) per display_quantity usage_unit.
This field does not affect the pricing formula and is for display purposes
only.
Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
the display_quantity is "1000" then the recommended way of displaying the
pricing info is "0.10 USD per 1000 GB"
Corresponds to the JSON property displayQuantity
629 630 631 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 629 def display_quantity @display_quantity end |
#tiered_rates ⇒ Array<Google::Apis::CloudbillingV1::TierRate>
The list of tiered rates for this pricing. The total cost is computed by
applying each of the tiered rates on usage. This repeated list is sorted
by ascending order of start_usage_amount.
Corresponds to the JSON property tieredRates
636 637 638 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 636 def tiered_rates @tiered_rates end |
#usage_unit ⇒ String
The short hand for unit of usage this pricing is specified in.
Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
Corresponds to the JSON property usageUnit
642 643 644 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 642 def usage_unit @usage_unit end |
#usage_unit_description ⇒ String
The unit of usage in human readable form.
Example: "gibi byte".
Corresponds to the JSON property usageUnitDescription
648 649 650 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 648 def usage_unit_description @usage_unit_description end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
655 656 657 658 659 660 661 662 663 |
# File 'generated/google/apis/cloudbilling_v1/classes.rb', line 655 def update!(**args) @base_unit = args[:base_unit] if args.key?(:base_unit) @base_unit_conversion_factor = args[:base_unit_conversion_factor] if args.key?(:base_unit_conversion_factor) @base_unit_description = args[:base_unit_description] if args.key?(:base_unit_description) @display_quantity = args[:display_quantity] if args.key?(:display_quantity) @tiered_rates = args[:tiered_rates] if args.key?(:tiered_rates) @usage_unit = args[:usage_unit] if args.key?(:usage_unit) @usage_unit_description = args[:usage_unit_description] if args.key?(:usage_unit_description) end |