0.0
No release in over 3 years
A comprehensive Ruby client for interacting with the Taboola API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.0
~> 13.0
~> 3.0
= 1.49.0
~> 3.0

Runtime

 Project Readme

Taboola API Client

A comprehensive Ruby client for interacting with the Taboola API.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add taboola_api

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install taboola_api

Usage

Creating a Client

require 'taboola_api'

client = TaboolaApi::Client.new(
  client_id: "your-client-id",
  client_secret: "your-client-secret",
  access_token: "your-access-token"
)

Accounts

# List all allowed accounts
accounts = client.accounts.list_all
puts accounts

Campaigns

# List all campaigns
campaigns = client.campaigns.list_all("account-id")
puts campaigns

# Get a specific campaign
campaign = client.campaigns.get("account-id", "campaign-id")
puts campaign

Campaign Items

# List all campaign items
campaign_items = client.campaign_items.list_all("account-id", "campaign-id")
puts campaign_items

# Get a specific campaign item
campaign_item = client.campaign_items.get("account-id", "campaign-id", "item-id")
puts campaign_item

# Create a new campaign item
new_campaign_item = client.campaign_items.create("account-id", "campaign-id", {
  name: "New Campaign Item",
  url: "https://example.com"
})
puts new_campaign_item

# Update an existing campaign item
updated_campaign_item = client.campaign_items.update("account-id", "campaign-id", "item-id", {
  name: "Updated Campaign Item"
})
puts updated_campaign_item

Motion Ads

# List all motion ads
motion_ads = client.motion_ads.list_all("account-id", "campaign-id")
puts motion_ads

# Get a specific motion ad
motion_ad = client.motion_ads.get("account-id", "campaign-id", "item-id")
puts motion_ad

# Create a new motion ad
video_file = File.open("path/to/video.mp4")
fallback_file = File.open("path/to/fallback.jpg")
new_motion_ad = client.motion_ads.create("account-id", "campaign-id", video_file: video_file, fallback_file: fallback_file, {
  name: "New Motion Ad"
})
puts new_motion_ad

# Update an existing motion ad
updated_motion_ad = client.motion_ads.update("account-id", "campaign-id", "item-id", {
  name: "Updated Motion Ad"
})
puts updated_motion_ad

Operations

# Upload an image
image_file = File.open("path/to/image.jpg")
uploaded_image = client.operations.upload_image(image_file)
puts uploaded_image

Reportings

# Get top campaign content report
report = client.reportings.top_campaign_content_report(
  account_id: "account-id",
  start_date: "2023-01-01",
  end_date: "2023-01-31"
)
puts report

Development

After checking out the repo, run make install to install dependencies. Then, run make test to run the tests. You can also run bin/console for an interactive prompt.

License

The gem is available as open source under the terms of the MIT License.