talon_one

TalonOne - the Ruby gem for the 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

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 2.4.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build talon_one.gemspec

Then either install the gem locally:

gem install ./talon_one-2.4.0.gem

(for development, run gem install --dev ./talon_one-2.4.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'talon_one', '~> 2.4.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/talon-one/talon_one.rb, then add the following in the Gemfile:

gem 'talon_one', :git => 'https://github.com/talon-one/talon_one.rb.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

Integration API

V2

# Load the gem
require 'talon_one'

# Setup authorization
TalonOne.configure do |config|
  # Configure the API host destination
  config.host = 'mycompany.talon.one'

  # Configure API key authorization: api_key_v1
  config.api_key['Authorization'] = 'ca1890f0ec3bfa8ed4be04e2aec0c606c0df8ad464f17d3ea8b51df12ba60e5d'
  config.api_key_prefix['Authorization'] = 'ApiKey-v1'
end

# Integration API example to send a session update
integration_api = TalonOne::IntegrationApi.new

session_integration_id = '8fb7129e-68e6-4464-9631-09b588391619' # String | The integration identifier of the session

# NewCustomerSessionV2 object
customer_session_v2 = TalonOne::NewCustomerSessionV2.new(
  profile_id: 'Some_1',
  state: 'open',
  cart_items: [
    TalonOne::CartItem.new(
      name: 'Nigiri Sake',
      sku: 'sush1',
      quantity: 2,
      price: 3.7,
      category: 'Sushi'
    ),
    TalonOne::CartItem.new(
      name: 'Rainbow Roll I/O',
      sku: 'sush2',
      quantity: 1,
      price: 6.5,
      category: 'Sushi'
    ),
    TalonOne::CartItem.new(
      name: 'Kirin',
      sku: 'k1r',
      quantity: 2,
      price: 2.2,
      category: 'Beverages'
    ),
  ],
  coupon_codes: [
    'Cool-Stuff!'
  ]
)

# Instantiating a new IntegrationRequest object
integration_request = TalonOne::IntegrationRequest.new(
  customer_session: customer_session_v2,
  # Optional list of requested information to be present on the response.
  # See docs/IntegrationRequest.md for full list 
  # response_content: [
  #  'customerSession'
  # ]
)

begin
  # Create/update a customer session using `update_customer_session_v2` function
  result = integration_api.update_customer_session_v2(session_integration_id, integration_request)

  # Prints response to the console
  puts result

  # Parsing the returned effects list, please consult https://developers.talon.one/Integration-API/handling-effects-v2 for the full list of effects and their corresponding properties
  result.effects.each do |effect|
    if effect.effect_type == 'setDiscount'
      # Initiating right props instance according to the effect type
      props = TalonOne::SetDiscountEffectProps.build_from_hash(effect.props)

      # Access the specific effect's properties
      puts "Set a discount '#{props.name}' of #{props.value}"
    elsif effect.effect_type == 'rejectCoupon'
      # Initiating right props instance according to the effect type
      props = TalonOne::RejectCouponEffectProps.build_from_hash(effect.props)

      # Work with AcceptCouponEffectProps' properties
      # ...
    end
  end
rescue TalonOne::ApiError => e
  puts "Exception when calling IntegrationApi->update_customer_session_v2: #{e}"
end

V1

# Load the gem
require 'talon_one'

# Setup authorization
TalonOne.configure do |config|
  # Configure the API host destination
  config.host = 'mycompany.talon.one'

  # Configure API key authorization: api_key_v1
  config.api_key['Authorization'] = 'ca1890f0ec3bfa8ed4be04e2aec0c606c0df8ad464f17d3ea8b51df12ba60e5d'
  config.api_key_prefix['Authorization'] = 'ApiKey-v1'
end

# Integration API example to send a session update
integration_api = TalonOne::IntegrationApi.new

session_integration_id = 'f985583f-fa7d-4098-91dd-99c898ed3cd3' # String | The integration identifier of the session

# NewCustomerSession Object
customer_session = TalonOne::NewCustomerSession.new({
  'coupon': 'Kewl',
  'total': 100,
  'state': 'open'
})

begin
  # Create/update a customer session using `update_customer_session` function
  result = integration_api.update_customer_session(session_integration_id, customer_session)

  # Prints response to the console
  puts result
rescue TalonOne::ApiError => e
  puts "Exception when calling IntegrationApi->update_customer_session: #{e}"
end

Management API

# Load the gem
require 'talon_one'

# Setup authorization
TalonOne.configure do |config|
  # Configure the API host destination
  config.host = 'mycompany.talon.one'
end

# Management API example to load application with id 7
management_api = TalonOne::ManagementApi.new

begin
  # Acquire session token
   = TalonOne::LoginParams.new({
    'email': '[email protected]',
    'password': 'Demo1234'
  })

   = management_api.create_session()
  token = .token

  # Save token in the configuration for future management API calls
  TalonOne.configure do |config|
    # Configure API key authorization: manager_auth
    config.api_key['Authorization'] = token
    config.api_key_prefix['Authorization'] = 'Bearer'
  end

  # Calling get_application function with the desired id (7)
  result = management_api.get_application(7)
  # Print result to the console
  puts result

rescue TalonOne::ApiError => e
  puts "Exception when calling ManagementApi: #{e}"
end

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
TalonOne::IntegrationApi create_coupon_reservation POST /v1/coupon_reservations/couponValue Create a new coupon reservation
TalonOne::IntegrationApi create_referral POST /v1/referrals Create a referral code for an advocate
TalonOne::IntegrationApi create_referrals_for_multiple_advocates POST /v1/referrals_for_multiple_advocates Create referral codes for multiple advocates
TalonOne::IntegrationApi delete_coupon_reservation DELETE /v1/coupon_reservations/couponValue Delete coupon reservations
TalonOne::IntegrationApi delete_customer_data DELETE /v1/customer_data/integrationId Delete the personal data of a customer
TalonOne::IntegrationApi get_customer_inventory GET /v1/customer_profiles/integrationId/inventory Get an inventory of all data associated with a specific customer profile
TalonOne::IntegrationApi get_reserved_customers GET /v1/coupon_reservations/customerprofiles/couponValue Get the users that have this coupon reserved
TalonOne::IntegrationApi track_event POST /v1/events Track an Event
TalonOne::IntegrationApi update_customer_profile PUT /v1/customer_profiles/integrationId Update a Customer Profile V1
TalonOne::IntegrationApi update_customer_profile_audiences POST /v2/customer_audiences Update a Customer Profile Audiences
TalonOne::IntegrationApi update_customer_profile_v2 PUT /v2/customer_profiles/integrationId Update a Customer Profile
TalonOne::IntegrationApi update_customer_profiles_v2 PUT /v2/customer_profiles Update multiple Customer Profiles
TalonOne::IntegrationApi update_customer_session PUT /v1/customer_sessions/customerSessionId Update a Customer Session V1
TalonOne::IntegrationApi update_customer_session_v2 PUT /v2/customer_sessions/customerSessionId Update a Customer Session
TalonOne::ManagementApi add_loyalty_points PUT /v1/loyalty_programs/programID/profile/integrationID/add_points Add points in a certain loyalty program for the specified customer
TalonOne::ManagementApi copy_campaign_to_applications POST /v1/applications/applicationId/campaigns/campaignId/copy Copy the campaign into every specified application
TalonOne::ManagementApi create_additional_cost POST /v1/additional_costs Define a new additional cost
TalonOne::ManagementApi create_attribute POST /v1/attributes Define a new custom attribute
TalonOne::ManagementApi create_campaign POST /v1/applications/applicationId/campaigns Create a Campaign
TalonOne::ManagementApi create_coupons POST /v1/applications/applicationId/campaigns/campaignId/coupons Create Coupons
TalonOne::ManagementApi create_coupons_for_multiple_recipients POST /v1/applications/applicationId/campaigns/campaignId/coupons_with_recipients Create Coupons for Multiple Recipients
TalonOne::ManagementApi create_password_recovery_email POST /v1/password_recovery_emails Request a password reset
TalonOne::ManagementApi create_ruleset POST /v1/applications/applicationId/campaigns/campaignId/rulesets Create a Ruleset
TalonOne::ManagementApi create_session POST /v1/sessions Create a Session
TalonOne::ManagementApi delete_campaign DELETE /v1/applications/applicationId/campaigns/campaignId Delete a Campaign
TalonOne::ManagementApi delete_coupon DELETE /v1/applications/applicationId/campaigns/campaignId/coupons/couponId Delete one Coupon
TalonOne::ManagementApi delete_coupons DELETE /v1/applications/applicationId/campaigns/campaignId/coupons Delete Coupons
TalonOne::ManagementApi delete_referral DELETE /v1/applications/applicationId/campaigns/campaignId/referrals/referralId Delete one Referral
TalonOne::ManagementApi delete_ruleset DELETE /v1/applications/applicationId/campaigns/campaignId/rulesets/rulesetId Delete a Ruleset
TalonOne::ManagementApi destroy_session DELETE /v1/sessions Destroy a Session
TalonOne::ManagementApi export_coupons GET /v1/applications/applicationId/export_coupons Export Coupons to a CSV file
TalonOne::ManagementApi export_customer_sessions GET /v1/applications/applicationId/export_customer_sessions Export Customer Sessions to a CSV file
TalonOne::ManagementApi export_effects GET /v1/applications/applicationId/export_effects Export triggered Effects to a CSV file
TalonOne::ManagementApi export_loyalty_balance GET /v1/loyalty_programs/programID/export_customer_balance Export customer loyalty balance to a CSV file
TalonOne::ManagementApi export_loyalty_ledger GET /v1/loyalty_programs/programID/profile/integrationID/export_log Export a customer's loyalty ledger log to a CSV file
TalonOne::ManagementApi get_access_logs GET /v1/applications/applicationId/access_logs Get access logs for application (with total count)
TalonOne::ManagementApi get_access_logs_without_total_count GET /v1/applications/applicationId/access_logs/no_total Get access logs for application
TalonOne::ManagementApi get_account GET /v1/accounts/accountId Get Account Details
TalonOne::ManagementApi get_account_analytics GET /v1/accounts/accountId/analytics Get Account Analytics
TalonOne::ManagementApi get_additional_cost GET /v1/additional_costs/additionalCostId Get an additional cost
TalonOne::ManagementApi get_additional_costs GET /v1/additional_costs List additional costs
TalonOne::ManagementApi get_all_access_logs GET /v1/access_logs Get all access logs
TalonOne::ManagementApi get_all_roles GET /v1/roles Get all roles
TalonOne::ManagementApi get_application GET /v1/applications/applicationId Get Application
TalonOne::ManagementApi get_application_api_health GET /v1/applications/applicationId/health_report Get report of health of application API
TalonOne::ManagementApi get_application_customer GET /v1/applications/applicationId/customers/customerId Get Application Customer
TalonOne::ManagementApi get_application_customers GET /v1/applications/applicationId/customers List Application Customers
TalonOne::ManagementApi get_application_customers_by_attributes POST /v1/application_customer_search Get a list of the customer profiles that match the given attributes (with total count)
TalonOne::ManagementApi get_application_event_types GET /v1/applications/applicationId/event_types List Applications Event Types
TalonOne::ManagementApi get_application_events GET /v1/applications/applicationId/events List Applications Events (with total count)
TalonOne::ManagementApi get_application_events_without_total_count GET /v1/applications/applicationId/events/no_total List Applications Events
TalonOne::ManagementApi get_application_session GET /v1/applications/applicationId/sessions/sessionId Get Application Session
TalonOne::ManagementApi get_application_sessions GET /v1/applications/applicationId/sessions List Application Sessions
TalonOne::ManagementApi get_applications GET /v1/applications List Applications
TalonOne::ManagementApi get_attribute GET /v1/attributes/attributeId Get a custom attribute
TalonOne::ManagementApi get_attributes GET /v1/attributes List custom attributes
TalonOne::ManagementApi get_audiences GET /v1/audiences Get all audiences
TalonOne::ManagementApi get_campaign GET /v1/applications/applicationId/campaigns/campaignId Get a Campaign
TalonOne::ManagementApi get_campaign_analytics GET /v1/applications/applicationId/campaigns/campaignId/analytics Get analytics of campaigns
TalonOne::ManagementApi get_campaign_by_attributes POST /v1/applications/applicationId/campaigns_search Get a list of all campaigns that match the given attributes
TalonOne::ManagementApi get_campaigns GET /v1/applications/applicationId/campaigns List your Campaigns
TalonOne::ManagementApi get_changes GET /v1/changes Get audit log for an account
TalonOne::ManagementApi get_coupons GET /v1/applications/applicationId/campaigns/campaignId/coupons List Coupons (with total count)
TalonOne::ManagementApi get_coupons_by_attributes POST /v1/applications/applicationId/campaigns/campaignId/coupons_search Get a list of the coupons that match the given attributes
TalonOne::ManagementApi get_coupons_by_attributes_application_wide POST /v1/applications/applicationId/coupons_search Get a list of the coupons that match the given attributes in all active campaigns of an application (with total count)
TalonOne::ManagementApi get_coupons_without_total_count GET /v1/applications/applicationId/campaigns/campaignId/coupons/no_total List Coupons
TalonOne::ManagementApi get_customer_activity_report GET /v1/applications/applicationId/customer_activity_reports/customerId Get Activity Report for Single Customer
TalonOne::ManagementApi get_customer_activity_reports GET /v1/applications/applicationId/customer_activity_reports Get Activity Reports for Application Customers (with total count)
TalonOne::ManagementApi get_customer_activity_reports_without_total_count GET /v1/applications/applicationId/customer_activity_reports/no_total Get Activity Reports for Application Customers
TalonOne::ManagementApi get_customer_analytics GET /v1/applications/applicationId/customers/customerId/analytics Get Analytics Report for a Customer
TalonOne::ManagementApi get_customer_profile GET /v1/customers/customerId Get Customer Profile
TalonOne::ManagementApi get_customer_profiles GET /v1/customers/no_total List Customer Profiles
TalonOne::ManagementApi get_customers_by_attributes POST /v1/customer_search/no_total Get a list of the customer profiles that match the given attributes
TalonOne::ManagementApi get_event_types GET /v1/event_types List Event Types
TalonOne::ManagementApi get_exports GET /v1/exports Get Exports
TalonOne::ManagementApi get_loyalty_points GET /v1/loyalty_programs/programID/profile/integrationID get the Loyalty Ledger for this integrationID
TalonOne::ManagementApi get_loyalty_program GET /v1/loyalty_programs/programID Get a loyalty program
TalonOne::ManagementApi get_loyalty_programs GET /v1/loyalty_programs List all loyalty Programs
TalonOne::ManagementApi get_loyalty_statistics GET /v1/loyalty_programs/programID/statistics Get loyalty program statistics by loyalty program ID
TalonOne::ManagementApi get_referrals GET /v1/applications/applicationId/campaigns/campaignId/referrals List Referrals (with total count)
TalonOne::ManagementApi get_referrals_without_total_count GET /v1/applications/applicationId/campaigns/campaignId/referrals/no_total List Referrals
TalonOne::ManagementApi get_role GET /v1/roles/roleId Get information for the specified role
TalonOne::ManagementApi get_ruleset GET /v1/applications/applicationId/campaigns/campaignId/rulesets/rulesetId Get a Ruleset
TalonOne::ManagementApi get_rulesets GET /v1/applications/applicationId/campaigns/campaignId/rulesets List Campaign Rulesets
TalonOne::ManagementApi get_user GET /v1/users/userId Get a single User
TalonOne::ManagementApi get_users GET /v1/users List Users in your account
TalonOne::ManagementApi get_webhook GET /v1/webhooks/webhookId Get Webhook
TalonOne::ManagementApi get_webhook_activation_logs GET /v1/webhook_activation_logs List Webhook activation Log Entries
TalonOne::ManagementApi get_webhook_logs GET /v1/webhook_logs List Webhook Log Entries
TalonOne::ManagementApi get_webhooks GET /v1/webhooks List Webhooks
TalonOne::ManagementApi import_coupons POST /v1/applications/applicationId/campaigns/campaignId/import_coupons Import coupons via CSV file
TalonOne::ManagementApi import_loyalty_points POST /v1/loyalty_programs/programID/import_points Import loyalty points via CSV file
TalonOne::ManagementApi import_pool_giveaways POST /v1/giveaways/pools/poolId/import Import giveaways codes into a giveaways pool
TalonOne::ManagementApi import_referrals POST /v1/applications/applicationId/campaigns/campaignId/import_referrals Import referrals via CSV file
TalonOne::ManagementApi remove_loyalty_points PUT /v1/loyalty_programs/programID/profile/integrationID/deduct_points Deduct points in a certain loyalty program for the specified customer
TalonOne::ManagementApi reset_password POST /v1/reset_password Reset password
TalonOne::ManagementApi search_coupons_advanced POST /v1/applications/applicationId/campaigns/campaignId/coupons_search_advanced Get a list of the coupons that match the given attributes (with total count)
TalonOne::ManagementApi search_coupons_advanced_application_wide POST /v1/applications/applicationId/coupons_search_advanced Get a list of the coupons that match the given attributes in all active campaigns of an application (with total count)
TalonOne::ManagementApi search_coupons_advanced_application_wide_without_total_count POST /v1/applications/applicationId/coupons_search_advanced/no_total Get a list of the coupons that match the given attributes in all active campaigns of an application
TalonOne::ManagementApi search_coupons_advanced_without_total_count POST /v1/applications/applicationId/campaigns/campaignId/coupons_search_advanced/no_total Get a list of the coupons that match the given attributes
TalonOne::ManagementApi update_additional_cost PUT /v1/additional_costs/additionalCostId Update an additional cost
TalonOne::ManagementApi update_attribute PUT /v1/attributes/attributeId Update a custom attribute
TalonOne::ManagementApi update_campaign PUT /v1/applications/applicationId/campaigns/campaignId Update a Campaign
TalonOne::ManagementApi update_coupon PUT /v1/applications/applicationId/campaigns/campaignId/coupons/couponId Update a Coupon
TalonOne::ManagementApi update_coupon_batch PUT /v1/applications/applicationId/campaigns/campaignId/coupons Update a Batch of Coupons
TalonOne::ManagementApi update_referral PUT /v1/applications/applicationId/campaigns/campaignId/referrals/referralId Update one Referral
TalonOne::ManagementApi update_ruleset PUT /v1/applications/applicationId/campaigns/campaignId/rulesets/rulesetId Update a Ruleset

Documentation for Models

Documentation for Authorization

api_key_v1

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

integration_auth

  • Type: API key
  • API key parameter name: Content-Signature
  • Location: HTTP header

manager_auth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header