Class: MetronomeSDK::Resources::V1::Contracts::RateCards::Rates

Inherits:
Object
  • Object
show all
Defined in:
lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Rates

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Rates.

Parameters:



135
136
137
# File 'lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb', line 135

def initialize(client:)
  @client = client
end

Instance Method Details

#add(entitled: , product_id: , rate_card_id: , rate_type: , starting_at: , billing_frequency: nil, commit_rate: nil, credit_type_id: nil, custom_rate: nil, ending_before: nil, is_prorated: nil, price: nil, pricing_group_values: nil, quantity: nil, tiers: nil, use_list_prices: nil, request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::RateCards::RateAddResponse

Some parameter documentations has been truncated, see Models::V1::Contracts::RateCards::RateAddParams for more details.

Add a new rate

Parameters:

  • entitled (Boolean)
  • product_id (String)

    ID of the product to add a rate for

  • rate_card_id (String)

    ID of the rate card to update

  • rate_type (Symbol, MetronomeSDK::Models::V1::Contracts::RateCards::RateAddParams::RateType)
  • starting_at (Time)

    inclusive effective date

  • billing_frequency (Symbol, MetronomeSDK::Models::V1::Contracts::RateCards::RateAddParams::BillingFrequency)

    Optional. Frequency to bill subscriptions with. Required for subscription type p

  • commit_rate (MetronomeSDK::Models::CommitRate)

    A distinct rate on the rate card. You can choose to use this rate rather than li

  • credit_type_id (String)

    The Metronome ID of the credit type to associate with price, defaults to USD (ce

  • custom_rate (Hash{Symbol=>Object})

    Only set for CUSTOM rate_type. This field is interpreted by custom rate processo

  • ending_before (Time)

    exclusive end date

  • is_prorated (Boolean)

    Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be

  • price (Float)

    Default price. For FLAT and SUBSCRIPTION rate_type, this must be >=0. For PERCEN

  • pricing_group_values (Hash{Symbol=>String})

    Optional. List of pricing group key value pairs which will be used to calculate

  • quantity (Float)

    Default quantity. For SUBSCRIPTION rate_type, this must be >=0.

  • tiers (Array<MetronomeSDK::Models::Tier>)

    Only set for TIERED rate_type.

  • use_list_prices (Boolean)

    Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed

  • request_options (MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



99
100
101
102
103
104
105
106
107
108
# File 'lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb', line 99

def add(params)
  parsed, options = MetronomeSDK::V1::Contracts::RateCards::RateAddParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/contract-pricing/rate-cards/addRate",
    body: parsed,
    model: MetronomeSDK::Models::V1::Contracts::RateCards::RateAddResponse,
    options: options
  )
end

#add_many(rate_card_id: , rates: , request_options: {}) ⇒ MetronomeSDK::Models::V1::Contracts::RateCards::RateAddManyResponse

Add new rates



121
122
123
124
125
126
127
128
129
130
# File 'lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb', line 121

def add_many(params)
  parsed, options = MetronomeSDK::V1::Contracts::RateCards::RateAddManyParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/contract-pricing/rate-cards/addRates",
    body: parsed,
    model: MetronomeSDK::Models::V1::Contracts::RateCards::RateAddManyResponse,
    options: options
  )
end

#list(at: , rate_card_id: , limit: nil, next_page: nil, selectors: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::Contracts::RateCards::RateListResponse>

Some parameter documentations has been truncated, see Models::V1::Contracts::RateCards::RateListParams for more details.

Understand the rate schedule at a given timestamp, optionally filtering the list of rates returned based on properties such as ‘product_id` and `pricing_group_values`. For example, you may want to display the current price for a given product in your product experience - use this endpoint to fetch that information from its source of truth in Metronome.

If you want to understand the rates for a specific customer’s contract, inclusive of contract-level overrides, use the ‘getContractRateSchedule` endpoint.

Parameters:

  • at (Time)

    Body param: inclusive starting point for the rates schedule

  • rate_card_id (String)

    Body param: ID of the rate card to get the schedule for

  • limit (Integer)

    Query param: Max number of results that should be returned

  • next_page (String)

    Query param: Cursor that indicates where the next page of results should start.

  • selectors (Array<MetronomeSDK::Models::V1::Contracts::RateCards::RateListParams::Selector>)

    Body param: List of rate selectors, rates matching ANY of the selector will be i

  • request_options (MetronomeSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/metronome_sdk/resources/v1/contracts/rate_cards/rates.rb', line 40

def list(params)
  parsed, options = MetronomeSDK::V1::Contracts::RateCards::RateListParams.dump_request(params)
  query_params = [:limit, :next_page]
  @client.request(
    method: :post,
    path: "v1/contract-pricing/rate-cards/getRates",
    query: parsed.slice(*query_params),
    body: parsed.except(*query_params),
    page: MetronomeSDK::Internal::CursorPage,
    model: MetronomeSDK::Models::V1::Contracts::RateCards::RateListResponse,
    options: options
  )
end