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

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

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:



60
61
62
# File 'lib/orb/resources/prices/external_price_id.rb', line 60

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](/api-reference/price/create-price) for more information about external price aliases.



48
49
50
51
52
53
54
55
# File 'lib/orb/resources/prices/external_price_id.rb', line 48

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.



25
26
27
28
29
30
31
32
33
34
# File 'lib/orb/resources/prices/external_price_id.rb', line 25

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