🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

ls_linkdirect_api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ls_linkdirect_api

0.1.1
Rubygems
Version published
Maintainers
1
Created
Source

LsLinkdirectAPI

Ruby wrapper for LinkShare LinkLocator Direct. Supported web services:

  • [TextLinks]
  • [BannerLinks]
  • [DRMLinks]

Installation

Add this line to your application's Gemfile:

gem 'ls_linkdirect_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ls_linkdirect_api

Usage

Before using LsLinkdirectAPI you need to set up your publisher token first. If you use Ruby on Rails, the token can be set in a configuration file (i.e. app/config/initializers/linkshare_api.rb), otherwise just set it in your script. The token can be found on LinkShare's Web Services page under the Links tab.

Currently there are three services that can be used with this gem. To use those services, you name the service as the class when you declare a new instance of the class (i.e. LsLinkdirectAPI::TextLinks.new) see examples below.

require "ls_linkdirect_api" # no need for RoR
LsLinkdirectAPI.token = ENV["LINKSHARE_TOKEN"]

This request gives you the available text links. To specify the links your request returns, you can filter it using these parameters: MID, Category, Start Date, and End Date.

textlinks = LsLinkdirectAPI::TextLinks.new
params = { mid: -1, cat: -1, startDate: 01012014, endDate: 05012014 }
# all params are optional gem will add defaults where required
response = textlinks.get(params)
response.data.each do |item|
  puts "Name: #{item.linkName}"
  puts "Click URL: #{item.clickURL}"
  puts "Tracking Pixil : #{item.showURL}"
  puts "Text Display: #{item.textDisplay}"
end

This feed gives you the available banner links. To obtain specific banner links, you can filter this request using these parameters: MID, Category, Size, Start Date, and End Date.

LinkLocator Direct: Banner Size Codes

bannerlinks = LsLinkdirectAPI:: BannerLinks.new
params = { mid: -1, cat: -1, startDate: 01012014, endDate: 05012014, size: 1  }
# all params are optional gem will add defaults where required
response = bannerlinks.get(params)
response.data.each do |item|
  puts "Name: #{item.linkName}"
  puts "Click URL: #{item.clickURL}"
  puts "Tracking Pixil : #{item.showURL}"
  puts "Text Display: #{item.textDisplay}"
  puts "Image URL: #{item.imgURL}"
end

This feed gives you the available DRM links. To obtain specific DRM links, you can filter it using these parameters: MID, Category, Start Date, and End Date.

drmlinks = LsLinkdirectAPI:: DRMLinks.new
params = { mid: -1, cat: -1, startDate: 01012014, endDate: 05012014 }
# all params are optional gem will add defaults where required
response = drmlinks.get(params)
response.data.each do |item|
  puts "Name: #{item.linkName}"
  puts "Code: #{item.code}"
end

Contributing

FAQs

Package last updated on 07 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts