Class: MetronomeSDK::Resources::V1::Plans
- Inherits:
-
Object
- Object
- MetronomeSDK::Resources::V1::Plans
- Defined in:
- lib/metronome_sdk/resources/v1/plans.rb
Overview
[Plans](docs.metronome.com/pricing-and-packaging/create-plans/) determine the base pricing for a customer. Use these endpoints to add a plan to a customer, end a customer plan, retrieve plans, and retrieve plan details. Create plans in the [Metronome app](app.metronome.com/plans).
Instance Method Summary collapse
-
#get_details(plan_id:, request_options: {}) ⇒ MetronomeSDK::Models::V1::PlanGetDetailsResponse
Fetch high level details of a specific plan.
-
#initialize(client:) ⇒ Plans
constructor
private
A new instance of Plans.
-
#list(limit: nil, next_page: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::PlanListResponse>
List all available plans.
-
#list_charges(plan_id:, limit: nil, next_page: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::PlanListChargesResponse>
Fetches a list of charges of a specific plan.
-
#list_customers(plan_id:, limit: nil, next_page: nil, status: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::PlanListCustomersResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListCustomersParams for more details.
Constructor Details
#initialize(client:) ⇒ Plans
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 Plans.
138 139 140 |
# File 'lib/metronome_sdk/resources/v1/plans.rb', line 138 def initialize(client:) @client = client end |
Instance Method Details
#get_details(plan_id:, request_options: {}) ⇒ MetronomeSDK::Models::V1::PlanGetDetailsResponse
Fetch high level details of a specific plan. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/metronome_sdk/resources/v1/plans.rb', line 49 def get_details(params) parsed, = MetronomeSDK::V1::PlanGetDetailsParams.dump_request(params) plan_id = parsed.delete(:plan_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/planDetails/%1$s", plan_id], model: MetronomeSDK::Models::V1::PlanGetDetailsResponse, options: ) end |
#list(limit: nil, next_page: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::PlanListResponse>
List all available plans. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/metronome_sdk/resources/v1/plans.rb', line 25 def list(params = {}) parsed, = MetronomeSDK::V1::PlanListParams.dump_request(params) query = MetronomeSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/plans", query: query, page: MetronomeSDK::Internal::CursorPage, model: MetronomeSDK::Models::V1::PlanListResponse, options: ) end |
#list_charges(plan_id:, limit: nil, next_page: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::PlanListChargesResponse>
Fetches a list of charges of a specific plan. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/metronome_sdk/resources/v1/plans.rb', line 79 def list_charges(params) parsed, = MetronomeSDK::V1::PlanListChargesParams.dump_request(params) query = MetronomeSDK::Internal::Util.encode_query_params(parsed) plan_id = parsed.delete(:plan_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/planDetails/%1$s/charges", plan_id], query: query, page: MetronomeSDK::Internal::CursorPage, model: MetronomeSDK::Models::V1::PlanListChargesResponse, options: ) end |
#list_customers(plan_id:, limit: nil, next_page: nil, status: nil, request_options: {}) ⇒ MetronomeSDK::Internal::CursorPage<MetronomeSDK::Models::V1::PlanListCustomersResponse>
Some parameter documentations has been truncated, see Models::V1::PlanListCustomersParams for more details.
Fetches a list of customers on a specific plan (by default, only currently active plans are included). This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/metronome_sdk/resources/v1/plans.rb', line 118 def list_customers(params) parsed, = MetronomeSDK::V1::PlanListCustomersParams.dump_request(params) query = MetronomeSDK::Internal::Util.encode_query_params(parsed) plan_id = parsed.delete(:plan_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/planDetails/%1$s/customers", plan_id], query: query, page: MetronomeSDK::Internal::CursorPage, model: MetronomeSDK::Models::V1::PlanListCustomersResponse, options: ) end |