Class: MetronomeSDK::Resources::V1::Customers::BillingConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/metronome_sdk/resources/v1/customers/billing_config.rb

Overview

[Customers](docs.metronome.com/provisioning/create-customers/) in Metronome represent your users for all billing and reporting. Use these endpoints to create, retrieve, update, and archive customers and their billing configuration.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ BillingConfig

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

Parameters:



129
130
131
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 129

def initialize(client:)
  @client = client
end

Instance Method Details

#create(customer_id:, billing_provider_type:, billing_provider_customer_id:, aws_customer_account_id: nil, aws_customer_id: nil, aws_product_code: nil, aws_region: nil, stripe_collection_method: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::V1::Customers::BillingConfigCreateParams for more details.

Set the billing configuration for a given customer. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.

Parameters:

Returns:

  • (nil)

See Also:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 42

def create(params)
  parsed, options = MetronomeSDK::V1::Customers::BillingConfigCreateParams.dump_request(params)
  customer_id =
    parsed.delete(:customer_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  billing_provider_type =
    parsed.delete(:billing_provider_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["v1/customers/%1$s/billing-config/%2$s", customer_id, billing_provider_type],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#delete(customer_id:, billing_provider_type:, request_options: {}) ⇒ nil

Delete the billing configuration for a given customer. Note: this is unsupported for Azure and AWS Marketplace customers. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.

Parameters:

Returns:

  • (nil)

See Also:



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 108

def delete(params)
  parsed, options = MetronomeSDK::V1::Customers::BillingConfigDeleteParams.dump_request(params)
  customer_id =
    parsed.delete(:customer_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  billing_provider_type =
    parsed.delete(:billing_provider_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/customers/%1$s/billing-config/%2$s", customer_id, billing_provider_type],
    model: NilClass,
    options: options
  )
end

#retrieve(customer_id:, billing_provider_type:, request_options: {}) ⇒ MetronomeSDK::Models::V1::Customers::BillingConfigRetrieveResponse

Fetch the billing configuration for the given customer. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.

Parameters:

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 75

def retrieve(params)
  parsed, options = MetronomeSDK::V1::Customers::BillingConfigRetrieveParams.dump_request(params)
  customer_id =
    parsed.delete(:customer_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  billing_provider_type =
    parsed.delete(:billing_provider_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/customers/%1$s/billing-config/%2$s", customer_id, billing_provider_type],
    model: MetronomeSDK::Models::V1::Customers::BillingConfigRetrieveResponse,
    options: options
  )
end