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

impact_radius_api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

impact_radius_api

0.2.1
Rubygems
Version published
Maintainers
1
Created
Source

ImpactRadiusApi

Ruby wrapper for Impact Radius API. Only Media Partner Resources is curently supported.

If you need services that are not yet supported, feel free to contribute. For questions or bugs please create an issue.

Installation

Add this line to your application's Gemfile:

gem 'impact_radius_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install impact_radius_api

Configuration

This gem is designed to support Media Partner Resources. All requests to the Impact Radius REST API require you to use HTTP Basic Authentication to convey your identity.

The username is your AccountSid (a 34 character string identifying your API account, starting with the letters "IR"). The password is your authentication token (AuthToken). These values are available on the Technical Settings page of your account.

To start using the gem, you need to set up the AccountSid (username) and authentication token first. If you use Ruby on Rails, the API key can be set in a configuration file (i.e. app/config/initializers/impact_radius.rb), otherwise just set it in your script.

require "impact_radius_api" # no need for RoR  :account_sid, :auth_token,
ImpactRadiusAPI.auth_token = ENV["IR_AUTH_TOKEN"]
ImpactRadiusAPI.account_sid = ENV["IR_ACCOUNT_SID"]

##Configuration Example This applys to Ruby on Rails. Create app/config/initializer/impact_radius_api.rb and add the following:

ImpactRadiusAPI.auth_token = ENV["IR_AUTH_TOKEN"]
ImpactRadiusAPI.account_sid = ENV["IR_ACCOUNT_SID"]

##Usage ###Media Partner Resources Ads Will return all Banner and Text Link ads. See Impact Radius API Documentation Ads

require "impact_radius_api" #not needed for RoR
ImpactRadiusAPI.auth_token = ENV["IR_AUTH_TOKEN"]  #can be in app/config/initializer/impact_radius_api.rb of RoR
ImpactRadiusAPI.account_sid = ENV["IR_ACCOUNT_SID"] #can be in app/config/initializer/impact_radius_api.rb of RoR
mediapartners = ImpactRadiusAPI::Mediapartners.new
options = {
  type: "BANNER" #for only banner ads default is both banner and text link.
}
response = mediapartners.get("Ads", options)
response.data.each do |ad|
  puts "Name: #{ad.Name}"
  puts "Description: #{ad.Description}"
  puts "Link: #{ad.TrackingLink}"
end

If there are multiple pages, retrieve all the pages by using the all method:

response.all.each do |ad|
  # Do stuff
end

###Media Partner Resources Product Will return Products. See Impact Radius API Documentation Products Catalogs and ItemSearch will only work right now. ItemSearch is only for Retail.

require "impact_radius_api" #not needed for RoR
ImpactRadiusAPI.auth_token = ENV["IR_AUTH_TOKEN"]  #can be in app/config/initializer/impact_radius_api.rb of RoR
ImpactRadiusAPI.account_sid = ENV["IR_ACCOUNT_SID"] #can be in app/config/initializer/impact_radius_api.rb of RoR
mediapartners = ImpactRadiusAPI::Mediapartners.new
options = {
  Query=Color:"Red"
}
response = mediapartners.get("Catalogs/ItemSearch", options)
response.data.each do |item|
  puts "Name: #{item.Name}"
  puts "Description: #{item.Description}"
  puts "Link: #{item.TrackingLink}"
end

###Media Partner List Catalog Items Retrieves a list of specific catalog items using the catalog number.

require "impact_radius_api" #not needed for RoR
ImpactRadiusAPI.auth_token = ENV["IR_AUTH_TOKEN"]  #can be in app/config/initializer/impact_radius_api.rb of RoR
ImpactRadiusAPI.account_sid = ENV["IR_ACCOUNT_SID"] #can be in app/config/initializer/impact_radius_api.rb of RoR
mediapartners = ImpactRadiusAPI::Mediapartners.new
options = {
  Query=Color:"Red"
}
response = mediapartners.get("Catalogs/{CatalogID}/Items", options)
response.data.each do |item|
  puts "Name: #{item.Name}"
  puts "Description: #{item.Description}"
  puts "Link: #{item.TrackingLink}"
end

CatalogId Intger required Id for specific Catalog. Example 2255

If there are multiple pages, retrieve all the pages by using the all method:

response.all.each do |item|
  # Do stuff
end

Contributing

  • Fork it ( https://github.com/[my-github-username]/impact_radius_api/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 12 Nov 2017

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