=begin #Talon.One API #The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. ### Where is the API? The API is available at the same hostname as these docs. For example, if you are reading this page at `https://mycompany.talon.one/docs/api/`, the URL for the [updateCustomerProfile][] operation is `https://mycompany.talon.one/v1/customer_profiles/id` [updateCustomerProfile]: #operation--v1-customer_profiles--integrationId--put The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module TalonOne class IntegrationApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create a new coupon reservation # Creates a coupon reservation for all passed customer profiles on this couponID # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [Coupon] def create_coupon_reservation(coupon_value, body, opts = {}) data, _status_code, _headers = create_coupon_reservation_with_http_info(coupon_value, body, opts) data end # Create a new coupon reservation # Creates a coupon reservation for all passed customer profiles on this couponID # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [Array<(Coupon, Integer, Hash)>] Coupon data, response status code and response headers def create_coupon_reservation_with_http_info(coupon_value, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.create_coupon_reservation ...' end # verify the required parameter 'coupon_value' is set if @api_client.config.client_side_validation && coupon_value.nil? fail ArgumentError, "Missing the required parameter 'coupon_value' when calling IntegrationApi.create_coupon_reservation" 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 IntegrationApi.create_coupon_reservation" end # resource path local_var_path = '/v1/coupon_reservations/{couponValue}'.sub('{' + 'couponValue' + '}', CGI.escape(coupon_value.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'Coupon' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#create_coupon_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a referral code for an advocate # Creates a referral code for an advocate. The code will be valid for the referral campaign for which is created, indicated in the `campaignId` parameter, and will be associated with the profile specified in the `advocateProfileIntegrationId` parameter as the advocate's profile. # @param body [NewReferral] # @param [Hash] opts the optional parameters # @return [Referral] def create_referral(body, opts = {}) data, _status_code, _headers = create_referral_with_http_info(body, opts) data end # Create a referral code for an advocate # Creates a referral code for an advocate. The code will be valid for the referral campaign for which is created, indicated in the `campaignId` parameter, and will be associated with the profile specified in the `advocateProfileIntegrationId` parameter as the advocate's profile. # @param body [NewReferral] # @param [Hash] opts the optional parameters # @return [Array<(Referral, Integer, Hash)>] Referral data, response status code and response headers def create_referral_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.create_referral ...' 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 IntegrationApi.create_referral" end # resource path local_var_path = '/v1/referrals' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'Referral' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#create_referral\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete coupon reservations # Removes all passed customer profiles reservation from this coupon # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [nil] def delete_coupon_reservation(coupon_value, body, opts = {}) delete_coupon_reservation_with_http_info(coupon_value, body, opts) nil end # Delete coupon reservations # Removes all passed customer profiles reservation from this coupon # @param coupon_value [String] The value of a coupon # @param body [CouponReservations] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_coupon_reservation_with_http_info(coupon_value, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.delete_coupon_reservation ...' end # verify the required parameter 'coupon_value' is set if @api_client.config.client_side_validation && coupon_value.nil? fail ArgumentError, "Missing the required parameter 'coupon_value' when calling IntegrationApi.delete_coupon_reservation" 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 IntegrationApi.delete_coupon_reservation" end # resource path local_var_path = '/v1/coupon_reservations/{couponValue}'.sub('{' + 'couponValue' + '}', CGI.escape(coupon_value.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 return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_coupon_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete the personal data of a customer. # Delete all attributes on the customer profile and on entities that reference that customer profile. # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param [Hash] opts the optional parameters # @return [nil] def delete_customer_data(integration_id, opts = {}) delete_customer_data_with_http_info(integration_id, opts) nil end # Delete the personal data of a customer. # Delete all attributes on the customer profile and on entities that reference that customer profile. # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_customer_data_with_http_info(integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.delete_customer_data ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.delete_customer_data" end # resource path local_var_path = '/v1/customer_data/{integrationId}'.sub('{' + 'integrationId' + '}', CGI.escape(integration_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 return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_customer_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get an inventory of all data associated with a specific customer profile. # Get information regarding entities referencing this customer profile's integrationId. Currently we support customer profile information, referral codes and reserved coupons. In the future, this will be expanded with loyalty points. # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param [Hash] opts the optional parameters # @option opts [Boolean] :profile optional flag to decide if you would like customer profile information in the response # @option opts [Boolean] :referrals optional flag to decide if you would like referral information in the response # @option opts [Boolean] :coupons optional flag to decide if you would like coupon information in the response # @option opts [Boolean] :loyalty optional flag to decide if you would like loyalty information in the response # @return [CustomerInventory] def get_customer_inventory(integration_id, opts = {}) data, _status_code, _headers = get_customer_inventory_with_http_info(integration_id, opts) data end # Get an inventory of all data associated with a specific customer profile. # Get information regarding entities referencing this customer profile's integrationId. Currently we support customer profile information, referral codes and reserved coupons. In the future, this will be expanded with loyalty points. # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param [Hash] opts the optional parameters # @option opts [Boolean] :profile optional flag to decide if you would like customer profile information in the response # @option opts [Boolean] :referrals optional flag to decide if you would like referral information in the response # @option opts [Boolean] :coupons optional flag to decide if you would like coupon information in the response # @option opts [Boolean] :loyalty optional flag to decide if you would like loyalty information in the response # @return [Array<(CustomerInventory, Integer, Hash)>] CustomerInventory data, response status code and response headers def get_customer_inventory_with_http_info(integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.get_customer_inventory ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.get_customer_inventory" end # resource path local_var_path = '/v1/customer_profiles/{integrationId}/inventory'.sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil? query_params[:'referrals'] = opts[:'referrals'] if !opts[:'referrals'].nil? query_params[:'coupons'] = opts[:'coupons'] if !opts[:'coupons'].nil? query_params[:'loyalty'] = opts[:'loyalty'] if !opts[:'loyalty'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'CustomerInventory' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#get_customer_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the users that have this coupon reserved # Returns all users that have this coupon marked as reserved # @param coupon_value [String] The value of a coupon # @param [Hash] opts the optional parameters # @return [InlineResponse200] def get_reserved_customers(coupon_value, opts = {}) data, _status_code, _headers = get_reserved_customers_with_http_info(coupon_value, opts) data end # Get the users that have this coupon reserved # Returns all users that have this coupon marked as reserved # @param coupon_value [String] The value of a coupon # @param [Hash] opts the optional parameters # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers def get_reserved_customers_with_http_info(coupon_value, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.get_reserved_customers ...' end # verify the required parameter 'coupon_value' is set if @api_client.config.client_side_validation && coupon_value.nil? fail ArgumentError, "Missing the required parameter 'coupon_value' when calling IntegrationApi.get_reserved_customers" end # resource path local_var_path = '/v1/coupon_reservations/customerprofiles/{couponValue}'.sub('{' + 'couponValue' + '}', CGI.escape(coupon_value.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'InlineResponse200' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#get_reserved_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Track an Event # Records an arbitrary event in a customer session. For example, an integration might record an event when a user updates their payment information. The `sessionId` body parameter is required, an event is always part of a session. Much like updating a customer session, if either the profile or the session do not exist, a new empty one will be created. Note that if the specified session already exists, it must belong to the same `profileId` or an error will be returned. As with customer sessions, you can use an empty string for `profileId` to indicate that this is an anonymous session. Updating a customer profile will return a response with the full integration state. This includes the current state of the customer profile, the customer session, the event that was recorded, and an array of effects that took place. # @param body [NewEvent] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [IntegrationState] def track_event(body, opts = {}) data, _status_code, _headers = track_event_with_http_info(body, opts) data end # Track an Event # Records an arbitrary event in a customer session. For example, an integration might record an event when a user updates their payment information. The `sessionId` body parameter is required, an event is always part of a session. Much like updating a customer session, if either the profile or the session do not exist, a new empty one will be created. Note that if the specified session already exists, it must belong to the same `profileId` or an error will be returned. As with customer sessions, you can use an empty string for `profileId` to indicate that this is an anonymous session. Updating a customer profile will return a response with the full integration state. This includes the current state of the customer profile, the customer session, the event that was recorded, and an array of effects that took place. # @param body [NewEvent] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [Array<(IntegrationState, Integer, Hash)>] IntegrationState data, response status code and response headers def track_event_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.track_event ...' 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 IntegrationApi.track_event" end # resource path local_var_path = '/v1/events' # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationState' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#track_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a Customer Profile V1 # ⚠️ Deprecation Notice: Support for requests to this endpoint will end on 15.07.2021. We will not remove the endpoint, and it will still be accessible for you to use. For new features support, please migrate to [API V2.0](/Getting-Started/APIV2). Update (or create) a [Customer Profile][]. This profile information can then be matched and/or updated by campaign [Rules][]. The `integrationId` may be any identifier that will remain stable for the customer. For example, you might use a database ID, an email, or a phone number as the `integrationId`. It is vital that this ID **not** change over time, so **don't** use any identifier that the customer can update themselves. E.g. if your application allows a customer to update their e-mail address, you should instead use a database ID. Updating a customer profile will return a response with the full integration state. This includes the current state of the customer profile, the customer session, the event that was recorded, and an array of effects that took place. [Customer Profile]: /Getting-Started/entities#customer-profile [Rules]: /Getting-Started/entities#campaigns-rulesets-and-coupons # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param body [NewCustomerProfile] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [IntegrationState] def update_customer_profile(integration_id, body, opts = {}) data, _status_code, _headers = update_customer_profile_with_http_info(integration_id, body, opts) data end # Update a Customer Profile V1 # ⚠️ Deprecation Notice: Support for requests to this endpoint will end on 15.07.2021. We will not remove the endpoint, and it will still be accessible for you to use. For new features support, please migrate to [API V2.0](/Getting-Started/APIV2). Update (or create) a [Customer Profile][]. This profile information can then be matched and/or updated by campaign [Rules][]. The `integrationId` may be any identifier that will remain stable for the customer. For example, you might use a database ID, an email, or a phone number as the `integrationId`. It is vital that this ID **not** change over time, so **don't** use any identifier that the customer can update themselves. E.g. if your application allows a customer to update their e-mail address, you should instead use a database ID. Updating a customer profile will return a response with the full integration state. This includes the current state of the customer profile, the customer session, the event that was recorded, and an array of effects that took place. [Customer Profile]: /Getting-Started/entities#customer-profile [Rules]: /Getting-Started/entities#campaigns-rulesets-and-coupons # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param body [NewCustomerProfile] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [Array<(IntegrationState, Integer, Hash)>] IntegrationState data, response status code and response headers def update_customer_profile_with_http_info(integration_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profile ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.update_customer_profile" 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 IntegrationApi.update_customer_profile" end # resource path local_var_path = '/v1/customer_profiles/{integrationId}'.sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationState' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a Customer Profile Audiences # Update one ore multiple Customer Profiles with the specified Audiences # @param body [CustomerProfileAudienceRequest] # @param [Hash] opts the optional parameters # @return [nil] def update_customer_profile_audiences(body, opts = {}) update_customer_profile_audiences_with_http_info(body, opts) nil end # Update a Customer Profile Audiences # Update one ore multiple Customer Profiles with the specified Audiences # @param body [CustomerProfileAudienceRequest] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def update_customer_profile_audiences_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profile_audiences ...' 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 IntegrationApi.update_customer_profile_audiences" end # resource path local_var_path = '/v2/customer_audiences' # 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 return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_profile_audiences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a Customer Profile # Update (or create) a [Customer Profile][]. The `integrationId` may be any identifier that will remain stable for the customer. For example, you might use a database ID, an email, or a phone number as the `integrationId`. It is vital that this ID **not** change over time, so **don't** use any identifier that the customer can update themselves. E.g. if your application allows a customer to update their e-mail address, you should instead use a database ID. [Customer Profile]: /Getting-Started/entities#customer-profile # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param body [CustomerProfileIntegrationRequestV2] # @param [Hash] opts the optional parameters # @option opts [Boolean] :run_rule_engine Flag to indicate whether to run the rule engine (Defaults to false). # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'. Only used when 'runRuleEngine' is set to 'true'). # @return [IntegrationStateV2] def update_customer_profile_v2(integration_id, body, opts = {}) data, _status_code, _headers = update_customer_profile_v2_with_http_info(integration_id, body, opts) data end # Update a Customer Profile # Update (or create) a [Customer Profile][]. The `integrationId` may be any identifier that will remain stable for the customer. For example, you might use a database ID, an email, or a phone number as the `integrationId`. It is vital that this ID **not** change over time, so **don't** use any identifier that the customer can update themselves. E.g. if your application allows a customer to update their e-mail address, you should instead use a database ID. [Customer Profile]: /Getting-Started/entities#customer-profile # @param integration_id [String] The custom identifier for this profile, must be unique within the account. # @param body [CustomerProfileIntegrationRequestV2] # @param [Hash] opts the optional parameters # @option opts [Boolean] :run_rule_engine Flag to indicate whether to run the rule engine (Defaults to false). # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'. Only used when 'runRuleEngine' is set to 'true'). # @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers def update_customer_profile_v2_with_http_info(integration_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profile_v2 ...' end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.update_customer_profile_v2" 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 IntegrationApi.update_customer_profile_v2" end # resource path local_var_path = '/v2/customer_profiles/{integrationId}'.sub('{' + 'integrationId' + '}', CGI.escape(integration_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'runRuleEngine'] = opts[:'run_rule_engine'] if !opts[:'run_rule_engine'].nil? query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationStateV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_profile_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update multiple Customer Profiles # Update (or create) up to 1000 [Customer Profiles][] in 1 request. The `integrationId` may be any identifier that will remain stable for the customer. For example, you might use a database ID, an email, or a phone number as the `integrationId`. It is vital that this ID **not** change over time, so **don't** use any identifier that the customer can update themselves. E.g. if your application allows a customer to update their e-mail address, you should instead use a database ID. [Customer Profiles]: /Getting-Started/entities#customer-profile # @param body [MultipleCustomerProfileIntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [String] :silent If set to 'yes', response will be an empty 204, otherwise a list of the IntegrationStateV2 generated. # @return [MultipleCustomerProfileIntegrationResponseV2] def update_customer_profiles_v2(body, opts = {}) data, _status_code, _headers = update_customer_profiles_v2_with_http_info(body, opts) data end # Update multiple Customer Profiles # Update (or create) up to 1000 [Customer Profiles][] in 1 request. The `integrationId` may be any identifier that will remain stable for the customer. For example, you might use a database ID, an email, or a phone number as the `integrationId`. It is vital that this ID **not** change over time, so **don't** use any identifier that the customer can update themselves. E.g. if your application allows a customer to update their e-mail address, you should instead use a database ID. [Customer Profiles]: /Getting-Started/entities#customer-profile # @param body [MultipleCustomerProfileIntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [String] :silent If set to 'yes', response will be an empty 204, otherwise a list of the IntegrationStateV2 generated. # @return [Array<(MultipleCustomerProfileIntegrationResponseV2, Integer, Hash)>] MultipleCustomerProfileIntegrationResponseV2 data, response status code and response headers def update_customer_profiles_v2_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_profiles_v2 ...' 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 IntegrationApi.update_customer_profiles_v2" end # resource path local_var_path = '/v2/customer_profiles' # query parameters query_params = opts[:query_params] || {} query_params[:'silent'] = opts[:'silent'] if !opts[:'silent'].nil? # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'MultipleCustomerProfileIntegrationResponseV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_profiles_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a Customer Session V1 # ⚠️ Deprecation Notice: Support for requests to this endpoint will end on 15.07.2021. We will not remove the endpoint, and it will still be accessible for you to use. For new features support, please migrate to [API V2.0](/Getting-Started/APIV2). Update (or create) a [Customer Session][]. For example, the items in a customers cart are part of a session. The Talon.One platform supports multiple simultaneous sessions for the same profile, so if you have multiple ways of accessing the same application you have the option of either tracking multiple independent sessions or using the same session across all of them. You should share sessions when application access points share other state, such as the users cart. If two points of access to the application have independent state (e.g. a user can have different items in their cart across the two) they should use independent customer session ID's. The `profileId` parameter in the request body should correspond to an `integrationId` for a customer profile, to track an anonymous session use the empty string (`\"\"`) as the `profileId`. Note that you do **not** need to create a customer profile first: if the specified profile does not yet exist, an empty profile will be created automatically. Updating a customer profile will return a response with the full integration state. This includes the current state of the customer profile, the customer session, the event that was recorded, and an array of effects that took place. The currency for the session and the cart items in the session is the same as that of the application with which the session is associated. [Customer Session]: /Getting-Started/entities#customer-session # @param customer_session_id [String] The custom identifier for this session, must be unique within the account. # @param body [NewCustomerSession] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [IntegrationState] def update_customer_session(customer_session_id, body, opts = {}) data, _status_code, _headers = update_customer_session_with_http_info(customer_session_id, body, opts) data end # Update a Customer Session V1 # ⚠️ Deprecation Notice: Support for requests to this endpoint will end on 15.07.2021. We will not remove the endpoint, and it will still be accessible for you to use. For new features support, please migrate to [API V2.0](/Getting-Started/APIV2). Update (or create) a [Customer Session][]. For example, the items in a customers cart are part of a session. The Talon.One platform supports multiple simultaneous sessions for the same profile, so if you have multiple ways of accessing the same application you have the option of either tracking multiple independent sessions or using the same session across all of them. You should share sessions when application access points share other state, such as the users cart. If two points of access to the application have independent state (e.g. a user can have different items in their cart across the two) they should use independent customer session ID's. The `profileId` parameter in the request body should correspond to an `integrationId` for a customer profile, to track an anonymous session use the empty string (`\"\"`) as the `profileId`. Note that you do **not** need to create a customer profile first: if the specified profile does not yet exist, an empty profile will be created automatically. Updating a customer profile will return a response with the full integration state. This includes the current state of the customer profile, the customer session, the event that was recorded, and an array of effects that took place. The currency for the session and the cart items in the session is the same as that of the application with which the session is associated. [Customer Session]: /Getting-Started/entities#customer-session # @param customer_session_id [String] The custom identifier for this session, must be unique within the account. # @param body [NewCustomerSession] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [Array<(IntegrationState, Integer, Hash)>] IntegrationState data, response status code and response headers def update_customer_session_with_http_info(customer_session_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_session ...' end # verify the required parameter 'customer_session_id' is set if @api_client.config.client_side_validation && customer_session_id.nil? fail ArgumentError, "Missing the required parameter 'customer_session_id' when calling IntegrationApi.update_customer_session" 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 IntegrationApi.update_customer_session" end # resource path local_var_path = '/v1/customer_sessions/{customerSessionId}'.sub('{' + 'customerSessionId' + '}', CGI.escape(customer_session_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationState' # auth_names auth_names = opts[:auth_names] || ['api_key_v1', 'integration_auth'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a Customer Session # Update (or create) a [Customer Session][]. For example, the items in a customers cart are part of a session. The Talon.One platform supports multiple simultaneous sessions for the same profile, so if you have multiple ways of accessing the same application you have the option of either tracking multiple independent sessions or using the same session across all of them. You should share sessions when application access points share other state, such as the users cart. If two points of access to the application have independent state (e.g. a user can have different items in their cart across the two) they should use independent customer session ID's. The `profileId` parameter in the request body should correspond to an `integrationId` for a customer profile, to track an anonymous session use the empty string (`\"\"`) as the `profileId`. Note that you do **not** need to create a customer profile first: if the specified profile does not yet exist, an empty profile will be created automatically. Updating a customer profile will return a response with the requested integration state. This includes the effects that were generated due to triggered campaigns, the created coupons and referral objects, as well as any entity that was requested in the request parameter \"responseContent\". The currency for the session and the cart items in the session is the same as that of the application with which the session is associated. [Customer Session]: /Getting-Started/entities#customer-session # @param customer_session_id [String] The custom identifier for this session, must be unique within the account. # @param body [IntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [IntegrationStateV2] def update_customer_session_v2(customer_session_id, body, opts = {}) data, _status_code, _headers = update_customer_session_v2_with_http_info(customer_session_id, body, opts) data end # Update a Customer Session # Update (or create) a [Customer Session][]. For example, the items in a customers cart are part of a session. The Talon.One platform supports multiple simultaneous sessions for the same profile, so if you have multiple ways of accessing the same application you have the option of either tracking multiple independent sessions or using the same session across all of them. You should share sessions when application access points share other state, such as the users cart. If two points of access to the application have independent state (e.g. a user can have different items in their cart across the two) they should use independent customer session ID's. The `profileId` parameter in the request body should correspond to an `integrationId` for a customer profile, to track an anonymous session use the empty string (`\"\"`) as the `profileId`. Note that you do **not** need to create a customer profile first: if the specified profile does not yet exist, an empty profile will be created automatically. Updating a customer profile will return a response with the requested integration state. This includes the effects that were generated due to triggered campaigns, the created coupons and referral objects, as well as any entity that was requested in the request parameter \"responseContent\". The currency for the session and the cart items in the session is the same as that of the application with which the session is associated. [Customer Session]: /Getting-Started/entities#customer-session # @param customer_session_id [String] The custom identifier for this session, must be unique within the account. # @param body [IntegrationRequest] # @param [Hash] opts the optional parameters # @option opts [Boolean] :dry Flag to indicate whether to skip persisting the changes or not (Will not persist if set to 'true'). # @return [Array<(IntegrationStateV2, Integer, Hash)>] IntegrationStateV2 data, response status code and response headers def update_customer_session_v2_with_http_info(customer_session_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IntegrationApi.update_customer_session_v2 ...' end # verify the required parameter 'customer_session_id' is set if @api_client.config.client_side_validation && customer_session_id.nil? fail ArgumentError, "Missing the required parameter 'customer_session_id' when calling IntegrationApi.update_customer_session_v2" 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 IntegrationApi.update_customer_session_v2" end # resource path local_var_path = '/v2/customer_sessions/{customerSessionId}'.sub('{' + 'customerSessionId' + '}', CGI.escape(customer_session_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'dry'] = opts[:'dry'] if !opts[:'dry'].nil? # header parameters header_params = opts[:header_params] || {} # 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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:return_type] || 'IntegrationStateV2' # auth_names auth_names = opts[:auth_names] || ['api_key_v1'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#update_customer_session_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end