zanox_publisher 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef346f6bee84b91e9942b9a7b202a20093949dbd
|
4
|
+
data.tar.gz: dfa3e8edb4b715c2d31c79688434afaaf56a0ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df2882030e67bade1de18007a69f2a909b07a7febed8f50da9eef6e2ce16bb81e907efb08ae5a28308926635e45e2d8cdff56131a2490fe3489735e173a670e0
|
7
|
+
data.tar.gz: 94ad2ec17686ffb5c08c79cf543ba5a8b5dfde5be133149fe3e722f47ecd4987fc5e67fb5a3a303a2520fbaebcdea1ba53b67ad7a2c9478d1c6903a49cec9c1a
|
@@ -167,7 +167,7 @@ module ZanoxPublisher
|
|
167
167
|
# @param id [Integer] the ID of the adspace you want to get.
|
168
168
|
# @param adspace [AdSpace, Integer] if you would like tracking links for only one of your publisher ad spaces, pass its ID in this parameter.
|
169
169
|
#
|
170
|
-
# @return [<AdMedium
|
170
|
+
# @return [<AdMedium>, nil]
|
171
171
|
def find(id, options = {})
|
172
172
|
params = {}
|
173
173
|
|
@@ -179,6 +179,10 @@ module ZanoxPublisher
|
|
179
179
|
response = self.connection.get(RESOURCE_PATH + "/admedium/#{id}", params)
|
180
180
|
admedium = response.fetch('admediumItem', [])
|
181
181
|
|
182
|
+
if admedium.empty?
|
183
|
+
return nil
|
184
|
+
end
|
185
|
+
|
182
186
|
AdMedium.new(admedium)
|
183
187
|
end
|
184
188
|
|
@@ -98,11 +98,15 @@ module ZanoxPublisher
|
|
98
98
|
#
|
99
99
|
# @param id [Integer] the ID of the adspace you want to get
|
100
100
|
#
|
101
|
-
# @return [<AdSpace
|
101
|
+
# @return [<AdSpace>, nil]
|
102
102
|
def find(id)
|
103
103
|
response = self.connection.signature_get(RESOURCE_PATH + "/adspace/#{id}")
|
104
104
|
adspace = response.fetch('adspaceItem', []).first
|
105
105
|
|
106
|
+
if adspace.empty?
|
107
|
+
return nil
|
108
|
+
end
|
109
|
+
|
106
110
|
AdSpace.new(adspace)
|
107
111
|
end
|
108
112
|
|
@@ -126,9 +126,12 @@ module ZanoxPublisher
|
|
126
126
|
|
127
127
|
programs = options[:programs]
|
128
128
|
|
129
|
-
|
130
|
-
programs = programs.map(&:to_i).join(',')
|
131
|
-
|
129
|
+
if programs.is_a? Array
|
130
|
+
programs = programs.map(&:to_i).join(',')
|
131
|
+
elsif programs.is_a? Program or programs.is_a? Integer
|
132
|
+
programs = programs.to_i
|
133
|
+
else
|
134
|
+
programs = nil
|
132
135
|
end
|
133
136
|
|
134
137
|
has_images = options[:has_images]
|
@@ -192,7 +195,7 @@ module ZanoxPublisher
|
|
192
195
|
# @param id [Integer] the ID of the adspace you want to get.
|
193
196
|
# @param adspace [AdSpace, Integer] if you would like tracking links for only one of your publisher ad spaces, pass its ID in this parameter.
|
194
197
|
#
|
195
|
-
# @return [<Product
|
198
|
+
# @return [<Product>, nil]
|
196
199
|
def find(id, options = {})
|
197
200
|
params = {}
|
198
201
|
|
@@ -202,8 +205,13 @@ module ZanoxPublisher
|
|
202
205
|
params = { query: { adspace: adspace } } unless adspace.nil?
|
203
206
|
|
204
207
|
response = self.connection.get(RESOURCE_PATH + "/product/#{id.to_i}", params)
|
208
|
+
product = response.fetch('productItem').first
|
205
209
|
|
206
|
-
|
210
|
+
if product.empty?
|
211
|
+
return nil
|
212
|
+
end
|
213
|
+
|
214
|
+
Product.new(product)
|
207
215
|
end
|
208
216
|
|
209
217
|
# A connection instance with Products' relative_path
|
@@ -246,9 +254,9 @@ module ZanoxPublisher
|
|
246
254
|
end
|
247
255
|
|
248
256
|
attr_accessor :id, :name, :modified_at, :program, :price, :currency, :tracking_links,
|
249
|
-
|
250
|
-
|
251
|
-
|
257
|
+
:description, :description_long, :manufacturer, :ean, :delivery_time,
|
258
|
+
:terms, :category, :image, :price_old, :shipping_costs, :shipping,
|
259
|
+
:merchant_category, :merchant_product_id
|
252
260
|
|
253
261
|
# make API names available
|
254
262
|
alias modified modified_at
|
@@ -135,12 +135,16 @@ module ZanoxPublisher
|
|
135
135
|
#
|
136
136
|
# @param id [Program, Integer] the ID of the program you want to get.
|
137
137
|
#
|
138
|
-
# @return [<Program
|
138
|
+
# @return [<Program>, nil]
|
139
139
|
def find(id)
|
140
140
|
response = self.connection.get(RESOURCE_PATH + "/program/#{id.to_i}")
|
141
|
-
|
141
|
+
program = response.fetch('programItem', []).first
|
142
142
|
|
143
|
-
|
143
|
+
if program.empty?
|
144
|
+
return nil
|
145
|
+
end
|
146
|
+
|
147
|
+
Program.new(program)
|
144
148
|
end
|
145
149
|
|
146
150
|
# Get all program categories, including names and IDs, associated to the connect ID.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zanox_publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Prater
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|