Class: Orb::Resources::Plans::Migrations

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/resources/plans/migrations.rb,
sig/orb/resources/plans/migrations.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.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Migrations

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

Parameters:

API:

  • private



100
101
102
# File 'lib/orb/resources/plans/migrations.rb', line 100

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(migration_id, plan_id:, request_options: {}) ⇒ Orb::Models::Plans::MigrationCancelResponse

This endpoint cancels a migration.

Parameters:

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/orb/resources/plans/migrations.rb', line 83

def cancel(migration_id, params)
  parsed, options = Orb::Plans::MigrationCancelParams.dump_request(params)
  plan_id =
    parsed.delete(:plan_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["plans/%1$s/migrations/%2$s/cancel", plan_id, migration_id],
    model: Orb::Models::Plans::MigrationCancelResponse,
    options: options
  )
end

#list(plan_id, cursor: nil, limit: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::Plans::MigrationListResponse>

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

This endpoint returns a list of all migrations for a plan. The list of migrations is ordered starting from the most recently created migration. The response also includes pagination_metadata, which lets the caller retrieve the next page of results if they exist.

Parameters:

  • Cursor for pagination. This can be populated by the next_cursor value returned

  • The number of items to fetch. Defaults to 20.

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/orb/resources/plans/migrations.rb', line 59

def list(plan_id, params = {})
  parsed, options = Orb::Plans::MigrationListParams.dump_request(params)
  query = Orb::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["plans/%1$s/migrations", plan_id],
    query: query,
    page: Orb::Internal::Page,
    model: Orb::Models::Plans::MigrationListResponse,
    options: options
  )
end

#retrieve(migration_id, plan_id:, request_options: {}) ⇒ Orb::Models::Plans::MigrationRetrieveResponse

This endpoint returns a migration for a plan, identified by its ID. A migration moves a plan's subscriptions onto a new version of that plan; the response reports the effective time it is scheduled for and its current status.

Parameters:

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/orb/resources/plans/migrations.rb', line 24

def retrieve(migration_id, params)
  parsed, options = Orb::Plans::MigrationRetrieveParams.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/migrations/%2$s", plan_id, migration_id],
    model: Orb::Models::Plans::MigrationRetrieveResponse,
    options: options
  )
end