Class: DevDraftAI::CustomersApi
- Inherits:
-
Object
- Object
- DevDraftAI::CustomersApi
- Defined in:
- lib/devdraft/api/customers_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#customer_controller_create(body, opts = {}) ⇒ nil
Create a new customer Creates a new customer in the system with their personal and contact information.
-
#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.
-
#customer_controller_find_all(opts = {}) ⇒ nil
Get all customers with filters Retrieves a list of customers with optional filtering and pagination.
-
#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.
-
#customer_controller_find_one(id, opts = {}) ⇒ nil
Get a customer by ID Retrieves detailed information about a specific customer.
-
#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.
-
#customer_controller_update(body, id, opts = {}) ⇒ nil
Update a customer Updates an existing customer’s information.
-
#customer_controller_update_with_http_info(body, id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Update a customer Updates an existing customer's information.
-
#initialize(api_client = ApiClient.default) ⇒ CustomersApi
constructor
A new instance of CustomersApi.
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_client ⇒ Object
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
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 ```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
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 } “`
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 - `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 } ```
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" } “`
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 ```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" } ```
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
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'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
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 |