class Bluekai::Client

A simple BlueKai client

Attributes

api_user_key[R]
domain[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/bluekai/client.rb, line 9
def initialize(opts = {})
  @api_user_key = opts.fetch(:api_user_key, ENV['BLUEKAI_API_USER_KEY']) ||
    fail(Bluekai::Error, 'BlueKai API user key missing')
  @api_private_key = opts.fetch(:api_private_key, ENV['BLUEKAI_API_PRIVATE_KEY']) ||
    fail(Bluekai::Error, 'BlueKai API private key missing')
  @partner_id = opts.fetch(:partner_id, ENV['BLUEKAI_PARTNER_ID']) ||
    fail(Bluekai::Error, 'BlueKai PartnerID missing')
  @opts = opts
end

Public Instance Methods

ping() click to toggle source
# File lib/bluekai/client.rb, line 19
def ping
  request('GET', '/Services/WS/Ping', {}) == :success rescue false
end
taxonomy(query = {}) click to toggle source

Public: Lists categories in the BlueKai taxonomy. API definition can be found here kb.bluekai.com/display/PD/Taxonomy+API

parentId - integer fullPath - {0,1} bkSize - {0,1} Enter 1 to include the inventory of unique users in

the BlueKai network for each category.

intlDataCountryId - {-1..24} for country index see

(https://kb.bluekai.com/display/PD/Taxonomy+API)

device_code - {0 = Desktop + Mobile,1 = Desktop, 2 = Mobile} showBuyable - {0,1} showLeafStatus - {0,1} description - {0,1} vertical - {0,1} showReceivedAudienceCategories - {0,1} showCategoryPriceAtDate - {‘YYYY-MM-DD’}

Returns array of taxonomy nodes.

# File lib/bluekai/client.rb, line 41
def taxonomy(query = {})
  request('GET', '/Services/WS/Taxonomy', query)[:nodeList]
end

Private Instance Methods

request(method, path, query, body = nil) click to toggle source
# File lib/bluekai/client.rb, line 47
def request(method, path, query, body = nil)
  r = Request.new(method, path, query, body, domain)
  r.api_user_key = @api_user_key
  r.api_private_key = @api_private_key
  r.run
end