zanox 0.2.0 → 0.2.1
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/README.textile +32 -2
- data/lib/zanox.rb +13 -9
- data/zanox.gemspec +1 -1
- metadata +2 -2
data/README.textile
CHANGED
@@ -1,6 +1,36 @@
|
|
1
|
-
|
1
|
+
h1. zanox
|
2
2
|
|
3
|
-
|
3
|
+
by Krispin Schulz
|
4
|
+
|
5
|
+
The zanox gem is the ruby way to use the zanox API.
|
6
|
+
It is a coherent wrapper for the zanox Publisher web services and you can use resources like
|
7
|
+
models in ActiveRecord.
|
8
|
+
|
9
|
+
h2. Getting started
|
10
|
+
|
11
|
+
* Install the gem
|
12
|
+
* Learn its usage with the examples below
|
13
|
+
* Create shiny ruby apps with it
|
14
|
+
|
15
|
+
h2. Examples
|
16
|
+
|
17
|
+
<pre><code>
|
18
|
+
require 'rubygems'
|
19
|
+
require 'zanox'
|
20
|
+
|
21
|
+
# first authenticate with your zanox connect id
|
22
|
+
Zanox::API.authenticate('26EE1314AEA84BB7C9FC')
|
23
|
+
|
24
|
+
# request products as easy as hell
|
25
|
+
Zanox::Product.find('ipod').each do |product|
|
26
|
+
puts product.id + " : " + product.name
|
27
|
+
end
|
28
|
+
|
29
|
+
# request products by its zupid
|
30
|
+
Zanox::Product.find('afdd090e0ee25e796e5146f6fcd7b15e').each do |product|
|
31
|
+
puts product.id + " : " + product.name
|
32
|
+
end
|
33
|
+
</code></pre>
|
4
34
|
|
5
35
|
|
6
36
|
|
data/lib/zanox.rb
CHANGED
@@ -66,11 +66,13 @@ module Zanox
|
|
66
66
|
items = []
|
67
67
|
class_name = self.name.split('::').last
|
68
68
|
api_method = 'get'+self.pluralize
|
69
|
-
|
70
|
-
|
69
|
+
unless Zanox::API.secret_key.nil?
|
70
|
+
timestamp = Zanox::API.get_timestamp
|
71
|
+
nonce = Zanox::API.generate_nonce
|
71
72
|
|
72
|
-
|
73
|
-
|
73
|
+
signature = Zanox::API.create_signature(Zanox::API.secret_key, "publisherservice"+api_method.downcase + timestamp + nonce)
|
74
|
+
options.merge!(:timestamp=>timestamp, :nonce=>nonce, :signature=>signature)
|
75
|
+
end
|
74
76
|
|
75
77
|
response = Zanox::API.request(api_method, options)
|
76
78
|
|
@@ -106,14 +108,16 @@ module Zanox
|
|
106
108
|
|
107
109
|
class_name = self.name.split('::').last
|
108
110
|
api_method = ''
|
109
|
-
timestamp = Zanox::API.get_timestamp
|
110
|
-
nonce = Zanox::API.generate_nonce
|
111
111
|
|
112
112
|
if(ids.size>0)
|
113
113
|
api_method = 'get'+class_name.capitalize
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
unless Zanox::API.secret_key.nil?
|
115
|
+
timestamp = Zanox::API.get_timestamp
|
116
|
+
nonce = Zanox::API.generate_nonce
|
117
|
+
signature = Zanox::API.create_signature(Zanox::API.secret_key, "publisherservice"+api_method.downcase + timestamp + nonce)
|
118
|
+
options.merge!(:timestamp=>timestamp, :nonce=>nonce, :signature=>signature)
|
119
|
+
end
|
120
|
+
|
117
121
|
ids.each do |id|
|
118
122
|
options.merge!(self.key_symbol=>id)
|
119
123
|
response = Zanox::API.request(api_method, options)
|
data/zanox.gemspec
CHANGED