actv 1.1.6 → 1.1.17
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.
- checksums.yaml +5 -13
- data/.ruby-version +1 -1
- data/actv.gemspec +1 -1
- data/lib/actv.rb +3 -3
- data/lib/actv/asset.rb +121 -0
- data/lib/actv/asset_stats_result.rb +11 -0
- data/lib/actv/client.rb +29 -7
- data/lib/actv/place.rb +1 -1
- data/lib/actv/search_results.rb +2 -1
- data/lib/actv/version.rb +1 -1
- data/spec/actv/asset_spec.rb +161 -1
- data/spec/actv/client/asset_stats_results_spec.rb +33 -0
- data/spec/actv/client/event_results_spec.rb +4 -3
- data/spec/actv/client_spec.rb +39 -0
- data/spec/actv/place_spec.rb +1 -22
- metadata +34 -31
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDkzMmM2ZGExM2EzNjc3YTI5YjZmNjFlY2UxYjlkZWJkMTU0M2Y3Zg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: abdd5a7628be3bdf71cca4ea233f6c1fc3dca5ac
|
4
|
+
data.tar.gz: 371332a845000cd007ef6f9e6fdab5be562350c2
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZmE3MTkwZjk0M2JmMTIwNDVkZDhhNzI3NTMwYzIwMWMwNzE1MmZkNGJhZWMx
|
11
|
-
NmQyMmM4NGQzYTIzYTBlOWY0MzY5NGYyMjkwOTIxNmU3YTlkNmY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGMwYWU5YjIyMzNlNjFkZTZmYzQ3YmMwMTRkMzA5NmE2ZWVlNjk2NzA1OTFj
|
14
|
-
MGY0NDg0NzJjNmM3N2Y4NTcwZDdjMDMwNmZjMzNiNzhhZTU5MGEyYTY5N2Yw
|
15
|
-
NzY3MjgyNTAyNDg5NzBmOTZkNzIzYTJlYzdlMTFmY2M5ZjM5YjU=
|
6
|
+
metadata.gz: c4f6964f87e5cbabdb2f669f663f1f373507fdee0838e129b8181e83f48e484f01426eeb5bb7954b6d9354d3cc079c58fec30fc22593c46b11ee3077bedccdb2
|
7
|
+
data.tar.gz: 3448e2026bab74f690087312c75718bf8a0093aba72115d7cbe72a6a5ad051dff84858522462cde59d74abe974e3663cf9da7226d3ecbe40f993ec187ba55d32
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-
|
1
|
+
ruby-2.0.0-p247
|
data/actv.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.expand_path('../lib/actv/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.add_dependency 'faraday', '~> 0.8'
|
5
|
+
gem.add_dependency 'faraday', '~> 0.8.0'
|
6
6
|
gem.add_dependency 'multi_json', '~> 1.3'
|
7
7
|
gem.add_dependency 'simple_oauth', '~> 0.1.6'
|
8
8
|
gem.add_dependency 'nokogiri'
|
data/lib/actv.rb
CHANGED
@@ -13,20 +13,20 @@ module ACTV
|
|
13
13
|
def client
|
14
14
|
ACTV::Client.new(options)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def options
|
18
18
|
@options = {}
|
19
19
|
ACTV::Configurable.keys.each do |key|
|
20
20
|
@options[key] = instance_variable_get("@#{key}")
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
@options
|
24
24
|
end
|
25
25
|
|
26
26
|
def respond_to?(method, include_private=false)
|
27
27
|
self.client.respond_to?(method, include_private) || super
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def reset!
|
31
31
|
ACTV::Configurable.keys.each do |key|
|
32
32
|
instance_variable_set("@#{key}", ACTV::Default.options[key])
|
data/lib/actv/asset.rb
CHANGED
@@ -214,9 +214,130 @@ module ACTV
|
|
214
214
|
self.sourceSystem[:legacyGuid].upcase == "2BA50ABA-080E-4E3D-A01C-1B4F56648A2E" rescue false
|
215
215
|
end
|
216
216
|
|
217
|
+
def activenet?
|
218
|
+
self.sourceSystem[:legacyGuid].upcase == "FB27C928-54DB-4ECD-B42F-482FC3C8681F" rescue false
|
219
|
+
end
|
220
|
+
|
217
221
|
def registration_status
|
218
222
|
@registration_status ||= nil
|
219
223
|
end
|
220
224
|
alias reg_status registration_status
|
225
|
+
|
226
|
+
def attributes
|
227
|
+
@attributes ||= assetAttributes.sort_by do |attribute|
|
228
|
+
attribute[:attribute][:attributeType]
|
229
|
+
end.map do |attribute|
|
230
|
+
attribute[:attribute][:attributeValue]
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def attribute_paths
|
235
|
+
attributes.map do |attribute|
|
236
|
+
[sub_topic_path, urlize(attribute)].join "/"
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def meta_interests
|
241
|
+
@meta_interests ||= attrs[:assetMetaInterests].sort_by do |interest|
|
242
|
+
interest[:sequence]
|
243
|
+
end.map do |interest|
|
244
|
+
interest[:metaInterest][:metaInterestName]
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def meta_interest_paths
|
249
|
+
meta_interests.map do |meta_interest|
|
250
|
+
[sub_topic_path, urlize(meta_interest)].join "/"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def location_path
|
255
|
+
@location ||= "#{place.cityName} #{place.stateProvinceCode}".downcase.gsub ' ','-'
|
256
|
+
end
|
257
|
+
|
258
|
+
def first_topic
|
259
|
+
get_first_topic_taxonomy[0]
|
260
|
+
end
|
261
|
+
|
262
|
+
def first_topic_path
|
263
|
+
urlize first_topic
|
264
|
+
end
|
265
|
+
|
266
|
+
def sub_topic
|
267
|
+
get_first_topic_taxonomy[1]
|
268
|
+
end
|
269
|
+
|
270
|
+
def sub_topic_path
|
271
|
+
urlize sub_topic
|
272
|
+
end
|
273
|
+
|
274
|
+
def sub_2_topic
|
275
|
+
get_first_topic_taxonomy[2]
|
276
|
+
end
|
277
|
+
|
278
|
+
def sub_2_topic_path
|
279
|
+
urlize "#{sub_topic_path}/#{sub_2_topic}"
|
280
|
+
end
|
281
|
+
|
282
|
+
def image_with_placeholder
|
283
|
+
if image_path.empty?
|
284
|
+
"/images/logo-active-icon-gray.gif"
|
285
|
+
else
|
286
|
+
image_path
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
def image_path
|
291
|
+
default_image = 'http://www.active.com/images/events/hotrace.gif'
|
292
|
+
image = image_without_placeholder.imageUrlAdr rescue ""
|
293
|
+
|
294
|
+
if image.empty? and (logoUrlAdr && logoUrlAdr != default_image && !(logoUrlAdr =~ URI::regexp).nil?)
|
295
|
+
image = logoUrlAdr
|
296
|
+
end
|
297
|
+
|
298
|
+
image
|
299
|
+
end
|
300
|
+
|
301
|
+
def media_url
|
302
|
+
image_without_placeholder.imageUrlAdr rescue ""
|
303
|
+
end
|
304
|
+
|
305
|
+
def image
|
306
|
+
image_without_placeholder
|
307
|
+
end
|
308
|
+
|
309
|
+
private
|
310
|
+
|
311
|
+
def image_without_placeholder
|
312
|
+
default_image = 'http://www.active.com/images/events/hotrace.gif'
|
313
|
+
current_image = nil
|
314
|
+
|
315
|
+
asset_images.each do |i|
|
316
|
+
if i.imageUrlAdr.downcase != default_image
|
317
|
+
current_image = i
|
318
|
+
break
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
current_image
|
323
|
+
end
|
324
|
+
|
325
|
+
def get_first_topic_taxonomy
|
326
|
+
@first_topic_taxonomy ||= assetTopics.sort_by(&:sequence).first
|
327
|
+
if @first_topic_taxonomy
|
328
|
+
@first_topic_taxonomy.topic.topicTaxonomy.split '/'
|
329
|
+
else
|
330
|
+
[]
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
def urlize str
|
335
|
+
if str
|
336
|
+
str.downcase.gsub ' ', '-'
|
337
|
+
else
|
338
|
+
""
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
221
342
|
end
|
222
343
|
end
|
data/lib/actv/client.rb
CHANGED
@@ -7,6 +7,7 @@ require 'actv/error/forbidden'
|
|
7
7
|
require 'actv/error/not_found'
|
8
8
|
require 'actv/event'
|
9
9
|
require 'actv/event_result'
|
10
|
+
require 'actv/asset_stats_result'
|
10
11
|
require 'actv/evergreen'
|
11
12
|
require 'actv/sub_event'
|
12
13
|
require 'actv/search_results'
|
@@ -14,6 +15,7 @@ require 'actv/event_search_results'
|
|
14
15
|
require 'actv/popular_interest_search_results'
|
15
16
|
require 'actv/user'
|
16
17
|
require 'simple_oauth'
|
18
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
17
19
|
|
18
20
|
module ACTV
|
19
21
|
# Wrapper for the ACTV REST API
|
@@ -58,19 +60,24 @@ module ACTV
|
|
58
60
|
# @example Return the asset with the id BA288960-2718-4B20-B380-8F939596B123
|
59
61
|
# ACTV.asset("BA288960-2718-4B20-B380-8F939596B123")
|
60
62
|
def asset(id, params={})
|
61
|
-
|
63
|
+
request_string = "/v2/assets/#{id}"
|
64
|
+
is_preview, params = params_include_preview? params
|
65
|
+
request_string += '/preview' if is_preview
|
62
66
|
|
63
|
-
|
67
|
+
response = get("#{request_string}.json", params)
|
68
|
+
|
69
|
+
if response[:body].is_a? Array
|
64
70
|
results = []
|
65
71
|
response[:body].each do |item|
|
66
72
|
results << ACTV::Asset.from_response({body: item})
|
67
73
|
end
|
74
|
+
|
68
75
|
results
|
69
|
-
else
|
76
|
+
else
|
70
77
|
[ACTV::Asset.from_response(response)]
|
71
|
-
end
|
78
|
+
end
|
72
79
|
end
|
73
|
-
|
80
|
+
|
74
81
|
# Returns an asset with the specified url path
|
75
82
|
#
|
76
83
|
# @authentication_required No
|
@@ -118,8 +125,13 @@ module ACTV
|
|
118
125
|
ACTV::EventSearchResults.from_response(response)
|
119
126
|
end
|
120
127
|
|
121
|
-
def event(id)
|
122
|
-
|
128
|
+
def event(id, params={})
|
129
|
+
request_string = "/v2/assets/#{id}"
|
130
|
+
is_preview, params = params_include_preview? params
|
131
|
+
request_string += '/preview' if is_preview
|
132
|
+
|
133
|
+
response = get("#{request_string}.json", params)
|
134
|
+
|
123
135
|
event = ACTV::Event.from_response(response)
|
124
136
|
event = ACTV::Evergreen.new(event) if event.evergreen?
|
125
137
|
event.is_article? ? nil : event
|
@@ -208,6 +220,11 @@ module ACTV
|
|
208
220
|
end
|
209
221
|
end
|
210
222
|
|
223
|
+
def asset_stats asset_id
|
224
|
+
response = get("/v2/assets/#{asset_id}/stats")
|
225
|
+
ACTV::AssetStatsResult.new response[:body]
|
226
|
+
end
|
227
|
+
|
211
228
|
# Returns the currently logged in user
|
212
229
|
#
|
213
230
|
# @authentication_required Yes
|
@@ -326,5 +343,10 @@ module ACTV
|
|
326
343
|
}
|
327
344
|
end
|
328
345
|
|
346
|
+
def params_include_preview? params
|
347
|
+
params = params.with_indifferent_access
|
348
|
+
return params.delete(:preview) == "true", params
|
349
|
+
end
|
350
|
+
|
329
351
|
end
|
330
352
|
end
|
data/lib/actv/place.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'actv/identity'
|
2
2
|
|
3
3
|
module ACTV
|
4
|
-
class Place <
|
4
|
+
class Place < Base
|
5
5
|
|
6
6
|
attr_reader :placeGuid, :placeName, :placeDsc, :placeUrlAdr, :addressLine1Txt, :addressLine2Txt, :cityName,
|
7
7
|
:stateProvinceCode, :localityName, :postalCode, :countryName, :countryCode, :latitude, :longitude,
|
data/lib/actv/search_results.rb
CHANGED
data/lib/actv/version.rb
CHANGED
data/spec/actv/asset_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
describe ACTV::Asset do
|
4
5
|
|
@@ -166,7 +167,166 @@ describe ACTV::Asset do
|
|
166
167
|
asset = ACTV.asset('valid_event')[0]
|
167
168
|
asset.is_article?.should be_false
|
168
169
|
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "#attribute_paths" do
|
173
|
+
it "returns the attribute values ordered by type" do
|
174
|
+
attributes = [ { attribute: { attributeType: 'thing b', attributeValue: 'Bbb' } },
|
175
|
+
{ attribute: { attributeType: 'thing a', attributeValue: 'Aaa' } } ]
|
176
|
+
asset = ACTV::Asset.new assetGuid: 1, assetAttributes: attributes
|
177
|
+
asset.stub sub_topic: "Topic"
|
178
|
+
asset.attribute_paths.should == [ 'topic/aaa', 'topic/bbb' ]
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
describe "#meta_interest_paths" do
|
183
|
+
it "returns the meta interest names ordered by sequence" do
|
184
|
+
meta_interests = [ { sequence: '2', metaInterest: { metaInterestName: 'Sq2' } },
|
185
|
+
{ sequence: '1', metaInterest: { metaInterestName: 'Sq1' } } ]
|
186
|
+
asset = ACTV::Asset.new assetGuid: 1, assetMetaInterests: meta_interests
|
187
|
+
asset.stub sub_topic: "Topic"
|
188
|
+
asset.meta_interest_paths.should == [ 'topic/sq1', 'topic/sq2' ]
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "#location_path" do
|
193
|
+
it "returns the formatted location" do
|
194
|
+
asset = ACTV::Asset.new assetGuid: 1, place: { cityName: "My City", stateProvinceCode: "AA" }
|
195
|
+
asset.location_path.should == 'my-city-aa'
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
describe "topic path methods" do
|
200
|
+
let(:assetTopics) do
|
201
|
+
[ { sequence: '2', topic: { topicTaxonomy: "Forth/Fifth/Sixth" } },
|
202
|
+
{ sequence: '1', topic: { topicTaxonomy: "First/Second/Third" } } ]
|
203
|
+
end
|
204
|
+
let(:asset) { ACTV::Asset.new assetGuid: 1, assetTopics: assetTopics }
|
205
|
+
|
206
|
+
describe "#first_topic_path" do
|
207
|
+
it "returns the first part of the first asset topic" do
|
208
|
+
asset.first_topic_path.should == 'first'
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe "#sub_topic_path" do
|
213
|
+
it "returns the second part of the first asset topic" do
|
214
|
+
asset.sub_topic_path.should == 'second'
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe "#sub_2_topic_path" do
|
219
|
+
it "returns the third part of the first asset topic" do
|
220
|
+
asset.sub_2_topic_path.should == 'second/third'
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
context "when there is no sub_2_topic" do
|
225
|
+
let(:assetTopics) { [ { sequence: '1', topic: { topicTaxonomy: "first/second" } } ] }
|
226
|
+
describe "#sub_2_topic_path" do
|
227
|
+
it "has a blank sub 2 topic" do
|
228
|
+
asset.sub_2_topic_path.should == "second/"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe 'recommended events' do
|
235
|
+
let(:asset) { ACTV::Asset.new(assetGuid: 1, assetName: "Asset #1", assetImages: [{ imageUrlAdr: "img1.jpg" }, { imageUrlAdr: "img2.jpg" }]) }
|
236
|
+
let(:empty_asset) { ACTV::Asset.new assetGuid: 1 }
|
237
|
+
|
238
|
+
describe "#image_with_placeholder" do
|
239
|
+
context "when image_path is empty" do
|
240
|
+
it "returns the placeholder image path" do
|
241
|
+
asset.stub image_path: ""
|
242
|
+
asset.image_with_placeholder.should == "/images/logo-active-icon-gray.gif"
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
context "when image_path is not empty" do
|
247
|
+
it "returns the image_path" do
|
248
|
+
asset.image_with_placeholder.should == "img1.jpg"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
describe "#image_path" do
|
254
|
+
context "when image_without_placeholder is nil" do
|
255
|
+
it "returns an empty string" do
|
256
|
+
asset.stub(:logoUrlAdr) { "" }
|
257
|
+
asset.stub(:image_without_placeholder) { nil }
|
258
|
+
asset.image_path.should == ""
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context "when image_without_placeholder is an empty string" do
|
263
|
+
it "returns an empty string" do
|
264
|
+
asset.stub(:logoUrlAdr) { "" }
|
265
|
+
asset.stub(:image_without_placeholder) { "" }
|
266
|
+
asset.image_path.should == ""
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
context "when there is a imageUrlAdr" do
|
271
|
+
it "returns the imageUrlAdr" do
|
272
|
+
asset.image_path.should == "img1.jpg"
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
context "when there is no imageUrlAdr" do
|
277
|
+
context "when there is a logoUrlAdr" do
|
278
|
+
it "returns the logoUrlAdr" do
|
279
|
+
empty_asset.stub(:logoUrlAdr) { "http://example.com/logo.jpg" }
|
280
|
+
empty_asset.image_path.should == "http://example.com/logo.jpg"
|
281
|
+
end
|
282
|
+
end
|
169
283
|
|
284
|
+
context "when there is no logoUrlAdr" do
|
285
|
+
it "returns an empty string" do
|
286
|
+
empty_asset.stub(:logoUrlAdr) { "" }
|
287
|
+
empty_asset.image_path.should == ""
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
describe "#media_url" do
|
294
|
+
context "when image_without_placeholder is present" do
|
295
|
+
context "when imageUrlAdr is present" do
|
296
|
+
it "returns the value of imageUrlAdr" do
|
297
|
+
asset.media_url.should == "img1.jpg"
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
context "when imageUrlAdr is not present" do
|
302
|
+
it "returns an empty string" do
|
303
|
+
empty_asset.media_url.should == ""
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
308
|
+
|
309
|
+
context "when image_without_placeholder is nil" do
|
310
|
+
it "returns an empty string" do
|
311
|
+
asset.stub(:image_without_placeholder) { nil }
|
312
|
+
asset.media_url.should == ""
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
describe "#image" do
|
318
|
+
context "the asset has images" do
|
319
|
+
it "returns an AssetImage object" do
|
320
|
+
asset.image.should be_a ACTV::AssetImage
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
context "the asset does not have images" do
|
325
|
+
it "returns nil" do
|
326
|
+
empty_asset.image.should be_nil
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
170
330
|
end
|
171
331
|
|
172
|
-
end
|
332
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ACTV::Client do
|
4
|
+
before do
|
5
|
+
@client = ACTV::Client.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#asset_stats" do
|
9
|
+
context "when we have a guid" do
|
10
|
+
before do
|
11
|
+
stub_get("/v2/assets/286F5731-9800-4C6E-ADD5-0E3B72392CA7/stats").
|
12
|
+
to_return(:status => 200, :body => '{"updatedAt":"2014-02-07 00:50:02","pageViews":1,"assetGuid":"286F5731-9800-4C6E-ADD5-0E3B72392CA7"}', :headers => {})
|
13
|
+
end
|
14
|
+
it "returns stats for an asset" do
|
15
|
+
asset_stats = @client.asset_stats("286F5731-9800-4C6E-ADD5-0E3B72392CA7")
|
16
|
+
asset_stats.page_views.should == 1
|
17
|
+
asset_stats.asset_guid.should == "286F5731-9800-4C6E-ADD5-0E3B72392CA7"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
context "when nil is passed" do
|
21
|
+
before do
|
22
|
+
stub_get("/v2/assets/stats").
|
23
|
+
to_return(:status => 200, :body => '{"error":{"message":"Sorry, that does not exist."}}', :headers => {})
|
24
|
+
end
|
25
|
+
it "returns 0 page views" do
|
26
|
+
asset_stats = @client.asset_stats(nil)
|
27
|
+
asset_stats.page_views.should == 0
|
28
|
+
asset_stats.asset_guid.should be_nil
|
29
|
+
asset_stats.updated_at.should be_nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -21,8 +21,9 @@ describe ACTV::Client do
|
|
21
21
|
|
22
22
|
context "performs a search with no results" do
|
23
23
|
before do
|
24
|
-
|
25
|
-
|
24
|
+
stub_request(:get, "http://api.amp.active.com/api/v1/events/asdf/asdf.json").
|
25
|
+
with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'}).
|
26
|
+
to_return(:status => 200, :body => "", :headers => {})
|
26
27
|
end
|
27
28
|
|
28
29
|
it 'returns nil' do
|
@@ -32,4 +33,4 @@ describe ACTV::Client do
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
end
|
36
|
+
end
|
data/spec/actv/client_spec.rb
CHANGED
@@ -131,6 +131,45 @@ describe ACTV::Client do
|
|
131
131
|
# end
|
132
132
|
end
|
133
133
|
|
134
|
+
describe '#event' do
|
135
|
+
let(:client) { ACTV::Client.new({:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS"}) }
|
136
|
+
|
137
|
+
context 'find event' do
|
138
|
+
before do
|
139
|
+
stub_request(:get, "http://api.amp.active.com/v2/assets/asset_id.json").
|
140
|
+
to_return(body: fixture("valid_asset.json"), headers: { content_type: "application/json; charset=utf-8" })
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'should make a normal asset call' do
|
144
|
+
client.event('asset_id').should be_a ACTV::Event
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'preview event' do
|
149
|
+
context 'when set to true' do
|
150
|
+
before do
|
151
|
+
stub_request(:get, "http://api.amp.active.com/v2/assets/asset_id/preview.json").
|
152
|
+
to_return(body: fixture("valid_asset.json"), headers: { content_type: "application/json; charset=utf-8" })
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'should make preview call' do
|
156
|
+
client.event('asset_id', {preview: 'true'}).should be_a ACTV::Event
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context 'when set to false' do
|
161
|
+
before do
|
162
|
+
stub_request(:get, "http://api.amp.active.com/v2/assets/asset_id.json").
|
163
|
+
to_return(body: fixture("valid_asset.json"), headers: { content_type: "application/json; charset=utf-8" })
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'should make a normal asset call' do
|
167
|
+
client.event('asset_id', {preview: 'false'}).should be_a ACTV::Event
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
134
173
|
ACTV::Configurable::CONFIG_KEYS.each do |key|
|
135
174
|
it "has a default #{key.to_s.gsub('_', ' ')}" do
|
136
175
|
subject.send(key).should eq ACTV::Default.options[key]
|
data/spec/actv/place_spec.rb
CHANGED
@@ -1,25 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ACTV::Place do
|
4
|
-
|
5
|
-
describe "#==" do
|
6
|
-
it "return true when objects IDs are the same" do
|
7
|
-
asset = ACTV::Place.new(placeGuid: 1, placeName: "Place 1")
|
8
|
-
other = ACTV::Place.new(placeGuid: 1, placeName: "Place 2")
|
9
|
-
(asset == other).should be_true
|
10
|
-
end
|
11
|
-
|
12
|
-
it "return false when objects IDs are different" do
|
13
|
-
asset = ACTV::Place.new(placeGuid: 1)
|
14
|
-
other = ACTV::Place.new(placeGuid: 2)
|
15
|
-
(asset == other).should be_false
|
16
|
-
end
|
17
|
-
|
18
|
-
it "return false when classes are different" do
|
19
|
-
asset = ACTV::Place.new(placeGuid: 1)
|
20
|
-
other = ACTV::Identity.new(id: 1)
|
21
|
-
(asset == other).should be_false
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
4
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Barnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,168 +56,168 @@ dependencies:
|
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: maruku
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: timecop
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: webmock
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - '>='
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - '>='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: yard
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - '>='
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - '>='
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: guard-rspec
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - '>='
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - '>='
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: active_support
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - '>='
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - '>='
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
description: A Ruby wrapper for the Active API
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- lib/actv/asset_legacy_data.rb
|
253
253
|
- lib/actv/asset_price.rb
|
254
254
|
- lib/actv/asset_seo_url.rb
|
255
|
+
- lib/actv/asset_stats_result.rb
|
255
256
|
- lib/actv/asset_status.rb
|
256
257
|
- lib/actv/asset_tag.rb
|
257
258
|
- lib/actv/asset_topic.rb
|
@@ -307,6 +308,7 @@ files:
|
|
307
308
|
- spec/actv/asset_status_spec.rb
|
308
309
|
- spec/actv/base_spec.rb
|
309
310
|
- spec/actv/client/articles_spec.rb
|
311
|
+
- spec/actv/client/asset_stats_results_spec.rb
|
310
312
|
- spec/actv/client/assets_spec.rb
|
311
313
|
- spec/actv/client/event_results_spec.rb
|
312
314
|
- spec/actv/client/events_spec.rb
|
@@ -346,17 +348,17 @@ require_paths:
|
|
346
348
|
- lib
|
347
349
|
required_ruby_version: !ruby/object:Gem::Requirement
|
348
350
|
requirements:
|
349
|
-
- -
|
351
|
+
- - '>='
|
350
352
|
- !ruby/object:Gem::Version
|
351
353
|
version: '0'
|
352
354
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
353
355
|
requirements:
|
354
|
-
- -
|
356
|
+
- - '>='
|
355
357
|
- !ruby/object:Gem::Version
|
356
358
|
version: '0'
|
357
359
|
requirements: []
|
358
360
|
rubyforge_project:
|
359
|
-
rubygems_version: 2.
|
361
|
+
rubygems_version: 2.0.5
|
360
362
|
signing_key:
|
361
363
|
specification_version: 4
|
362
364
|
summary: Active API
|
@@ -371,6 +373,7 @@ test_files:
|
|
371
373
|
- spec/actv/asset_status_spec.rb
|
372
374
|
- spec/actv/base_spec.rb
|
373
375
|
- spec/actv/client/articles_spec.rb
|
376
|
+
- spec/actv/client/asset_stats_results_spec.rb
|
374
377
|
- spec/actv/client/assets_spec.rb
|
375
378
|
- spec/actv/client/event_results_spec.rb
|
376
379
|
- spec/actv/client/events_spec.rb
|