=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.15-SNAPSHOT =end require 'addressable/uri' module UltracartClient class CustomerApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false) api_config = Configuration.new api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key api_config.api_version = '2017-03-01' api_config.verify_ssl = verify_ssl api_client = ApiClient.new(api_config) api_client.config.debugging = debugging UltracartClient::CustomerApi.new(api_client) end # Adds store credit to a customer # Adds store credit to a customer # @param customer_profile_oid The customer oid to credit. # @param store_credit_request Store credit to add # @param [Hash] opts the optional parameters # @return [BaseResponse] def add_customer_store_credit(customer_profile_oid, store_credit_request, opts = {}) data, _status_code, _headers = add_customer_store_credit_with_http_info(customer_profile_oid, store_credit_request, opts) data end # Adds store credit to a customer # Adds store credit to a customer # @param customer_profile_oid The customer oid to credit. # @param store_credit_request Store credit to add # @param [Hash] opts the optional parameters # @return [Array<(BaseResponse, Fixnum, Hash)>] BaseResponse data, response status code and response headers def add_customer_store_credit_with_http_info(customer_profile_oid, store_credit_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.add_customer_store_credit ...' end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.add_customer_store_credit" end # verify the required parameter 'store_credit_request' is set if @api_client.config.client_side_validation && store_credit_request.nil? fail ArgumentError, "Missing the required parameter 'store_credit_request' when calling CustomerApi.add_customer_store_credit" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}/store_credit'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(store_credit_request) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'BaseResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#add_customer_store_credit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed. # Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed. # @param customer_profile_oid The customer profile oid # @param adjust_internal_certificate_request adjustInternalCertificateRequest # @param [Hash] opts the optional parameters # @return [AdjustInternalCertificateResponse] def adjust_internal_certificate(customer_profile_oid, adjust_internal_certificate_request, opts = {}) data, _status_code, _headers = adjust_internal_certificate_with_http_info(customer_profile_oid, adjust_internal_certificate_request, opts) data end # Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed. # Updates the cashback balance for a customer by updating the internal gift certificate used, creating the gift certificate if needed. # @param customer_profile_oid The customer profile oid # @param adjust_internal_certificate_request adjustInternalCertificateRequest # @param [Hash] opts the optional parameters # @return [Array<(AdjustInternalCertificateResponse, Fixnum, Hash)>] AdjustInternalCertificateResponse data, response status code and response headers def adjust_internal_certificate_with_http_info(customer_profile_oid, adjust_internal_certificate_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.adjust_internal_certificate ...' end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.adjust_internal_certificate" end # verify the required parameter 'adjust_internal_certificate_request' is set if @api_client.config.client_side_validation && adjust_internal_certificate_request.nil? fail ArgumentError, "Missing the required parameter 'adjust_internal_certificate_request' when calling CustomerApi.adjust_internal_certificate" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}/adjust_cashback_balance'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(adjust_internal_certificate_request) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'AdjustInternalCertificateResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#adjust_internal_certificate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a customer # Delete a customer on the UltraCart account. # @param customer_profile_oid The customer_profile_oid to delete. # @param [Hash] opts the optional parameters # @return [nil] def delete_customer(customer_profile_oid, opts = {}) delete_customer_with_http_info(customer_profile_oid, opts) nil end # Delete a customer # Delete a customer on the UltraCart account. # @param customer_profile_oid The customer_profile_oid to delete. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_customer_with_http_info(customer_profile_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.delete_customer ...' end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.delete_customer" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#delete_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a customer # Retrieves a single customer using the specified customer profile oid. # @param customer_profile_oid The customer oid to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CustomerResponse] def get_customer(customer_profile_oid, opts = {}) data, _status_code, _headers = get_customer_with_http_info(customer_profile_oid, opts) data end # Retrieve a customer # Retrieves a single customer using the specified customer profile oid. # @param customer_profile_oid The customer oid to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CustomerResponse, Fixnum, Hash)>] CustomerResponse data, response status code and response headers def get_customer_with_http_info(customer_profile_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...' end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.get_customer" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomerResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a customer by Email # Retrieves a single customer using the specified customer email address. # @param email The email address of the customer to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CustomerResponse] def get_customer_by_email(email, opts = {}) data, _status_code, _headers = get_customer_by_email_with_http_info(email, opts) data end # Retrieve a customer by Email # Retrieves a single customer using the specified customer email address. # @param email The email address of the customer to retrieve. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CustomerResponse, Fixnum, Hash)>] CustomerResponse data, response status code and response headers def get_customer_by_email_with_http_info(email, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_by_email ...' end # verify the required parameter 'email' is set if @api_client.config.client_side_validation && email.nil? fail ArgumentError, "Missing the required parameter 'email' when calling CustomerApi.get_customer_by_email" end # resource path local_var_path = '/customer/customers/by_email/{email}'.sub('{' + 'email' + '}', email.to_s) # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomerResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customer_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve values needed for a customer profile editor # Retrieve values needed for a customer profile editor. # @param [Hash] opts the optional parameters # @return [CustomerEditorValues] def get_customer_editor_values(opts = {}) data, _status_code, _headers = get_customer_editor_values_with_http_info(opts) data end # Retrieve values needed for a customer profile editor # Retrieve values needed for a customer profile editor. # @param [Hash] opts the optional parameters # @return [Array<(CustomerEditorValues, Fixnum, Hash)>] CustomerEditorValues data, response status code and response headers def get_customer_editor_values_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_editor_values ...' end # resource path local_var_path = '/customer/editor_values' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomerEditorValues') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customer_editor_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve all email lists across all storefronts # Retrieve all email lists across all storefronts # @param [Hash] opts the optional parameters # @return [EmailListsResponse] def get_customer_email_lists(opts = {}) data, _status_code, _headers = get_customer_email_lists_with_http_info(opts) data end # Retrieve all email lists across all storefronts # Retrieve all email lists across all storefronts # @param [Hash] opts the optional parameters # @return [Array<(EmailListsResponse, Fixnum, Hash)>] EmailListsResponse data, response status code and response headers def get_customer_email_lists_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_email_lists ...' end # resource path local_var_path = '/customer/email_lists' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'EmailListsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customer_email_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve the customer store credit accumulated through loyalty programs # Retrieve the customer store credit accumulated through loyalty programs # @param customer_profile_oid The customer oid to retrieve. # @param [Hash] opts the optional parameters # @return [CustomerStoreCreditResponse] def get_customer_store_credit(customer_profile_oid, opts = {}) data, _status_code, _headers = get_customer_store_credit_with_http_info(customer_profile_oid, opts) data end # Retrieve the customer store credit accumulated through loyalty programs # Retrieve the customer store credit accumulated through loyalty programs # @param customer_profile_oid The customer oid to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(CustomerStoreCreditResponse, Fixnum, Hash)>] CustomerStoreCreditResponse data, response status code and response headers def get_customer_store_credit_with_http_info(customer_profile_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_store_credit ...' end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.get_customer_store_credit" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}/store_credit'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomerStoreCreditResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customer_store_credit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve customers # Retrieves customers from the account. If no parameters are specified, all customers will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [String] :email Email # @option opts [String] :qb_class Quickbooks class # @option opts [String] :quickbooks_code Quickbooks code # @option opts [String] :last_modified_dts_start Last modified date start # @option opts [String] :last_modified_dts_end Last modified date end # @option opts [String] :signup_dts_start Signup date start # @option opts [String] :signup_dts_end Signup date end # @option opts [String] :billing_first_name Billing first name # @option opts [String] :billing_last_name Billing last name # @option opts [String] :billing_company Billing company # @option opts [String] :billing_city Billing city # @option opts [String] :billing_state Billing state # @option opts [String] :billing_postal_code Billing postal code # @option opts [String] :billing_country_code Billing country code # @option opts [String] :billing_day_phone Billing day phone # @option opts [String] :billing_evening_phone Billing evening phone # @option opts [String] :shipping_first_name Shipping first name # @option opts [String] :shipping_last_name Shipping last name # @option opts [String] :shipping_company Shipping company # @option opts [String] :shipping_city Shipping city # @option opts [String] :shipping_state Shipping state # @option opts [String] :shipping_postal_code Shipping postal code # @option opts [String] :shipping_country_code Shipping country code # @option opts [String] :shipping_day_phone Shipping day phone # @option opts [String] :shipping_evening_phone Shipping evening phone # @option opts [Integer] :pricing_tier_oid Pricing tier oid # @option opts [String] :pricing_tier_name Pricing tier name # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch customers that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the customers. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CustomersResponse] def get_customers(opts = {}) data, _status_code, _headers = get_customers_with_http_info(opts) data end # Retrieve customers # Retrieves customers from the account. If no parameters are specified, all customers will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [String] :email Email # @option opts [String] :qb_class Quickbooks class # @option opts [String] :quickbooks_code Quickbooks code # @option opts [String] :last_modified_dts_start Last modified date start # @option opts [String] :last_modified_dts_end Last modified date end # @option opts [String] :signup_dts_start Signup date start # @option opts [String] :signup_dts_end Signup date end # @option opts [String] :billing_first_name Billing first name # @option opts [String] :billing_last_name Billing last name # @option opts [String] :billing_company Billing company # @option opts [String] :billing_city Billing city # @option opts [String] :billing_state Billing state # @option opts [String] :billing_postal_code Billing postal code # @option opts [String] :billing_country_code Billing country code # @option opts [String] :billing_day_phone Billing day phone # @option opts [String] :billing_evening_phone Billing evening phone # @option opts [String] :shipping_first_name Shipping first name # @option opts [String] :shipping_last_name Shipping last name # @option opts [String] :shipping_company Shipping company # @option opts [String] :shipping_city Shipping city # @option opts [String] :shipping_state Shipping state # @option opts [String] :shipping_postal_code Shipping postal code # @option opts [String] :shipping_country_code Shipping country code # @option opts [String] :shipping_day_phone Shipping day phone # @option opts [String] :shipping_evening_phone Shipping evening phone # @option opts [Integer] :pricing_tier_oid Pricing tier oid # @option opts [String] :pricing_tier_name Pricing tier name # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. # @option opts [String] :_since Fetch customers that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the customers. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CustomersResponse, Fixnum, Hash)>] CustomersResponse data, response status code and response headers def get_customers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customers ...' end # resource path local_var_path = '/customer/customers' # query parameters query_params = {} query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil? query_params[:'qb_class'] = opts[:'qb_class'] if !opts[:'qb_class'].nil? query_params[:'quickbooks_code'] = opts[:'quickbooks_code'] if !opts[:'quickbooks_code'].nil? query_params[:'last_modified_dts_start'] = opts[:'last_modified_dts_start'] if !opts[:'last_modified_dts_start'].nil? query_params[:'last_modified_dts_end'] = opts[:'last_modified_dts_end'] if !opts[:'last_modified_dts_end'].nil? query_params[:'signup_dts_start'] = opts[:'signup_dts_start'] if !opts[:'signup_dts_start'].nil? query_params[:'signup_dts_end'] = opts[:'signup_dts_end'] if !opts[:'signup_dts_end'].nil? query_params[:'billing_first_name'] = opts[:'billing_first_name'] if !opts[:'billing_first_name'].nil? query_params[:'billing_last_name'] = opts[:'billing_last_name'] if !opts[:'billing_last_name'].nil? query_params[:'billing_company'] = opts[:'billing_company'] if !opts[:'billing_company'].nil? query_params[:'billing_city'] = opts[:'billing_city'] if !opts[:'billing_city'].nil? query_params[:'billing_state'] = opts[:'billing_state'] if !opts[:'billing_state'].nil? query_params[:'billing_postal_code'] = opts[:'billing_postal_code'] if !opts[:'billing_postal_code'].nil? query_params[:'billing_country_code'] = opts[:'billing_country_code'] if !opts[:'billing_country_code'].nil? query_params[:'billing_day_phone'] = opts[:'billing_day_phone'] if !opts[:'billing_day_phone'].nil? query_params[:'billing_evening_phone'] = opts[:'billing_evening_phone'] if !opts[:'billing_evening_phone'].nil? query_params[:'shipping_first_name'] = opts[:'shipping_first_name'] if !opts[:'shipping_first_name'].nil? query_params[:'shipping_last_name'] = opts[:'shipping_last_name'] if !opts[:'shipping_last_name'].nil? query_params[:'shipping_company'] = opts[:'shipping_company'] if !opts[:'shipping_company'].nil? query_params[:'shipping_city'] = opts[:'shipping_city'] if !opts[:'shipping_city'].nil? query_params[:'shipping_state'] = opts[:'shipping_state'] if !opts[:'shipping_state'].nil? query_params[:'shipping_postal_code'] = opts[:'shipping_postal_code'] if !opts[:'shipping_postal_code'].nil? query_params[:'shipping_country_code'] = opts[:'shipping_country_code'] if !opts[:'shipping_country_code'].nil? query_params[:'shipping_day_phone'] = opts[:'shipping_day_phone'] if !opts[:'shipping_day_phone'].nil? query_params[:'shipping_evening_phone'] = opts[:'shipping_evening_phone'] if !opts[:'shipping_evening_phone'].nil? query_params[:'pricing_tier_oid'] = opts[:'pricing_tier_oid'] if !opts[:'pricing_tier_oid'].nil? query_params[:'pricing_tier_name'] = opts[:'pricing_tier_name'] if !opts[:'pricing_tier_name'].nil? query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil? query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil? query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil? query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil? query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomersResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve customers by query # Retrieves customers from the account. If no parameters are specified, all customers will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param customer_query Customer query # @param [Hash] opts the optional parameters # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch customers that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the customers. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CustomersResponse] def get_customers_by_query(customer_query, opts = {}) data, _status_code, _headers = get_customers_by_query_with_http_info(customer_query, opts) data end # Retrieve customers by query # Retrieves customers from the account. If no parameters are specified, all customers will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param customer_query Customer query # @param [Hash] opts the optional parameters # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. # @option opts [String] :_since Fetch customers that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the customers. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CustomersResponse, Fixnum, Hash)>] CustomersResponse data, response status code and response headers def get_customers_by_query_with_http_info(customer_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customers_by_query ...' end # verify the required parameter 'customer_query' is set if @api_client.config.client_side_validation && customer_query.nil? fail ArgumentError, "Missing the required parameter 'customer_query' when calling CustomerApi.get_customers_by_query" end # resource path local_var_path = '/customer/customers/query' # query parameters query_params = {} query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil? query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil? query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil? query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil? query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(customer_query) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomersResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customers_by_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve customers for DataTables plugin # Retrieves customers from the account. If no searches are specified, all customers will be returned. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [DataTablesServerSideResponse] def get_customers_for_data_tables(opts = {}) data, _status_code, _headers = get_customers_for_data_tables_with_http_info(opts) data end # Retrieve customers for DataTables plugin # Retrieves customers from the account. If no searches are specified, all customers will be returned. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(DataTablesServerSideResponse, Fixnum, Hash)>] DataTablesServerSideResponse data, response status code and response headers def get_customers_for_data_tables_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customers_for_data_tables ...' end # resource path local_var_path = '/customer/customers/dataTables' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'DataTablesServerSideResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customers_for_data_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a token that can be used to verify a customer email address # Create a token that can be used to verify a customer email address. The implementation of how a customer interacts with this token is left to the merchant. # @param token_request Token request # @param [Hash] opts the optional parameters # @return [EmailVerifyTokenResponse] def get_email_verification_token(token_request, opts = {}) data, _status_code, _headers = get_email_verification_token_with_http_info(token_request, opts) data end # Create a token that can be used to verify a customer email address # Create a token that can be used to verify a customer email address. The implementation of how a customer interacts with this token is left to the merchant. # @param token_request Token request # @param [Hash] opts the optional parameters # @return [Array<(EmailVerifyTokenResponse, Fixnum, Hash)>] EmailVerifyTokenResponse data, response status code and response headers def get_email_verification_token_with_http_info(token_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_email_verification_token ...' end # verify the required parameter 'token_request' is set if @api_client.config.client_side_validation && token_request.nil? fail ArgumentError, "Missing the required parameter 'token_request' when calling CustomerApi.get_email_verification_token" end # resource path local_var_path = '/customer/customers/email_verify/get_token' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(token_request) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'EmailVerifyTokenResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_email_verification_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Insert a customer # Insert a customer on the UltraCart account. # @param customer Customer to insert # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CustomerResponse] def insert_customer(customer, opts = {}) data, _status_code, _headers = insert_customer_with_http_info(customer, opts) data end # Insert a customer # Insert a customer on the UltraCart account. # @param customer Customer to insert # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CustomerResponse, Fixnum, Hash)>] CustomerResponse data, response status code and response headers def insert_customer_with_http_info(customer, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.insert_customer ...' end # verify the required parameter 'customer' is set if @api_client.config.client_side_validation && customer.nil? fail ArgumentError, "Missing the required parameter 'customer' when calling CustomerApi.insert_customer" end # resource path local_var_path = '/customer/customers' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(customer) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomerResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#insert_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a customer # Update a customer on the UltraCart account. # @param customer Customer to update # @param customer_profile_oid The customer_profile_oid to update. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CustomerResponse] def update_customer(customer, customer_profile_oid, opts = {}) data, _status_code, _headers = update_customer_with_http_info(customer, customer_profile_oid, opts) data end # Update a customer # Update a customer on the UltraCart account. # @param customer Customer to update # @param customer_profile_oid The customer_profile_oid to update. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CustomerResponse, Fixnum, Hash)>] CustomerResponse data, response status code and response headers def update_customer_with_http_info(customer, customer_profile_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.update_customer ...' end # verify the required parameter 'customer' is set if @api_client.config.client_side_validation && customer.nil? fail ArgumentError, "Missing the required parameter 'customer' when calling CustomerApi.update_customer" end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.update_customer" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(customer) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CustomerResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update email list subscriptions for a customer # Update email list subscriptions for a customer # @param customer_profile_oid The customer profile oid # @param list_changes List changes # @param [Hash] opts the optional parameters # @return [CustomerEmailListChanges] def update_customer_email_lists(customer_profile_oid, list_changes, opts = {}) data, _status_code, _headers = update_customer_email_lists_with_http_info(customer_profile_oid, list_changes, opts) data end # Update email list subscriptions for a customer # Update email list subscriptions for a customer # @param customer_profile_oid The customer profile oid # @param list_changes List changes # @param [Hash] opts the optional parameters # @return [Array<(CustomerEmailListChanges, Fixnum, Hash)>] CustomerEmailListChanges data, response status code and response headers def update_customer_email_lists_with_http_info(customer_profile_oid, list_changes, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.update_customer_email_lists ...' end # verify the required parameter 'customer_profile_oid' is set if @api_client.config.client_side_validation && customer_profile_oid.nil? fail ArgumentError, "Missing the required parameter 'customer_profile_oid' when calling CustomerApi.update_customer_email_lists" end # verify the required parameter 'list_changes' is set if @api_client.config.client_side_validation && list_changes.nil? fail ArgumentError, "Missing the required parameter 'list_changes' when calling CustomerApi.update_customer_email_lists" end # resource path local_var_path = '/customer/customers/{customer_profile_oid}/email_lists'.sub('{' + 'customer_profile_oid' + '}', customer_profile_oid.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(list_changes) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'CustomerEmailListChanges') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#update_customer_email_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate a token that can be used to verify a customer email address # Validate a token that can be used to verify a customer email address. The implementation of how a customer interacts with this token is left to the merchant. # @param validation_request Token validation request # @param [Hash] opts the optional parameters # @return [EmailVerifyTokenValidateResponse] def validate_email_verification_token(validation_request, opts = {}) data, _status_code, _headers = validate_email_verification_token_with_http_info(validation_request, opts) data end # Validate a token that can be used to verify a customer email address # Validate a token that can be used to verify a customer email address. The implementation of how a customer interacts with this token is left to the merchant. # @param validation_request Token validation request # @param [Hash] opts the optional parameters # @return [Array<(EmailVerifyTokenValidateResponse, Fixnum, Hash)>] EmailVerifyTokenValidateResponse data, response status code and response headers def validate_email_verification_token_with_http_info(validation_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.validate_email_verification_token ...' end # verify the required parameter 'validation_request' is set if @api_client.config.client_side_validation && validation_request.nil? fail ArgumentError, "Missing the required parameter 'validation_request' when calling CustomerApi.validate_email_verification_token" end # resource path local_var_path = '/customer/customers/email_verify/validate_token' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(validation_request) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] 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 => 'EmailVerifyTokenValidateResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#validate_email_verification_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end