Class: Orb::Resources::Prices::ExternalPriceID

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/resources/prices/external_price_id.rb,
sig/orb/resources/prices/external_price_id.rbs

Overview

The Price resource represents a price that can be billed on a subscription, resulting in a charge on an invoice in the form of an invoice line item. Prices take a quantity and determine an amount to bill.

Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given Price object. The model_type field determines the key for the configuration object that is present.

For more on the types of prices, see the core concepts documentation

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ExternalPriceID

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 ExternalPriceID.

Parameters:



70
71
72
# File 'lib/orb/resources/prices/external_price_id.rb', line 70

def initialize(client:)
  @client = client
end

Instance Method Details

#fetch(external_price_id, request_options: {}) ⇒ Orb::Models::Price::Unit, ...

This endpoint returns a price given an external price id. See the price creation API for more information about external price aliases.

Parameters:

Returns:

See Also:



58
59
60
61
62
63
64
65
# File 'lib/orb/resources/prices/external_price_id.rb', line 58

def fetch(external_price_id, params = {})
  @client.request(
    method: :get,
    path: ["prices/external_price_id/%1$s", external_price_id],
    model: Orb::Price,
    options: params[:request_options]
  )
end

#update(external_price_id, metadata: nil, request_options: {}) ⇒ Orb::Models::Price::Unit, ...

Some parameter documentations has been truncated, see Models::Prices::ExternalPriceIDUpdateParams for more details.

This endpoint allows you to update the metadata property on a price. If you pass null for the metadata value, it will clear any existing metadata for that price.

Parameters:

  • external_price_id (String)
  • metadata (Hash{Symbol=>String, nil}, nil)

    User-specified key/value pairs for the resource. Individual keys can be removed

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

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
# File 'lib/orb/resources/prices/external_price_id.rb', line 35

def update(external_price_id, params = {})
  parsed, options = Orb::Prices::ExternalPriceIDUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["prices/external_price_id/%1$s", external_price_id],
    body: parsed,
    model: Orb::Price,
    options: options
  )
end