Class: Devdraft::CustomersApi
- Inherits:
-
Object
- Object
- Devdraft::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(create_customer_dto, 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(create_customer_dto, 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(id, update_customer_dto, opts = {}) ⇒ nil
Update a customer Updates an existing customer’s information.
-
#customer_controller_update_with_http_info(id, update_customer_dto, 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.
19 20 21 |
# File 'lib/devdraft/api/customers_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/devdraft/api/customers_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#customer_controller_create(create_customer_dto, 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 { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone_number": "+1-555-123-4567", "customer_type": "Startup", "status": "ACTIVE" } “` ## Required Fields - `first_name`: Customer’s first name (1-100 characters) - ‘last_name`: Customer’s last name (1-100 characters) - ‘phone_number`: Customer’s phone number (max 20 characters) ## Optional Fields - ‘email`: Valid email address (max 255 characters) - `customer_type`: Type of customer account (Individual, Startup, Small Business, Medium Business, Enterprise, Non-Profit, Government) - `status`: Customer status (ACTIVE, BLACKLISTED, DEACTIVATED)
27 28 29 30 |
# File 'lib/devdraft/api/customers_api.rb', line 27 def customer_controller_create(create_customer_dto, opts = {}) customer_controller_create_with_http_info(create_customer_dto, opts) nil end |
#customer_controller_create_with_http_info(create_customer_dto, 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 { "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone_number": "+1-555-123-4567", "customer_type": "Startup", "status": "ACTIVE" } ``` ## Required Fields - `first_name`: Customer's first name (1-100 characters) - `last_name`: Customer's last name (1-100 characters) - `phone_number`: Customer's phone number (max 20 characters) ## Optional Fields - `email`: Valid email address (max 255 characters) - `customer_type`: Type of customer account (Individual, Startup, Small Business, Medium Business, Enterprise, Non-Profit, Government) - `status`: Customer status (ACTIVE, BLACKLISTED, DEACTIVATED)
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 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/devdraft/api/customers_api.rb', line 37 def customer_controller_create_with_http_info(create_customer_dto, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomersApi.customer_controller_create ...' end # verify the required parameter 'create_customer_dto' is set if @api_client.config.client_side_validation && create_customer_dto.nil? fail ArgumentError, "Missing the required parameter 'create_customer_dto' 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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_customer_dto) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key'] = opts.merge( :operation => :"CustomersApi.customer_controller_create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) 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, min: 0) - `take`: Number of records to take (default: 10, min: 1, max: 100) - `status`: Filter by customer status (ACTIVE, BLACKLISTED, DEACTIVATED) - `name`: Filter by customer name (partial match, case-insensitive) - `email`: Filter by customer email (exact match, case-insensitive) ## Example Request `GET /api/v0/customers?skip=0&take=20&status=ACTIVE&name=John` ## Example Response “`json { "data": [ { "id": "cust_123456", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone_number": "+1-555-123-4567", "customer_type": "Startup", "status": "ACTIVE", "created_at": "2024-03-20T10:00:00Z", "updated_at": "2024-03-20T10:00:00Z" } ], "total": 100, "skip": 0, "take": 10 } “`
97 98 99 100 |
# File 'lib/devdraft/api/customers_api.rb', line 97 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, min: 0) - `take`: Number of records to take (default: 10, min: 1, max: 100) - `status`: Filter by customer status (ACTIVE, BLACKLISTED, DEACTIVATED) - `name`: Filter by customer name (partial match, case-insensitive) - `email`: Filter by customer email (exact match, case-insensitive) ## Example Request `GET /api/v0/customers?skip=0&take=20&status=ACTIVE&name=John` ## Example Response ```json { "data": [ { "id": "cust_123456", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone_number": "+1-555-123-4567", "customer_type": "Startup", "status": "ACTIVE", "created_at": "2024-03-20T10:00:00Z", "updated_at": "2024-03-20T10:00:00Z" } ], "total": 100, "skip": 0, "take": 10 } ```
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/devdraft/api/customers_api.rb', line 111 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[:'skip'].nil? && opts[:'skip'] < 0 fail ArgumentError, 'invalid value for "opts[:"skip"]" when calling CustomersApi.customer_controller_find_all, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && !opts[:'take'].nil? && opts[:'take'] > 100 fail ArgumentError, 'invalid value for "opts[:"take"]" when calling CustomersApi.customer_controller_find_all, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'take'].nil? && opts[:'take'] < 1 fail ArgumentError, 'invalid value for "opts[:"take"]" when calling CustomersApi.customer_controller_find_all, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'name'].nil? && opts[:'name'].to_s.length > 100 fail ArgumentError, 'invalid value for "opts[:"name"]" when calling CustomersApi.customer_controller_find_all, the character length must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'email'].nil? && opts[:'email'].to_s.length > 255 fail ArgumentError, 'invalid value for "opts[:"email"]" when calling CustomersApi.customer_controller_find_all, the character length must be smaller than or equal to 255.' end # resource path local_var_path = '/api/v0/customers' # query parameters query_params = opts[:query_params] || {} query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil? query_params[:'take'] = opts[:'take'] if !opts[:'take'].nil? 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? # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key'] = opts.merge( :operation => :"CustomersApi.customer_controller_find_all", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) 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 contact information and status. ## Use Cases - View customer details - Verify customer information - Check customer status before processing payments ## Path Parameters - ‘id`: Customer UUID (required) - Must be a valid UUID format ## Example Request `GET /api/v0/customers/123e4567-e89b-12d3-a456-426614174000` ## Example Response “`json { "id": "cust_123456", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone_number": "+1-555-123-4567", "customer_type": "Enterprise", "status": "ACTIVE", "last_spent": 1250.50, "last_purchase_date": "2024-03-15T14:30:00Z", "created_at": "2024-03-20T10:00:00Z", "updated_at": "2024-03-20T10:00:00Z" } “`
183 184 185 186 |
# File 'lib/devdraft/api/customers_api.rb', line 183 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 contact information and status. ## Use Cases - View customer details - Verify customer information - Check customer status before processing payments ## Path Parameters - `id`: Customer UUID (required) - Must be a valid UUID format ## Example Request `GET /api/v0/customers/123e4567-e89b-12d3-a456-426614174000` ## Example Response ```json { "id": "cust_123456", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone_number": "+1-555-123-4567", "customer_type": "Enterprise", "status": "ACTIVE", "last_spent": 1250.50, "last_purchase_date": "2024-03-15T14:30:00Z", "created_at": "2024-03-20T10:00:00Z", "updated_at": "2024-03-20T10:00:00Z" } ```
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 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 |
# File 'lib/devdraft/api/customers_api.rb', line 193 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' + '}', CGI.escape(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[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key'] = opts.merge( :operation => :"CustomersApi.customer_controller_find_one", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) 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(id, update_customer_dto, 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 type - Modify customer status ## Path Parameters - ‘id`: Customer UUID (required) - Must be a valid UUID format ## Example Request `PATCH /api/v0/customers/123e4567-e89b-12d3-a456-426614174000` ## Example Request Body “`json { "first_name": "John", "last_name": "Smith", "phone_number": "+1-987-654-3210", "customer_type": "Small Business" } “` ## Notes - Only include fields that need to be updated - All fields are optional in updates - Status changes may require additional verification
245 246 247 248 |
# File 'lib/devdraft/api/customers_api.rb', line 245 def customer_controller_update(id, update_customer_dto, opts = {}) customer_controller_update_with_http_info(id, update_customer_dto, opts) nil end |
#customer_controller_update_with_http_info(id, update_customer_dto, 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 type - Modify customer status ## Path Parameters - `id`: Customer UUID (required) - Must be a valid UUID format ## Example Request `PATCH /api/v0/customers/123e4567-e89b-12d3-a456-426614174000` ## Example Request Body ```json { "first_name": "John", "last_name": "Smith", "phone_number": "+1-987-654-3210", "customer_type": "Small Business" } ``` ## Notes - Only include fields that need to be updated - All fields are optional in updates - Status changes may require additional verification
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/devdraft/api/customers_api.rb', line 256 def customer_controller_update_with_http_info(id, update_customer_dto, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: 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 # verify the required parameter 'update_customer_dto' is set if @api_client.config.client_side_validation && update_customer_dto.nil? fail ArgumentError, "Missing the required parameter 'update_customer_dto' when calling CustomersApi.customer_controller_update" end # resource path local_var_path = '/api/v0/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_customer_dto) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key'] = opts.merge( :operation => :"CustomersApi.customer_controller_update", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, ) 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 |