Class: Orb::Resources::Beta

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

Defined Under Namespace

Classes: ExternalPlanID

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Parameters:



109
110
111
112
# File 'lib/orb/resources/beta.rb', line 109

def initialize(client:)
  @client = client
  @external_plan_id = Orb::Resources::Beta::ExternalPlanID.new(client: client)
end

Instance Attribute Details

#external_plan_idOrb::Resources::Beta::ExternalPlanID (readonly)



7
8
9
# File 'lib/orb/resources/beta.rb', line 7

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 API endpoint is in beta and its interface may change. It is recommended for use only in test mode.

This endpoint allows the creation of a new plan version for an existing plan.

Parameters:

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
# File 'lib/orb/resources/beta.rb', line 39

def create_plan_version(plan_id, params)
  parsed, options = Orb::BetaCreatePlanVersionParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["plans/%1$s/versions", plan_id],
    body: parsed,
    model: Orb::PlanVersion,
    options: options
  )
end

#fetch_plan_version(version, plan_id: , request_options: {}) ⇒ Orb::Models::PlanVersion

This API endpoint is in beta and its interface may change. It is recommended for use only in test mode.

This endpoint is used to fetch a plan version. It returns the phases, prices, and adjustments present on this version of the plan.

Parameters:

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

Returns:

See Also:



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/orb/resources/beta.rb', line 65

def fetch_plan_version(version, params)
  parsed, options = 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: options
  )
end

#set_default_plan_version(plan_id, version: , request_options: {}) ⇒ Orb::Models::Plan

This API endpoint is in beta and its interface may change. It is recommended for use only in test mode.

This endpoint allows setting the default version of a plan.

Parameters:

  • plan_id (String)
  • version (Integer)

    Plan version to set as the default.

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

Returns:

See Also:



95
96
97
98
99
100
101
102
103
104
# File 'lib/orb/resources/beta.rb', line 95

def set_default_plan_version(plan_id, params)
  parsed, options = Orb::BetaSetDefaultPlanVersionParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["plans/%1$s/set_default_version", plan_id],
    body: parsed,
    model: Orb::Plan,
    options: options
  )
end