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

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

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:



121
122
123
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 121

def initialize(client:)
  @client = client
end

Instance Method Details

#create(customer_id: , billing_provider_type: , billing_provider_customer_id: , 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:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 34

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:



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 100

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:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/metronome_sdk/resources/v1/customers/billing_config.rb', line 67

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