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:



98
99
100
# File 'lib/orb/resources/plans/migrations.rb', line 98

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:

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

Returns:

See Also:



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

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:

  • plan_id (String)
  • cursor (String, nil)

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

  • limit (Integer)

    The number of items to fetch. Defaults to 20.

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

Returns:

See Also:



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

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

Fetch migration

Parameters:

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

Returns:

See Also:



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

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