Class: DevDraftAI::CustomersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/devdraft/api/customers_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CustomersApi

Returns a new instance of CustomersApi.



16
17
18
# File 'lib/devdraft/api/customers_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/devdraft/api/customers_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#customer_controller_create(body, opts = {}) ⇒ nil

Create a new customer Creates a new customer in the system with their personal and contact information. This endpoint allows you to register new customers and store their details for future transactions. ## Use Cases - Register new customers for payment processing - Store customer information for recurring payments - Maintain customer profiles for transaction history ## Example: Create New Customer “‘json { "firstName": "John", "lastName": "Doe", "email": "[email protected]", "phone": "+1234567890", "address": { "street": "123 Main St", "city": "New York", "state": "NY", "zipCode": "10001", "country": "USA" } } “` ## Required Fields - `firstName`: Customer’s first name - ‘lastName`: Customer’s last name - ‘email`: Valid email address (must be unique) ## Optional Fields - `phone`: Contact phone number - `address`: Complete address information - `street`: Street address - `city`: City name - `state`: State/province - `zipCode`: Postal/ZIP code - `country`: Country name

Parameters:

  • body

    Customer creation data

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


24
25
26
27
# File 'lib/devdraft/api/customers_api.rb', line 24

def customer_controller_create(body, opts = {})
  customer_controller_create_with_http_info(body, opts)
  nil
end

#customer_controller_create_with_http_info(body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create a new customer Creates a new customer in the system with their personal and contact information. This endpoint allows you to register new customers and store their details for future transactions. ## Use Cases - Register new customers for payment processing - Store customer information for recurring payments - Maintain customer profiles for transaction history ## Example: Create New Customer &#x60;&#x60;&#x60;json { &quot;firstName&quot;: &quot;John&quot;, &quot;lastName&quot;: &quot;Doe&quot;, &quot;email&quot;: &quot;[email protected]&quot;, &quot;phone&quot;: &quot;+1234567890&quot;, &quot;address&quot;: { &quot;street&quot;: &quot;123 Main St&quot;, &quot;city&quot;: &quot;New York&quot;, &quot;state&quot;: &quot;NY&quot;, &quot;zipCode&quot;: &quot;10001&quot;, &quot;country&quot;: &quot;USA&quot; } } &#x60;&#x60;&#x60; ## Required Fields - &#x60;firstName&#x60;: Customer&#x27;s first name - &#x60;lastName&#x60;: Customer&#x27;s last name - &#x60;email&#x60;: Valid email address (must be unique) ## Optional Fields - &#x60;phone&#x60;: Contact phone number - &#x60;address&#x60;: Complete address information - &#x60;street&#x60;: Street address - &#x60;city&#x60;: City name - &#x60;state&#x60;: State/province - &#x60;zipCode&#x60;: Postal/ZIP code - &#x60;country&#x60;: Country name

Parameters:

  • body

    Customer creation data

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/devdraft/api/customers_api.rb', line 34

def customer_controller_create_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomersApi.customer_controller_create ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling CustomersApi.customer_controller_create"
  end
  # resource path
  local_var_path = '/api/v0/customers'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomersApi#customer_controller_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#customer_controller_find_all(opts = {}) ⇒ nil

Get all customers with filters Retrieves a list of customers with optional filtering and pagination. This endpoint allows you to search and filter customers based on various criteria. ## Use Cases - List all customers with pagination - Search customers by name or email - Filter customers by status - Export customer data ## Query Parameters - ‘skip`: Number of records to skip (default: 0) - `take`: Number of records to take (default: 10) - `status`: Filter by customer status (ACTIVE, INACTIVE, SUSPENDED) - `name`: Filter by customer name (partial match) - `email`: Filter by customer email (exact match) ## Example Response “`json { "data": [ { "id": "cust_123456", "firstName": "John", "lastName": "Doe", "email": "[email protected]", "status": "ACTIVE", "createdAt": "2024-03-20T10:00:00Z" } ], "total": 100, "skip": 0, "take": 10 } “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Filter by customer status

  • :name (String)

    Filter by customer name

  • :email (String)

    Filter by customer email

  • :take (BigDecimal)

    Number of records to take

  • :skip (BigDecimal)

    Number of records to skip

Returns:

  • (nil)


84
85
86
87
# File 'lib/devdraft/api/customers_api.rb', line 84

def customer_controller_find_all(opts = {})
  customer_controller_find_all_with_http_info(opts)
  nil
end

#customer_controller_find_all_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get all customers with filters Retrieves a list of customers with optional filtering and pagination. This endpoint allows you to search and filter customers based on various criteria. ## Use Cases - List all customers with pagination - Search customers by name or email - Filter customers by status - Export customer data ## Query Parameters - &#x60;skip&#x60;: Number of records to skip (default: 0) - &#x60;take&#x60;: Number of records to take (default: 10) - &#x60;status&#x60;: Filter by customer status (ACTIVE, INACTIVE, SUSPENDED) - &#x60;name&#x60;: Filter by customer name (partial match) - &#x60;email&#x60;: Filter by customer email (exact match) ## Example Response &#x60;&#x60;&#x60;json { &quot;data&quot;: [ { &quot;id&quot;: &quot;cust_123456&quot;, &quot;firstName&quot;: &quot;John&quot;, &quot;lastName&quot;: &quot;Doe&quot;, &quot;email&quot;: &quot;[email protected]&quot;, &quot;status&quot;: &quot;ACTIVE&quot;, &quot;createdAt&quot;: &quot;2024-03-20T10:00:00Z&quot; } ], &quot;total&quot;: 100, &quot;skip&quot;: 0, &quot;take&quot;: 10 } &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Filter by customer status

  • :name (String)

    Filter by customer name

  • :email (String)

    Filter by customer email

  • :take (BigDecimal)

    Number of records to take

  • :skip (BigDecimal)

    Number of records to skip

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/devdraft/api/customers_api.rb', line 98

def customer_controller_find_all_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomersApi.customer_controller_find_all ...'
  end
  if @api_client.config.client_side_validation && opts[:'status'] && !['ACTIVE', 'BLACKLISTED', 'DEACTIVATED'].include?(opts[:'status'])
    fail ArgumentError, 'invalid value for "status", must be one of ACTIVE, BLACKLISTED, DEACTIVATED'
  end
  # resource path
  local_var_path = '/api/v0/customers'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?
  query_params[:'take'] = opts[:'take'] if !opts[:'take'].nil?
  query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomersApi#customer_controller_find_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#customer_controller_find_one(id, opts = {}) ⇒ nil

Get a customer by ID Retrieves detailed information about a specific customer. This endpoint allows you to fetch complete customer details including their address and contact information. ## Use Cases - View customer details - Verify customer information - Update customer records ## Example Response “‘json { "id": "cust_123456", "firstName": "John", "lastName": "Doe", "email": "[email protected]", "phone": "+1234567890", "status": "ACTIVE", "address": { "street": "123 Main St", "city": "New York", "state": "NY", "zipCode": "10001", "country": "USA" }, "createdAt": "2024-03-20T10:00:00Z", "updatedAt": "2024-03-20T10:00:00Z" } “`

Parameters:

  • id
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


146
147
148
149
# File 'lib/devdraft/api/customers_api.rb', line 146

def customer_controller_find_one(id, opts = {})
  customer_controller_find_one_with_http_info(id, opts)
  nil
end

#customer_controller_find_one_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get a customer by ID Retrieves detailed information about a specific customer. This endpoint allows you to fetch complete customer details including their address and contact information. ## Use Cases - View customer details - Verify customer information - Update customer records ## Example Response &#x60;&#x60;&#x60;json { &quot;id&quot;: &quot;cust_123456&quot;, &quot;firstName&quot;: &quot;John&quot;, &quot;lastName&quot;: &quot;Doe&quot;, &quot;email&quot;: &quot;[email protected]&quot;, &quot;phone&quot;: &quot;+1234567890&quot;, &quot;status&quot;: &quot;ACTIVE&quot;, &quot;address&quot;: { &quot;street&quot;: &quot;123 Main St&quot;, &quot;city&quot;: &quot;New York&quot;, &quot;state&quot;: &quot;NY&quot;, &quot;zipCode&quot;: &quot;10001&quot;, &quot;country&quot;: &quot;USA&quot; }, &quot;createdAt&quot;: &quot;2024-03-20T10:00:00Z&quot;, &quot;updatedAt&quot;: &quot;2024-03-20T10:00:00Z&quot; } &#x60;&#x60;&#x60;

Parameters:

  • id
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/devdraft/api/customers_api.rb', line 156

def customer_controller_find_one_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomersApi.customer_controller_find_one ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.customer_controller_find_one"
  end
  # resource path
  local_var_path = '/api/v0/customers/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomersApi#customer_controller_find_one\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#customer_controller_update(body, id, opts = {}) ⇒ nil

Update a customer Updates an existing customer’s information. This endpoint allows you to modify customer details while preserving their core information. ## Use Cases - Update customer contact information - Change customer address - Modify customer status ## Example Request “‘json { "firstName": "John", "lastName": "Smith", "phone": "+1987654321", "address": { "street": "456 Oak St", "city": "Los Angeles", "state": "CA", "zipCode": "90001", "country": "USA" } } “` ## Notes - Only include fields that need to be updated - Email address cannot be changed - Status changes may require additional verification

Parameters:

  • body

    Customer update data

  • id
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


201
202
203
204
# File 'lib/devdraft/api/customers_api.rb', line 201

def customer_controller_update(body, id, opts = {})
  customer_controller_update_with_http_info(body, id, opts)
  nil
end

#customer_controller_update_with_http_info(body, id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update a customer Updates an existing customer&#x27;s information. This endpoint allows you to modify customer details while preserving their core information. ## Use Cases - Update customer contact information - Change customer address - Modify customer status ## Example Request &#x60;&#x60;&#x60;json { &quot;firstName&quot;: &quot;John&quot;, &quot;lastName&quot;: &quot;Smith&quot;, &quot;phone&quot;: &quot;+1987654321&quot;, &quot;address&quot;: { &quot;street&quot;: &quot;456 Oak St&quot;, &quot;city&quot;: &quot;Los Angeles&quot;, &quot;state&quot;: &quot;CA&quot;, &quot;zipCode&quot;: &quot;90001&quot;, &quot;country&quot;: &quot;USA&quot; } } &#x60;&#x60;&#x60; ## Notes - Only include fields that need to be updated - Email address cannot be changed - Status changes may require additional verification

Parameters:

  • body

    Customer update data

  • id
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/devdraft/api/customers_api.rb', line 212

def customer_controller_update_with_http_info(body, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomersApi.customer_controller_update ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling CustomersApi.customer_controller_update"
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CustomersApi.customer_controller_update"
  end
  # resource path
  local_var_path = '/api/v0/customers/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomersApi#customer_controller_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end