Class: Orb::Resources::Plans::ExternalPlanID

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/resources/plans/external_plan_id.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ExternalPlanID

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

Parameters:



76
77
78
# File 'lib/orb/resources/plans/external_plan_id.rb', line 76

def initialize(client:)
  @client = client
end

Instance Method Details

#fetch(external_plan_id, request_options: {}) ⇒ Orb::Models::Plan

This endpoint is used to fetch [plan](/core-concepts##plan-and-price) details given an external_plan_id identifier. It returns information about the prices included in the plan and their configuration, as well as the product that the plan is attached to.

If multiple plans are found to contain the specified external_plan_id, the active plans will take priority over archived ones, and among those, the endpoint will return the most recently created plan.

## Serialized prices

Orb supports a few different pricing models out of the box. Each of these models is serialized differently in a given [Price](/core-concepts#plan-and-price) object. The ‘model_type` field determines the key for the configuration object that is present. A detailed explanation of price types can be found in the [Price schema](/core-concepts#plan-and-price). “

Parameters:

Returns:

See Also:



64
65
66
67
68
69
70
71
# File 'lib/orb/resources/plans/external_plan_id.rb', line 64

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

#update(other_external_plan_id, external_plan_id: nil, metadata: nil, request_options: {}) ⇒ Orb::Models::Plan

Some parameter documentations has been truncated, see Models::Plans::ExternalPlanIDUpdateParams for more details.

This endpoint can be used to update the ‘external_plan_id`, and `metadata` of an existing plan.

Other fields on a plan are currently immutable.

Parameters:

  • other_external_plan_id (String)
  • external_plan_id (String, nil)

    An optional user-defined ID for this plan resource, used throughout the system a

  • 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:



28
29
30
31
32
33
34
35
36
37
# File 'lib/orb/resources/plans/external_plan_id.rb', line 28

def update(other_external_plan_id, params = {})
  parsed, options = Orb::Plans::ExternalPlanIDUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["plans/external_plan_id/%1$s", other_external_plan_id],
    body: parsed,
    model: Orb::Plan,
    options: options
  )
end