Class: Orb::Resources::Beta
- Inherits:
-
Object
- Object
- Orb::Resources::Beta
- Defined in:
- lib/orb/resources/beta.rb,
lib/orb/resources/beta/external_plan_id.rb,
sig/orb/resources/beta.rbs,
sig/orb/resources/beta/external_plan_id.rbs
Overview
The Plan resource represents a plan that can be subscribed to by a customer. Plans define the billing behavior of the subscription. You can see more about how to configure prices in the Price resource.
Defined Under Namespace
Classes: ExternalPlanID
Instance Attribute Summary collapse
-
#external_plan_id ⇒ Orb::Resources::Beta::ExternalPlanID
readonly
The Plan resource represents a plan that can be subscribed to by a customer.
Instance Method Summary collapse
-
#create_plan_version(plan_id, version:, add_adjustments: nil, add_prices: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, set_as_default: nil, request_options: {}) ⇒ Orb::Models::PlanVersion
This endpoint allows the creation of a new plan version for an existing plan.
-
#fetch_plan_version(version, plan_id:, request_options: {}) ⇒ Orb::Models::PlanVersion
This endpoint is used to fetch a plan version.
-
#initialize(client:) ⇒ Beta
constructor
private
A new instance of Beta.
-
#set_default_plan_version(plan_id, version:, request_options: {}) ⇒ Orb::Models::Plan
This endpoint allows setting the default version of a plan.
Constructor Details
#initialize(client:) ⇒ Beta
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 Beta.
108 109 110 111 |
# File 'lib/orb/resources/beta.rb', line 108 def initialize(client:) @client = client @external_plan_id = Orb::Resources::Beta::ExternalPlanID.new(client: client) end |
Instance Attribute Details
#external_plan_id ⇒ Orb::Resources::Beta::ExternalPlanID (readonly)
The Plan resource represents a plan that can be subscribed to by a customer. Plans define the billing behavior of the subscription. You can see more about how to configure prices in the Price resource.
15 16 17 |
# File 'lib/orb/resources/beta.rb', line 15 def external_plan_id @external_plan_id end |
Instance Method Details
#create_plan_version(plan_id, version:, add_adjustments: nil, add_prices: nil, remove_adjustments: nil, remove_prices: nil, replace_adjustments: nil, replace_prices: nil, set_as_default: nil, request_options: {}) ⇒ Orb::Models::PlanVersion
This endpoint allows the creation of a new plan version for an existing plan.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/orb/resources/beta.rb', line 44 def create_plan_version(plan_id, params) parsed, = Orb::BetaCreatePlanVersionParams.dump_request(params) @client.request( method: :post, path: ["plans/%1$s/versions", plan_id], body: parsed, model: Orb::PlanVersion, options: ) end |
#fetch_plan_version(version, plan_id:, request_options: {}) ⇒ Orb::Models::PlanVersion
This endpoint is used to fetch a plan version. It returns the phases, prices, and adjustments present on this version of the plan.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/orb/resources/beta.rb', line 67 def fetch_plan_version(version, params) parsed, = Orb::BetaFetchPlanVersionParams.dump_request(params) plan_id = parsed.delete(:plan_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["plans/%1$s/versions/%2$s", plan_id, version], model: Orb::PlanVersion, options: ) end |
#set_default_plan_version(plan_id, version:, request_options: {}) ⇒ Orb::Models::Plan
This endpoint allows setting the default version of a plan.
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/orb/resources/beta.rb', line 94 def set_default_plan_version(plan_id, params) parsed, = Orb::BetaSetDefaultPlanVersionParams.dump_request(params) @client.request( method: :post, path: ["plans/%1$s/set_default_version", plan_id], body: parsed, model: Orb::Plan, options: ) end |