zanox 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +17 -0
- data/Gemfile.lock +26 -0
- data/README.textile +18 -8
- data/Rakefile +48 -67
- data/VERSION +1 -0
- data/examples/simple.rb +87 -0
- data/lib/zanox.rb +3 -8
- data/test/helper.rb +26 -0
- data/test/test_zanox.rb +70 -0
- data/zanox.gemspec +71 -33
- metadata +119 -29
- data/spec/zanox_specs.rb +0 -90
- data/test/zanox_tests.rb +0 -12
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem 'ruby-hmac'
|
7
|
+
gem 'soap4r'
|
8
|
+
|
9
|
+
|
10
|
+
# Add dependencies to develop your gem here.
|
11
|
+
# Include everything needed to run rake, tests, features, etc.
|
12
|
+
group :development do
|
13
|
+
gem 'shoulda'
|
14
|
+
gem "bundler", "~> 1.0.0"
|
15
|
+
gem "jeweler", "~> 1.5.2"
|
16
|
+
gem "rcov", ">= 0"
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
httpclient (2.1.6.1)
|
6
|
+
jeweler (1.5.2)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.8.7)
|
11
|
+
rcov (0.9.9)
|
12
|
+
ruby-hmac (0.4.0)
|
13
|
+
shoulda (2.11.3)
|
14
|
+
soap4r (1.5.8)
|
15
|
+
httpclient (>= 2.1.1)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
bundler (~> 1.0.0)
|
22
|
+
jeweler (~> 1.5.2)
|
23
|
+
rcov
|
24
|
+
ruby-hmac
|
25
|
+
shoulda
|
26
|
+
soap4r
|
data/README.textile
CHANGED
@@ -3,12 +3,12 @@ h1. zanox
|
|
3
3
|
by Krispin Schulz
|
4
4
|
|
5
5
|
The zanox gem is the ruby way to use the zanox API.
|
6
|
-
It is a
|
6
|
+
It is a wrapper for the zanox Publisher web services and you can use resources like
|
7
7
|
models in ActiveRecord.
|
8
8
|
|
9
9
|
h2. Getting started
|
10
10
|
|
11
|
-
* Install the gem
|
11
|
+
* Install the gem <pre><code>gem install zanox</code></pre>
|
12
12
|
* Learn its usage with the examples below
|
13
13
|
* Create shiny ruby apps with it
|
14
14
|
|
@@ -17,11 +17,13 @@ h2. Features
|
|
17
17
|
Supported zanox API methods:
|
18
18
|
|
19
19
|
|*zanox API method*|*the ruby way*|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
| getAdspaces | Zanox::Adspace.find(:all) |
|
21
|
+
| getAdspace | Zanox::Adspace.find('adspace id here') |
|
22
|
+
| getProgram | Zanox::Program.find('program id here') |
|
23
|
+
| getProgramsByAdspace | Zanox::Program.find(:adspaceId => 'adspace id here') |
|
22
24
|
| searchPrograms | Zanox::Program.find('amazon', :region=>'de') |
|
23
|
-
| getProduct | Zanox::Product.find('
|
24
|
-
| getProducts | Zanox::Product.find(:programId=>'program id is required here', :adspaceId=>'
|
25
|
+
| getProduct | Zanox::Product.find('zupid of the product here') |
|
26
|
+
| getProducts | Zanox::Product.find(:programId=>'program id is required here', :adspaceId=>'adspace id here') |
|
25
27
|
| searchProducts | Zanox::Product.find('ipad', :region=>'de', :programId=>'a program id here') |
|
26
28
|
| getSales | Zanox::Sale.find(:date=>'2010-03-02T00:00:00', :dateType=>'trackingDate') |
|
27
29
|
|
@@ -31,8 +33,16 @@ h2. Examples
|
|
31
33
|
require 'rubygems'
|
32
34
|
require 'zanox'
|
33
35
|
|
34
|
-
# first
|
35
|
-
Zanox::API.
|
36
|
+
# first fill in your zanox Application credentials
|
37
|
+
Zanox::API.authorize("your public key", "your secret key")
|
38
|
+
|
39
|
+
# you can get a new Session by passing an auth token that
|
40
|
+
# will be in the callback url after the
|
41
|
+
# successful login of a zanox Publisher
|
42
|
+
# e.g. Zanox::API::Session.new("fill in the parameter 'authtoken'")
|
43
|
+
|
44
|
+
# or use an offline token to retrieve a valid zanox Session
|
45
|
+
Zanox::API::Session.offline("fill in the offline token of a Publisher")
|
36
46
|
|
37
47
|
# request products as easy as hell
|
38
48
|
Zanox::Product.find('ipod').each do |product|
|
data/Rakefile
CHANGED
@@ -1,72 +1,53 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
3
11
|
|
4
|
-
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "zanox"
|
16
|
+
gem.homepage = "http://github.com/kr1sp1n/zanox"
|
17
|
+
gem.license = "CC"
|
18
|
+
gem.summary = %Q{One gem to rule the zanox API.}
|
19
|
+
gem.description = %Q{The easy way to the zanox web services.}
|
20
|
+
gem.email = "krispinone@googlemail.com"
|
21
|
+
gem.authors = ["Krispin Schulz", "Tobias Schlottke"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
gem.add_runtime_dependency 'ruby-hmac'
|
25
|
+
gem.add_runtime_dependency 'soap4r'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
5
28
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# Linux
|
12
|
-
$linux = true
|
13
|
-
when /sunos|solaris/i
|
14
|
-
# Solaris
|
15
|
-
$solaris = true
|
16
|
-
else
|
17
|
-
# Whatever
|
18
|
-
$mac = true
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
19
34
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Run specs"
|
29
|
-
task :spec do
|
30
|
-
sh "spec spec/* --format specdoc --color"
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "Build the gem"
|
34
|
-
task :build do
|
35
|
-
sh "gem build #$gem_name.gemspec"
|
36
|
-
if windows?
|
37
|
-
sh "move /Y *.gem ./pkg"
|
38
|
-
else
|
39
|
-
sh "mv #$gem_name*.gem ./pkg"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "Install the library at local machine"
|
44
|
-
task :install => :build do
|
45
|
-
if windows?
|
46
|
-
sh "gem install ./pkg/#$gem_name -l"
|
47
|
-
else
|
48
|
-
sh "sudo gem install ./pkg/#$gem_name -l"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
desc "Uninstall the library from local machine"
|
53
|
-
task :uninstall do
|
54
|
-
if windows?
|
55
|
-
sh "gem uninstall #$gem_name"
|
56
|
-
else
|
57
|
-
sh "sudo gem uninstall #$gem_name"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "Reinstall the library in the local machine"
|
62
|
-
task :reinstall => [:uninstall, :install] do
|
63
|
-
end
|
64
|
-
|
65
|
-
desc "Clean"
|
66
|
-
task :clean do
|
67
|
-
# sh "rm #$gem_name*.gem"
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
68
41
|
end
|
69
42
|
|
70
|
-
|
71
|
-
|
72
|
-
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "zanox #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.7
|
data/examples/simple.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__),"..","lib","zanox.rb")
|
2
|
+
|
3
|
+
Zanox::API.authenticate('your connect id here', 'your secret key here')
|
4
|
+
|
5
|
+
def show(items, *args)
|
6
|
+
puts "\nFound items: "+items.size.to_s+"\n"
|
7
|
+
items.each do |item|
|
8
|
+
line = ""
|
9
|
+
args.each do |arg|
|
10
|
+
if(arg.is_a?(Symbol))
|
11
|
+
if(item.respond_to?(arg))
|
12
|
+
line.concat(item.method(arg).call)
|
13
|
+
end
|
14
|
+
elsif(arg.is_a?(String))
|
15
|
+
line.concat(arg)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
puts line
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# PRODUCTS #
|
23
|
+
############
|
24
|
+
|
25
|
+
# find products by keywords
|
26
|
+
products = Zanox::Product.find('ipod')
|
27
|
+
show products, "Product ", :id, "\t\"", :name, "\" - ", :price, " ", :currency
|
28
|
+
# or find specific product by id
|
29
|
+
product_id = products[0].id
|
30
|
+
products = Zanox::Product.find(product_id)
|
31
|
+
show products, "Product ", :id, "\t\"", :name, "\" - ", :price, " ", :currency
|
32
|
+
|
33
|
+
# ADSPACES #
|
34
|
+
############
|
35
|
+
|
36
|
+
# find all your Adspaces
|
37
|
+
adspaces = Zanox::Adspace.find(:all)
|
38
|
+
show adspaces, "Adspace ", :id, "\t\"", :name, "\""
|
39
|
+
|
40
|
+
# or find specific Adspace by id
|
41
|
+
adspace_id = adspaces[0].id
|
42
|
+
adspaces = Zanox::Adspace.find(adspace_id)
|
43
|
+
show adspaces, "Adspace ", :id, "\t\"", :name, "\""
|
44
|
+
|
45
|
+
# PROGRAMS #
|
46
|
+
############
|
47
|
+
|
48
|
+
# find zanox programs by keywords
|
49
|
+
programs = Zanox::Program.find('amazon')
|
50
|
+
show programs, "Program ", :id, "\t\"", :name, "\""
|
51
|
+
|
52
|
+
# or find specific zanox programs by id
|
53
|
+
program_id = programs[0].id
|
54
|
+
programs = Zanox::Program.find(program_id)
|
55
|
+
show programs, "Program ", :id, "\t\"", :name, "\""
|
56
|
+
|
57
|
+
# or find programs that are registered with one of your Adspaces
|
58
|
+
programs = Zanox::Program.find(:adspaceId => adspace_id)
|
59
|
+
show programs, "Program ", :id, "\t\"", :name, "\""
|
60
|
+
|
61
|
+
# SALES #
|
62
|
+
#########
|
63
|
+
|
64
|
+
puts "\nSALES"
|
65
|
+
# find a sale by date
|
66
|
+
date = "2010-03-02T00:00:00"
|
67
|
+
sales = Zanox::Sale.find(:date=>date, :dateType=>'trackingDate')
|
68
|
+
show sales, "Sale ", :id, " ", :commission, " EUR - ", :reviewState
|
69
|
+
|
70
|
+
# get zpar
|
71
|
+
sales[0].gpps.gpp.each do |gpp|
|
72
|
+
puts gpp.xmlattr_id + " = " + gpp
|
73
|
+
end
|
74
|
+
|
75
|
+
# MEDIASLOTS #
|
76
|
+
##############
|
77
|
+
|
78
|
+
# find all your MediaSlots
|
79
|
+
mediaslots = Zanox::MediaSlot.find(:all, :items=>99)
|
80
|
+
show mediaslots, "MediaSlot ", :id, " \"", :name, "\""
|
81
|
+
# or find a specific MediaSlot
|
82
|
+
mediaslot_id = mediaslots[0].id
|
83
|
+
mediaslots = Zanox::MediaSlot.find(mediaslot_id)
|
84
|
+
show mediaslots, "MediaSlot ", :id, " \"", :name, "\""
|
85
|
+
# or find Mediaslots by adspace id
|
86
|
+
mediaslots = Zanox::MediaSlot.find(:adspaceId=>adspace_id, :items=>99)
|
87
|
+
show mediaslots, "MediaSlot ", :id, " \"", :name, "\""
|
data/lib/zanox.rb
CHANGED
@@ -42,9 +42,7 @@ module Zanox
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.generate_nonce
|
45
|
-
|
46
|
-
rand = rand()
|
47
|
-
Digest::MD5.hexdigest((mt + rand).to_s)
|
45
|
+
Digest::MD5.hexdigest((Time.new.usec + rand()).to_s)
|
48
46
|
end
|
49
47
|
|
50
48
|
def self.get_timestamp
|
@@ -52,7 +50,7 @@ module Zanox
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def self.create_signature(secret_key, string2sign)
|
55
|
-
|
53
|
+
Base64.encode64(HMAC::SHA1.new(secret_key).update(string2sign).digest)[0..-2]
|
56
54
|
end
|
57
55
|
|
58
56
|
def self.authorize(public_key, secret_key)
|
@@ -62,10 +60,7 @@ module Zanox
|
|
62
60
|
end
|
63
61
|
|
64
62
|
def self.authenticate(connect_id, secret_key=nil)
|
65
|
-
|
66
|
-
@connect_id = connect_id
|
67
|
-
@secret_key = secret_key
|
68
|
-
true
|
63
|
+
raise 'Zanox::API.authenticate(connect_id, secret_key) is no longer supported. Please use Zanox::API.authorize("your public key", "your secret key") instead.'
|
69
64
|
end
|
70
65
|
|
71
66
|
module Session
|
data/test/helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'zanox'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
def setup
|
19
|
+
Zanox::API.authorize("your app's public key", "your app's secret key")
|
20
|
+
Zanox::API::Session.offline("a zanox Publisher's offline token")
|
21
|
+
# or use Zanox::API::Session.new("a zanox Connect authtoken")
|
22
|
+
#
|
23
|
+
# please configure Puplisher specific constants in test_zanox.rb to make the tests runnable
|
24
|
+
#
|
25
|
+
end
|
26
|
+
end
|
data/test/test_zanox.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestZanoxConnect < Test::Unit::TestCase
|
4
|
+
should "get a new offline session" do
|
5
|
+
TEST_CONNECT_ID = "668189244D19BABF75AC"
|
6
|
+
assert_equal(TEST_CONNECT_ID, Zanox::API::Session.connect_id)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class TestZanoxProfile < Test::Unit::TestCase
|
11
|
+
should "find the users profile" do
|
12
|
+
TEST_FIRSTNAME = "Krispin"
|
13
|
+
assert_equal(1, Zanox::Profile.find.size)
|
14
|
+
assert_equal(TEST_FIRSTNAME, Zanox::Profile.find[0].firstName)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class TestZanoxAdspace < Test::Unit::TestCase
|
19
|
+
TEST_ADSPACE_ID = "99501"
|
20
|
+
|
21
|
+
should "find all user's Adspaces" do
|
22
|
+
assert(Zanox::Adspace.find(:all).size >= 1)
|
23
|
+
end
|
24
|
+
should "find the Publisher's Adspace by an id" do
|
25
|
+
assert_equal(1, Zanox::Adspace.find(TEST_ADSPACE_ID).size)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class TestZanoxProduct < Test::Unit::TestCase
|
30
|
+
TEST_PRODUCT_QUERY = "ipod"
|
31
|
+
TEST_PRODUCT_ID = "afdd090e0ee25e796e5146f6fcd7b15e"
|
32
|
+
|
33
|
+
should "find products by a keyword" do
|
34
|
+
assert(Zanox::Product.find(TEST_PRODUCT_QUERY).size >= 1)
|
35
|
+
end
|
36
|
+
|
37
|
+
should "find a specific product by its id" do
|
38
|
+
assert_equal(1, Zanox::Product.find(TEST_PRODUCT_ID).size)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class TestZanoxProgram < Test::Unit::TestCase
|
43
|
+
TEST_PROGRAM_QUERY = "Amazon"
|
44
|
+
TEST_PROGRAM_ID = "1648"
|
45
|
+
TEST_ADSPACE_ID = "99501"
|
46
|
+
|
47
|
+
should "find programs by a keyword" do
|
48
|
+
assert(Zanox::Program.find(TEST_PROGRAM_QUERY).size >= 1)
|
49
|
+
end
|
50
|
+
|
51
|
+
should "find a specific program by its id" do
|
52
|
+
assert_equal(1, Zanox::Program.find(TEST_PROGRAM_ID).size)
|
53
|
+
end
|
54
|
+
|
55
|
+
should "find programs by an adspace" do
|
56
|
+
assert(Zanox::Program.find(:adspaceId=>TEST_ADSPACE_ID).size >= 1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class TestZanoxSale < Test::Unit::TestCase
|
61
|
+
TEST_SALE_ID = "92ba89e7-b229-4933-857c-e307c0291856"
|
62
|
+
TEST_DATE = "2010-03-02T00:00:00"
|
63
|
+
|
64
|
+
should "find all sales for a given date" do
|
65
|
+
assert(Zanox::Sale.find(:date=>TEST_DATE, :dateType=>'trackingDate').size.should >= 1)
|
66
|
+
end
|
67
|
+
should "find a sale by its id" do
|
68
|
+
assert_equal(1, Zanox::Sale.find(TEST_SALE_ID).size)
|
69
|
+
end
|
70
|
+
end
|
data/zanox.gemspec
CHANGED
@@ -1,36 +1,74 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
require 'rubygems'
|
6
|
-
require 'rake'
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{zanox}
|
8
|
+
s.version = "0.2.7"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Krispin Schulz", "Tobias Schlottke"]
|
12
|
+
s.date = %q{2011-02-16}
|
13
|
+
s.description = %q{The easy way to the zanox web services.}
|
14
|
+
s.email = %q{krispinone@googlemail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.textile"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"Gemfile",
|
20
|
+
"Gemfile.lock",
|
21
|
+
"README.textile",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"examples/simple.rb",
|
25
|
+
"lib/zanox.rb",
|
26
|
+
"test/helper.rb",
|
27
|
+
"test/test_zanox.rb",
|
28
|
+
"zanox.gemspec"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/kr1sp1n/zanox}
|
31
|
+
s.licenses = ["CC"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.4.1}
|
34
|
+
s.summary = %q{One gem to rule the zanox API.}
|
35
|
+
s.test_files = [
|
36
|
+
"examples/simple.rb",
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_zanox.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
46
|
+
s.add_runtime_dependency(%q<soap4r>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
50
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<soap4r>, [">= 0"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
55
|
+
s.add_dependency(%q<soap4r>, [">= 0"])
|
56
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
57
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
59
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
60
|
+
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
61
|
+
s.add_dependency(%q<soap4r>, [">= 0"])
|
62
|
+
end
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
65
|
+
s.add_dependency(%q<soap4r>, [">= 0"])
|
66
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
67
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
68
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
69
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
70
|
+
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
71
|
+
s.add_dependency(%q<soap4r>, [">= 0"])
|
72
|
+
end
|
28
73
|
end
|
29
74
|
|
30
|
-
# Rake::GemPackageTask.new(spec) do |pkg|
|
31
|
-
# pkg.need_tar = true
|
32
|
-
# end
|
33
|
-
#
|
34
|
-
# task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
|
35
|
-
# puts "generated latest version"
|
36
|
-
# end
|
metadata
CHANGED
@@ -1,56 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zanox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Krispin Schulz
|
14
|
+
- Tobias Schlottke
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-16 00:00:00 +01:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
+
type: :runtime
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
requirement: *id001
|
23
34
|
prerelease: false
|
24
|
-
|
35
|
+
name: ruby-hmac
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
25
39
|
none: false
|
26
40
|
requirements:
|
27
41
|
- - ">="
|
28
42
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
requirement: *id002
|
48
|
+
prerelease: false
|
49
|
+
name: soap4r
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
type: :development
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
requirement: *id003
|
62
|
+
prerelease: false
|
63
|
+
name: shoulda
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
type: :development
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 23
|
30
72
|
segments:
|
31
73
|
- 1
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 1.
|
35
|
-
|
36
|
-
|
74
|
+
- 0
|
75
|
+
- 0
|
76
|
+
version: 1.0.0
|
77
|
+
requirement: *id004
|
78
|
+
prerelease: false
|
79
|
+
name: bundler
|
37
80
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
81
|
+
type: :development
|
82
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 7
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 5
|
91
|
+
- 2
|
92
|
+
version: 1.5.2
|
93
|
+
requirement: *id005
|
39
94
|
prerelease: false
|
40
|
-
|
95
|
+
name: jeweler
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
type: :development
|
98
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
41
99
|
none: false
|
42
100
|
requirements:
|
43
101
|
- - ">="
|
44
102
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
103
|
+
hash: 3
|
46
104
|
segments:
|
47
105
|
- 0
|
48
|
-
|
106
|
+
version: "0"
|
107
|
+
requirement: *id006
|
108
|
+
prerelease: false
|
109
|
+
name: rcov
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
type: :runtime
|
112
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
49
119
|
- 0
|
50
|
-
version: 0
|
120
|
+
version: "0"
|
121
|
+
requirement: *id007
|
122
|
+
prerelease: false
|
123
|
+
name: ruby-hmac
|
124
|
+
- !ruby/object:Gem::Dependency
|
51
125
|
type: :runtime
|
52
|
-
version_requirements:
|
53
|
-
|
126
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
requirement: *id008
|
136
|
+
prerelease: false
|
137
|
+
name: soap4r
|
138
|
+
description: The easy way to the zanox web services.
|
54
139
|
email: krispinone@googlemail.com
|
55
140
|
executables: []
|
56
141
|
|
@@ -59,20 +144,23 @@ extensions: []
|
|
59
144
|
extra_rdoc_files:
|
60
145
|
- README.textile
|
61
146
|
files:
|
62
|
-
-
|
63
|
-
-
|
147
|
+
- Gemfile
|
148
|
+
- Gemfile.lock
|
64
149
|
- README.textile
|
150
|
+
- Rakefile
|
151
|
+
- VERSION
|
152
|
+
- examples/simple.rb
|
65
153
|
- lib/zanox.rb
|
66
|
-
- test/
|
67
|
-
-
|
154
|
+
- test/helper.rb
|
155
|
+
- test/test_zanox.rb
|
156
|
+
- zanox.gemspec
|
68
157
|
has_rdoc: true
|
69
158
|
homepage: http://github.com/kr1sp1n/zanox
|
70
|
-
licenses:
|
71
|
-
|
159
|
+
licenses:
|
160
|
+
- CC
|
72
161
|
post_install_message:
|
73
|
-
rdoc_options:
|
74
|
-
|
75
|
-
- README.textile
|
162
|
+
rdoc_options: []
|
163
|
+
|
76
164
|
require_paths:
|
77
165
|
- lib
|
78
166
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -101,4 +189,6 @@ signing_key:
|
|
101
189
|
specification_version: 3
|
102
190
|
summary: One gem to rule the zanox API.
|
103
191
|
test_files:
|
104
|
-
-
|
192
|
+
- examples/simple.rb
|
193
|
+
- test/helper.rb
|
194
|
+
- test/test_zanox.rb
|
data/spec/zanox_specs.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),"..","lib","zanox.rb")
|
2
|
-
|
3
|
-
describe Zanox::API do
|
4
|
-
|
5
|
-
TEST_PUBLIC_KEY = "your public key here"
|
6
|
-
TEST_SECRET_KEY = "your secret key here"
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should authorize a developer's application" do
|
12
|
-
Zanox::API.authorize(TEST_PUBLIC_KEY, TEST_SECRET_KEY).should == true
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe Zanox::API::Session do
|
17
|
-
it "should get a new session" do
|
18
|
-
TEST_AUTH_TOKEN = "your auth token here"
|
19
|
-
Zanox::API::Session.new(TEST_AUTH_TOKEN).should == true
|
20
|
-
end
|
21
|
-
it "should get a new offline session" do
|
22
|
-
TEST_OFFLINE_TOKEN = "your offline token here"
|
23
|
-
TEST_CONNECT_ID = "publisher connect id here"
|
24
|
-
Zanox::API::Session.offline(TEST_OFFLINE_TOKEN)
|
25
|
-
Zanox::API::Session.connect_id.should == TEST_CONNECT_ID
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe Zanox::Profile do
|
30
|
-
it "should find the users profile" do
|
31
|
-
Zanox::Profile.find.size.should == 1
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe Zanox::Product do
|
36
|
-
# Product.find
|
37
|
-
TEST_PRODUCT_QUERY = "ipod"
|
38
|
-
TEST_PRODUCT_ID = "afdd090e0ee25e796e5146f6fcd7b15e"
|
39
|
-
|
40
|
-
it "should find products by a keyword" do
|
41
|
-
Zanox::Product.find(TEST_PRODUCT_QUERY).size.should >= 1
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should find a specific product by its id" do
|
45
|
-
Zanox::Product.find(TEST_PRODUCT_ID).size.should == 1
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe Zanox::Program do
|
50
|
-
# Program.find
|
51
|
-
TEST_PROGRAM_QUERY = "Amazon"
|
52
|
-
TEST_PROGRAM_ID = "1648"
|
53
|
-
TEST_ADSPACE_ID = "1289612"
|
54
|
-
|
55
|
-
it "should find programs by a keyword" do
|
56
|
-
Zanox::Program.find(TEST_PROGRAM_QUERY).size.should >= 1
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should find a specific program by its id" do
|
60
|
-
Zanox::Program.find(TEST_PROGRAM_ID).size.should == 1
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should find programs by an adspace" do
|
64
|
-
Zanox::Program.find(:adspaceId=>TEST_ADSPACE_ID).size.should >= 1
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe Zanox::Adspace do
|
69
|
-
# Adspace.find
|
70
|
-
TEST_ADSPACE_ID = "99501"
|
71
|
-
|
72
|
-
it "should find all user's Adspaces" do
|
73
|
-
Zanox::Adspace.find(:all).size.should >=1
|
74
|
-
end
|
75
|
-
it "should find the users Adspace by an id" do
|
76
|
-
Zanox::Adspace.find(TEST_ADSPACE_ID).size.should == 1
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe Zanox::Sale do
|
81
|
-
# Sale.find
|
82
|
-
TEST_SALE_ID = "92ba89e7-b229-4933-857c-e307c0291856"
|
83
|
-
TEST_DATE = "2010-03-02T00:00:00"
|
84
|
-
it "should find all sales for a given date" do
|
85
|
-
Zanox::Sale.find(:date=>TEST_DATE, :dateType=>'trackingDate').size.should >=1
|
86
|
-
end
|
87
|
-
it "should find a sale by its id" do
|
88
|
-
Zanox::Sale.find(TEST_SALE_ID).size.should == 1
|
89
|
-
end
|
90
|
-
end
|