Giter Site home page Giter Site logo

zanox_publisher's Introduction

ZanoxPublisher

This is a ruby wrapper for the ZANOX Publisher API, released on March 1, 2011.

Installation

The simplest way to install ZanoxPublisher is with Bundler.

Add this line to your application's Gemfile:

gem 'zanox_publisher'

And then execute:

$ bundle

Or install it yourself:

$ gem install zanox_publisher

Configuration

The Zanox Publisher API requires a connect ID and a secret key to make requests directly related with the account. General information can often be retrieved with just the connect ID.

The required information for each request can be found in the documentation.

The connect ID and secret key can be set with the authenticate method:

ZanoxPublisher.authenticate('Connect ID', 'Secret key')

Or directly on ZanoxPublisher.

ZanoxPublisher.connect_id = 'Connect ID'
ZanoxPublisher.secret_key = 'Secret key'

Usage

The gem is designed for integratation with Ruby on Rails in mind. The method names try to follow the common methods found on an ActiveRecord object.

Usage with Rails

Install ZanoxPublisher by adding it to your projects Gemfile.

gem 'zanox_publisher'

And then execute:

$ bundle

Finally, create an initializer file config/initializers/zanox_publisher.rb to hold the configuration.

ZanoxPublisher.authenticate('Connect ID', 'Secret key')

To make an API call in your application simply use the gems corresponding ruby object.

Usage outside of Rails

To use ZanoxPublisher in plain ruby require the gem and set the configuration before running your code.

require 'zanox_publisher'

ZanoxPublisher.authenticate('Connect ID', 'Secret key')

# Your code here

Basic examples

ZanoxPublisher is designed to be a full ruby object representation for each of the Zanox API endpoints. The matching of ruby objects to Zanox API method name's is given in the List of Objects.

The examples below expect that ZanoxPublisher is correctly configured and show only some basic usage examples. Check the documentation for the complete reference.

Search for a program that sells hats

programs_that_sell_hats = ZanoxPublisher::Program.all q: 'hats', has_products: true
#=> [<Program>,...]

programs_that_sell_hats.count
#=> 84

first_program = programs_that_sell_hats.first
#=> <Program>

first_program.name
#=> "Asos.com DE"

first_program.products
#=> 50129

Search for a fitting product to an comment

adspaces = ZanoxPublisher::AdSpace.all
#=> [<AdSpace>,...]

adspace  = adspaces.select { |adspace| adspace.url == 'http://www.my-blog.com/' }.first
#=> <AdSpace>

my_programs = ZanoxPublisher::ProgramApplication.all(status: 'confirmed').map(&:program)
#=> [<Program>,...]

comment = params['comment']
#=> 'I also want a baseball cap.'

products = ZanoxPublisher::Product.page 0, per_page: 1, query: comment, adspace: adspace, programs: my_programs
#=> [<Product>]

product = products.first
#=> <Product>

product.tracking_links.first.ppc
#=> "http://ad.zanox.com/ppv/?..."

List of Objects (Implimented)

  • ZanoxPublisher::AdMedium: GetAdmedia, GetAdmedium
  • ZanoxPublisher::AdSpace: GetAdspaces, GetAdspace
  • ZanoxPublisher::Incentive: SearchIncentives, GetIncentive
  • ZanoxPublisher::ExclusiveIncentive: SearchExclusiveIncentives, GetExclusiveIncentive
  • ZanoxPublisher::Product: SearchProducts, GetProduct
  • ZanoxPublisher::Profile: getProfiles
  • ZanoxPublisher::Program: SearchPrograms, GetProgram
  • ZanoxPublisher::ProgramApplication: GetProgramApplications

Documentation

http://www.rubydoc.info/github/oliverprater/zanox_publisher/master

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:

'zanox_publisher', '~> 0.1'

Contributing

  1. Fork it ( https://github.com/oliverprater/zanox_publisher/fork )
  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 a new Pull Request

Copyright

Copyright (c) 2015 Oliver Prater. See LICENSE for details.

zanox_publisher's People

Contributors

oliverprater avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.