0.0
No commit activity in last 3 years
No release in over 3 years
Viglink API Wrapper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.1
~> 2.14.1
~> 3.0
~> 0.7.1
~> 2.5.0
~> 1.13.0
~> 0.8.7.4

Runtime

 Project Readme

Viglink

This gem is a wrapper for the Viglink Catalog API. This gem contains module methods for each API endpoint, as well as an additional subset for the CUID revenue API.

Installation

Command line installation:

gem install viglink-api

Or add this line to your application's Gemfile:

gem 'viglink-api'

And then execute bundler:

bundle

Usage

Irb/Console

To use in irb or a console, simply require the file and create a new client

require 'viglink_api'
viglink = ViglinkApi::Client.new({:api_key => ENV['VIGLINK_API_KEY']})

Rails

Include the viglink-api gem in your Gemfile and bundle. The module can be configured by creating a config file:

config/initializers/viglink.rb

ViglinkApi.configure do |config|
	config.api_key = "your_api_key"
end

And then initialize a client with the following:

viglink = ViglinkApi::Client.new

Please see below for more configuration options.

Search Methods

Please refer to the Viglink Catalog API documentation for details on additional fields that can be included. Each method can accept a hash of values to pass through to the search. Key is included by default.

  • find_products
  • find_merchants
  • find_merchant_types
  • find_deals
  • find_deal_types
  • find_countries

Configuration Options

  • api_url sets the API base url. Default: http://catalog.viglink.com
  • api_key should be set to your campaign API key. Default: nil
  • api_key can be set to your campaign API secret key. Default: nil
  • api_full_response Determines if the searches return the full response hashes or only the segment of the response related to the request. Default: true
  • api_cuid_url sets the CUID API base url. Default: https://www.viglink.com/service/v1/cuidRevenue

CUID Payment API

Please refer to the Viglink CUID API documentation (the section on "Advanced Revenue Tracking") for additional information.

Usage

The defaults for this segment of the API default to the general ViglinkApi configuration

viglink = ViglinkApi::Purchases.new

Or for a one-off call independent from the ViglinkApi configuration (please see below for more configuration options):

viglink = ViglinkApi::Purchases.new({:api_secret => "your_secret_key", :period => "week"})

Methods

  • find_purchases performs a search and accepts an options hash with the following keys:
    • last_date sets the start date for search. Format: YYYY/MM/DD ("%Y/%m/%d"). Default: 1 day ago.
    • period determines the search period. Options: day, week, month. Default: day

Options

  • api_secret should be set to your Viglink API secret key. Default: nil
  • api_cuid_url = options[:api_cuid_url] || ViglinkApi.api_cuid_url
  • last_date sets the start date for search. Format: YYYY/MM/DD ("%Y/%m/%d"). Default: 1 day ago.
  • period determines the search period. Options: day, week, month. Default: day

Contributing

Contributions welcome!

  • We need more tests, and the existing ones need updating
  • More documentation and code commenting
  • Debugging and exception handling
  • Features!

In traditional GitHub style:

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request