actv 2.0.0 → 2.1.0
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 +4 -4
- data/lib/actv/asset.rb +13 -1
- data/lib/actv/asset_component.rb +1 -2
- data/lib/actv/asset_image.rb +6 -1
- data/lib/actv/asset_reference.rb +1 -0
- data/lib/actv/client.rb +13 -5
- data/lib/actv/event.rb +4 -2
- data/lib/actv/quiz.rb +15 -0
- data/lib/actv/quiz_outcome.rb +7 -0
- data/lib/actv/quiz_question.rb +11 -0
- data/lib/actv/quiz_question_answer.rb +12 -0
- data/lib/actv/search_results.rb +2 -2
- data/lib/actv/{article_validator.rb → validators/article_validator.rb} +1 -1
- data/lib/actv/{asset_validator.rb → validators/asset_validator.rb} +0 -0
- data/lib/actv/{author_validator.rb → validators/author_validator.rb} +1 -1
- data/lib/actv/{event_validator.rb → validators/event_validator.rb} +1 -1
- data/lib/actv/validators/quiz_outcome_validator.rb +8 -0
- data/lib/actv/validators/quiz_question_answer_validator.rb +8 -0
- data/lib/actv/validators/quiz_question_validator.rb +8 -0
- data/lib/actv/validators/quiz_validator.rb +8 -0
- data/lib/actv/version.rb +1 -1
- data/spec/actv/asset_component_spec.rb +0 -1
- data/spec/actv/asset_image_spec.rb +35 -10
- data/spec/actv/event_spec.rb +48 -0
- data/spec/actv/quiz_outcome_validator_spec.rb +17 -0
- data/spec/actv/quiz_question_answer_spec.rb +23 -0
- data/spec/actv/quiz_question_answer_validator_spec.rb +17 -0
- data/spec/actv/quiz_question_spec.rb +31 -0
- data/spec/actv/quiz_question_validator_spec.rb +17 -0
- data/spec/actv/quiz_spec.rb +51 -0
- data/spec/actv/quiz_validator_spec.rb +17 -0
- data/spec/fixtures/valid_search.json +6 -4
- metadata +29 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74f4019e9851376560c716f077954fc8fbc510ac
|
4
|
+
data.tar.gz: 82f503746ebbcf48a35a91dc396e5f6d7c2b77e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d42f3db108dc0a42501e1ce17f083311271f16b1ba2c7771064a21baeb5849d76b1d50b3e30eaf518df506c675d9f697ce1613f9a13dac0a61077f62212fb374
|
7
|
+
data.tar.gz: 61604d4171beddaaa212ed2b61c50e78cd8b6702c5adf5e8830d3569ac87420cfde3b8681af6c8b61ffef49685c693118772ffe3e7208467675ff0df4fbbcf32
|
data/lib/actv/asset.rb
CHANGED
@@ -373,8 +373,21 @@ module ACTV
|
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
376
|
+
def category_is? name
|
377
|
+
@attrs[:assetCategories].any? do |cat|
|
378
|
+
cat[:category][:categoryName].downcase == name.downcase
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
376
382
|
private
|
377
383
|
|
384
|
+
def child_assets_filtered_by_category category
|
385
|
+
if components.any?
|
386
|
+
children = ACTV.asset components.map(&:assetGuid)
|
387
|
+
children.select { |child| child.category_is? category }
|
388
|
+
end || []
|
389
|
+
end
|
390
|
+
|
378
391
|
def image_without_placeholder
|
379
392
|
default_image = 'http://www.active.com/images/events/hotrace.gif'
|
380
393
|
current_image = nil
|
@@ -414,6 +427,5 @@ module ACTV
|
|
414
427
|
def kids_friendly_source_system?
|
415
428
|
activenet? || awcamps30? || acm? || researched?
|
416
429
|
end
|
417
|
-
|
418
430
|
end
|
419
431
|
end
|
data/lib/actv/asset_component.rb
CHANGED
data/lib/actv/asset_image.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
module ACTV
|
2
2
|
class AssetImage < Base
|
3
|
-
attr_reader :imageUrlAdr, :imageName, :imageCaptionTxt, :linkUrl, :linkTarget
|
3
|
+
attr_reader :imageUrlAdr, :imageName, :imageType, :imageCaptionTxt, :linkUrl, :linkTarget
|
4
4
|
|
5
5
|
alias url imageUrlAdr
|
6
6
|
alias name imageName
|
7
|
+
alias type imageType
|
7
8
|
alias caption imageCaptionTxt
|
8
9
|
alias link linkUrl
|
9
10
|
alias target linkTarget
|
11
|
+
|
12
|
+
def video?
|
13
|
+
target == "VIDEO" || type == "VIDEO"
|
14
|
+
end
|
10
15
|
end
|
11
16
|
end
|
data/lib/actv/asset_reference.rb
CHANGED
data/lib/actv/client.rb
CHANGED
@@ -1,18 +1,15 @@
|
|
1
1
|
require 'faraday'
|
2
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
2
3
|
require 'actv/article'
|
3
4
|
require 'actv/article_search_results'
|
4
|
-
require 'actv/article_validator'
|
5
|
-
require 'actv/asset_validator'
|
6
5
|
require 'actv/asset'
|
7
6
|
require 'actv/asset_factory'
|
8
7
|
require 'actv/author'
|
9
|
-
require 'actv/author_validator'
|
10
8
|
require 'actv/configurable'
|
11
9
|
require 'actv/error/forbidden'
|
12
10
|
require 'actv/error/not_found'
|
13
11
|
require 'actv/event'
|
14
12
|
require 'actv/event_result'
|
15
|
-
require 'actv/event_validator'
|
16
13
|
require 'actv/asset_stats_result'
|
17
14
|
require 'actv/evergreen'
|
18
15
|
require 'actv/sub_event'
|
@@ -22,8 +19,19 @@ require 'actv/popular_interest_search_results'
|
|
22
19
|
require 'actv/user'
|
23
20
|
require 'actv/organizer'
|
24
21
|
require 'actv/organizer_results'
|
22
|
+
require 'actv/quiz'
|
23
|
+
require 'actv/quiz_outcome'
|
24
|
+
require 'actv/quiz_question'
|
25
|
+
require 'actv/quiz_question_answer'
|
26
|
+
require 'actv/validators/article_validator'
|
27
|
+
require 'actv/validators/asset_validator'
|
28
|
+
require 'actv/validators/author_validator'
|
29
|
+
require 'actv/validators/event_validator'
|
30
|
+
require 'actv/validators/quiz_validator'
|
31
|
+
require 'actv/validators/quiz_outcome_validator'
|
32
|
+
require 'actv/validators/quiz_question_validator'
|
33
|
+
require 'actv/validators/quiz_question_answer_validator'
|
25
34
|
require 'simple_oauth'
|
26
|
-
require 'active_support/core_ext/hash/indifferent_access'
|
27
35
|
|
28
36
|
module ACTV
|
29
37
|
# Wrapper for the ACTV REST API
|
data/lib/actv/event.rb
CHANGED
@@ -147,6 +147,10 @@ module ACTV
|
|
147
147
|
true
|
148
148
|
end
|
149
149
|
|
150
|
+
def video
|
151
|
+
self.images.detect { |i| i.video? }
|
152
|
+
end
|
153
|
+
|
150
154
|
alias online_registration? online_registration_available?
|
151
155
|
alias reg_open? registration_open?
|
152
156
|
alias reg_closed? registration_closed?
|
@@ -212,5 +216,3 @@ module ACTV
|
|
212
216
|
end
|
213
217
|
end
|
214
218
|
end
|
215
|
-
|
216
|
-
|
data/lib/actv/quiz.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module ACTV
|
2
|
+
class Quiz < Asset
|
3
|
+
def self.valid? response
|
4
|
+
ACTV::QuizValidator.new(response).valid?
|
5
|
+
end
|
6
|
+
|
7
|
+
def questions
|
8
|
+
@questions ||= child_assets_filtered_by_category 'question'
|
9
|
+
end
|
10
|
+
|
11
|
+
def outcomes
|
12
|
+
@outcomes ||= child_assets_filtered_by_category 'outcome'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ACTV
|
2
|
+
class QuizQuestionAnswer < Asset
|
3
|
+
def self.valid? response
|
4
|
+
ACTV::QuizQuestionAnswerValidator.new(response).valid?
|
5
|
+
end
|
6
|
+
|
7
|
+
def outcome
|
8
|
+
reference = references.find { |ref| ref.type.downcase == 'outcome' }
|
9
|
+
@outcome ||= ACTV.asset(reference.id).first if reference
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/actv/search_results.rb
CHANGED
@@ -7,10 +7,10 @@ module ACTV
|
|
7
7
|
class SearchResults < ACTV::Base
|
8
8
|
attr_reader :items_per_page, :start_index, :total_results, :original_query, :actual_query
|
9
9
|
|
10
|
-
# @return [Array<ACTV::Asset>]
|
11
10
|
def results
|
12
11
|
@results ||= Array(@attrs[:results]).map do |asset|
|
13
|
-
|
12
|
+
response = { body: asset }
|
13
|
+
ACTV::Asset.from_response response
|
14
14
|
end
|
15
15
|
end
|
16
16
|
alias to_a results
|
File without changes
|
data/lib/actv/version.rb
CHANGED
@@ -8,7 +8,6 @@ describe ACTV::AssetComponent do
|
|
8
8
|
describe "#prices" do
|
9
9
|
before(:each) do
|
10
10
|
stub_request(:post, "http://api.amp.active.com/v2/assets.json").
|
11
|
-
with(:body => {"id"=>""}, :headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Active Ruby Gem 1.4.4'}).
|
12
11
|
to_return(body: fixture("valid_component_asset.json"), headers: { content_type: "application/json; charset=utf-8" })
|
13
12
|
end
|
14
13
|
|
@@ -1,27 +1,52 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ACTV::AssetImage do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
let(:imageType) { 'IMAGE' }
|
5
|
+
let(:linkTarget) { '_blank' }
|
6
|
+
subject(:img) { ACTV::AssetImage.new({
|
7
|
+
imageUrlAdr: 'http://test.com/1.jpg',
|
8
|
+
imageName: 'image1',
|
9
|
+
imageType: imageType,
|
10
|
+
imageCaptionTxt: 'caption1',
|
11
|
+
linkUrl: 'http://test.com/',
|
12
|
+
linkTarget: linkTarget
|
13
|
+
}) }
|
10
14
|
|
11
15
|
describe "attribute accessors and aliases" do
|
12
|
-
subject { @img }
|
13
|
-
|
14
16
|
its(:url){ should eq 'http://test.com/1.jpg' }
|
15
17
|
its(:name){ should eq 'image1' }
|
18
|
+
its(:type){ should eq 'IMAGE' }
|
16
19
|
its(:caption){ should eq 'caption1' }
|
17
20
|
its(:link){ should eq 'http://test.com/'}
|
18
21
|
its(:target){ should eq '_blank' }
|
19
|
-
|
20
22
|
its(:imageUrlAdr){ should eq 'http://test.com/1.jpg' }
|
21
23
|
its(:imageName){ should eq 'image1' }
|
24
|
+
its(:imageType){ should eq 'IMAGE' }
|
22
25
|
its(:imageCaptionTxt){ should eq 'caption1' }
|
23
26
|
its(:linkUrl){ should eq 'http://test.com/'}
|
24
27
|
its(:linkTarget){ should eq '_blank' }
|
25
28
|
end
|
26
29
|
|
27
|
-
|
30
|
+
describe "#video?" do
|
31
|
+
context "when neither imageType nor linkTarget are video" do
|
32
|
+
it "knows it's not a video AssetImage" do
|
33
|
+
expect(subject.video?).to be_false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when imageType is video" do
|
38
|
+
let(:imageType) { 'VIDEO' }
|
39
|
+
it "knows it's a video AssetImage" do
|
40
|
+
expect(subject.video?).to be_true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when linkTarget is video" do
|
45
|
+
let(:linkTarget) { 'VIDEO' }
|
46
|
+
it "knows it's a video AssetImage" do
|
47
|
+
expect(subject.video?).to be_true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
data/spec/actv/event_spec.rb
CHANGED
@@ -336,4 +336,52 @@ describe ACTV::Event do
|
|
336
336
|
end
|
337
337
|
end
|
338
338
|
end
|
339
|
+
|
340
|
+
describe '#video' do
|
341
|
+
context 'when the event has a video AssetImage' do
|
342
|
+
|
343
|
+
let(:image1) { ACTV::AssetImage.new({
|
344
|
+
imageUrlAdr: 'http://test.com/1.jpg',
|
345
|
+
imageName: 'image1',
|
346
|
+
imageType: 'VIDEO',
|
347
|
+
imageCaptionTxt: 'caption1',
|
348
|
+
linkUrl: 'http://test.com/',
|
349
|
+
linkTarget: 'VIDEO'
|
350
|
+
}) }
|
351
|
+
|
352
|
+
before do
|
353
|
+
allow(subject).to receive(:images).and_return([image1])
|
354
|
+
end
|
355
|
+
|
356
|
+
it 'returns the video AssetImage' do
|
357
|
+
subject.video.should eq image1
|
358
|
+
end
|
359
|
+
|
360
|
+
context 'when the event has more than one video AssetImage' do
|
361
|
+
|
362
|
+
let(:image2) { ACTV::AssetImage.new({
|
363
|
+
imageUrlAdr: 'http://test.com/2.jpg',
|
364
|
+
imageName: 'image2',
|
365
|
+
imageType: 'VIDEO',
|
366
|
+
imageCaptionTxt: 'caption2',
|
367
|
+
linkUrl: 'http://test.com/',
|
368
|
+
linkTarget: 'VIDEO'
|
369
|
+
}) }
|
370
|
+
|
371
|
+
before do
|
372
|
+
allow(subject).to receive(:images).and_return([image1, image2])
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'returns the first video AssetImage' do
|
376
|
+
subject.video.should eq image1
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
context 'when the event has no video AssetImage' do
|
382
|
+
it 'returns nil' do
|
383
|
+
subject.video.should be_nil
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
339
387
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ACTV::QuizOutcomeValidator do
|
4
|
+
let(:asset_categories) { [] }
|
5
|
+
let(:response) { { assetGuid: 1, assetCategories: asset_categories } }
|
6
|
+
subject(:validator) { ACTV::QuizOutcomeValidator.new(response).valid? }
|
7
|
+
|
8
|
+
describe '#valid?' do
|
9
|
+
context 'when the response is valid' do
|
10
|
+
let(:asset_categories) { [ { category: { categoryName: "Outcome", categoryTaxonomy: "Creative Work:Quiz:Outcome" } } ] }
|
11
|
+
it { should be_true }
|
12
|
+
end
|
13
|
+
context 'when the response is not valid' do
|
14
|
+
it { should be_false }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe ACTV::QuizQuestionAnswer do
|
3
|
+
let(:asset_categories) { [ { category: { categoryName: "Answer", categoryTaxonomy: "Creative Work:Quiz:Question:Answer" } } ] }
|
4
|
+
let(:response) { { body: { assetGuid: 1, assetCategories: asset_categories } } }
|
5
|
+
subject(:answer) { ACTV::Asset.from_response response }
|
6
|
+
|
7
|
+
describe '#outcome' do
|
8
|
+
subject(:outcome) { answer.outcome }
|
9
|
+
context 'when there is an outcome' do
|
10
|
+
it 'returns an outcome asset' do
|
11
|
+
outcome_asset = double :outcome, id: 1
|
12
|
+
references = [double(type:'outcome', id: 1),
|
13
|
+
double(type:'not_outcome', id: 2)]
|
14
|
+
allow(answer).to receive(:references) { references }
|
15
|
+
allow(ACTV).to receive(:asset).with(outcome_asset.id) { [outcome_asset] }
|
16
|
+
expect(outcome.id).to eq outcome_asset.id
|
17
|
+
end
|
18
|
+
end
|
19
|
+
context 'when there is not an outcome' do
|
20
|
+
it { should be_nil }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ACTV::QuizQuestionAnswerValidator do
|
4
|
+
let(:asset_categories) { [] }
|
5
|
+
let(:response) { { assetGuid: 1, assetCategories: asset_categories } }
|
6
|
+
subject(:validator) { ACTV::QuizQuestionAnswerValidator.new(response).valid? }
|
7
|
+
|
8
|
+
describe '#valid?' do
|
9
|
+
context 'when the response is valid' do
|
10
|
+
let(:asset_categories) { [ { category: { categoryName: "Answer", categoryTaxonomy: "Creative Work:Quiz:Question:Answer" } } ] }
|
11
|
+
it { should be_true }
|
12
|
+
end
|
13
|
+
context 'when the response is not valid' do
|
14
|
+
it { should be_false }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe ACTV::QuizQuestion do
|
4
|
+
let(:asset_categories) { [ { category: { categoryName: "Question", categoryTaxonomy: "Creative Work:Quiz:Question" } } ] }
|
5
|
+
let(:response) { { body: { assetGuid: 1, assetCategories: asset_categories } } }
|
6
|
+
subject(:question) { ACTV::Asset.from_response response }
|
7
|
+
|
8
|
+
describe '#answers' do
|
9
|
+
subject(:answers) { question.answers }
|
10
|
+
context 'when there are answer assets' do
|
11
|
+
it 'returns an array of quiz answers' do
|
12
|
+
answer = double(:answer, assetGuid: 123)
|
13
|
+
allow(answer).to receive(:category_is?).with('answer') { true }
|
14
|
+
not_answer = double(:not_answer, assetGuid: 234)
|
15
|
+
allow(not_answer).to receive(:category_is?).with('answer') { false }
|
16
|
+
components = [answer, not_answer]
|
17
|
+
allow(question).to receive(:components) { components }
|
18
|
+
allow(ACTV).to receive(:asset) { components }
|
19
|
+
|
20
|
+
expect(answers).to eq [answer]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when there are not answer assets' do
|
25
|
+
it 'should be empty' do
|
26
|
+
allow(question).to receive(:components) { [] }
|
27
|
+
expect(answers).to eq []
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ACTV::QuizQuestionValidator do
|
4
|
+
let(:asset_categories) { [] }
|
5
|
+
let(:response) { { assetGuid: 1, assetCategories: asset_categories } }
|
6
|
+
subject(:validator) { ACTV::QuizQuestionValidator.new(response).valid? }
|
7
|
+
|
8
|
+
describe '#valid?' do
|
9
|
+
context 'when the response is valid' do
|
10
|
+
let(:asset_categories) { [ { category: { categoryName: "Question", categoryTaxonomy: "Creative Work:Quiz:Question" } } ] }
|
11
|
+
it { should be_true }
|
12
|
+
end
|
13
|
+
context 'when the response is not valid' do
|
14
|
+
it { should be_false }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe ACTV::Quiz do
|
4
|
+
let(:asset_categories) { [ { category: { categoryName: "Quiz", categoryTaxonomy: "Creative Work:Quiz" } } ] }
|
5
|
+
let(:response) { { body: { assetGuid: 1, assetCategories: asset_categories } } }
|
6
|
+
subject(:quiz) { ACTV::Asset.from_response response }
|
7
|
+
|
8
|
+
describe '#questions' do
|
9
|
+
subject(:questions) { quiz.questions }
|
10
|
+
|
11
|
+
context 'when there are question assets' do
|
12
|
+
it 'returns an array of quiz questions' do
|
13
|
+
question = double(:question, assetGuid: 123)
|
14
|
+
allow(question).to receive(:category_is?).with('question') { true }
|
15
|
+
not_question = double(:not_question, assetGuid: 234)
|
16
|
+
allow(not_question).to receive(:category_is?).with('question') { false }
|
17
|
+
components = [question, not_question]
|
18
|
+
allow(quiz).to receive(:components) { components }
|
19
|
+
allow(ACTV).to receive(:asset) { components }
|
20
|
+
|
21
|
+
expect(questions).to eq [question]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when there are not question assets' do
|
26
|
+
it { should be_empty }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#outcomes' do
|
31
|
+
subject(:outcomes) { quiz.outcomes }
|
32
|
+
|
33
|
+
context 'when there are outcome assets' do
|
34
|
+
it 'returns an array of quiz outcomes' do
|
35
|
+
outcome = double(:outcome, assetGuid: 123)
|
36
|
+
allow(outcome).to receive(:category_is?).with('outcome') { true }
|
37
|
+
not_outcome = double(:not_outcome, assetGuid: 234)
|
38
|
+
allow(not_outcome).to receive(:category_is?).with('outcome') { false }
|
39
|
+
components = [outcome, not_outcome]
|
40
|
+
allow(quiz).to receive(:components) { components }
|
41
|
+
allow(ACTV).to receive(:asset) { components }
|
42
|
+
|
43
|
+
expect(outcomes).to eq [outcome]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when there are no outcome assets' do
|
48
|
+
it { should be_empty }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ACTV::QuizValidator do
|
4
|
+
let(:asset_categories) { [] }
|
5
|
+
let(:response) { { assetGuid: 1, assetCategories: asset_categories } }
|
6
|
+
subject(:validator) { ACTV::QuizValidator.new(response).valid? }
|
7
|
+
|
8
|
+
describe '#valid?' do
|
9
|
+
context 'when the response is valid' do
|
10
|
+
let(:asset_categories) { [ { category: { categoryName: "Quiz", categoryTaxonomy: "Creative Work:Quiz" } } ] }
|
11
|
+
it { should be_true }
|
12
|
+
end
|
13
|
+
context 'when the response is not valid' do
|
14
|
+
it { should be_false }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -186,7 +186,8 @@
|
|
186
186
|
"sequence": "2",
|
187
187
|
"category": {
|
188
188
|
"categoryId": "28",
|
189
|
-
"categoryName": "Experts"
|
189
|
+
"categoryName": "Experts",
|
190
|
+
"categoryTaxonomy": "Person/Experts"
|
190
191
|
}
|
191
192
|
}
|
192
193
|
],
|
@@ -411,7 +412,7 @@
|
|
411
412
|
}
|
412
413
|
}
|
413
414
|
],
|
414
|
-
"assetCategories":
|
415
|
+
"assetCategories": [ ],
|
415
416
|
"assetMetaInterests": "",
|
416
417
|
"assetComponents": [ ],
|
417
418
|
"assetServiceHostName": "asset-01"
|
@@ -1207,7 +1208,8 @@
|
|
1207
1208
|
"sequence": "2",
|
1208
1209
|
"category": {
|
1209
1210
|
"categoryId": "22",
|
1210
|
-
"categoryName": "Races"
|
1211
|
+
"categoryName": "Races",
|
1212
|
+
"categoryTaxonomy": "Event/Races"
|
1211
1213
|
}
|
1212
1214
|
}
|
1213
1215
|
],
|
@@ -1279,4 +1281,4 @@
|
|
1279
1281
|
"start_index": 0,
|
1280
1282
|
"total_results": 211
|
1281
1283
|
|
1282
|
-
}
|
1284
|
+
}
|
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: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Barnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -255,7 +255,6 @@ files:
|
|
255
255
|
- lib/actv/address.rb
|
256
256
|
- lib/actv/article.rb
|
257
257
|
- lib/actv/article_search_results.rb
|
258
|
-
- lib/actv/article_validator.rb
|
259
258
|
- lib/actv/asset.rb
|
260
259
|
- lib/actv/asset_channel.rb
|
261
260
|
- lib/actv/asset_component.rb
|
@@ -271,9 +270,7 @@ files:
|
|
271
270
|
- lib/actv/asset_status.rb
|
272
271
|
- lib/actv/asset_tag.rb
|
273
272
|
- lib/actv/asset_topic.rb
|
274
|
-
- lib/actv/asset_validator.rb
|
275
273
|
- lib/actv/author.rb
|
276
|
-
- lib/actv/author_validator.rb
|
277
274
|
- lib/actv/base.rb
|
278
275
|
- lib/actv/channel.rb
|
279
276
|
- lib/actv/client.rb
|
@@ -294,7 +291,6 @@ files:
|
|
294
291
|
- lib/actv/event.rb
|
295
292
|
- lib/actv/event_result.rb
|
296
293
|
- lib/actv/event_search_results.rb
|
297
|
-
- lib/actv/event_validator.rb
|
298
294
|
- lib/actv/evergreen.rb
|
299
295
|
- lib/actv/facet.rb
|
300
296
|
- lib/actv/facet_term.rb
|
@@ -308,6 +304,10 @@ files:
|
|
308
304
|
- lib/actv/place.rb
|
309
305
|
- lib/actv/popular_interest.rb
|
310
306
|
- lib/actv/popular_interest_search_results.rb
|
307
|
+
- lib/actv/quiz.rb
|
308
|
+
- lib/actv/quiz_outcome.rb
|
309
|
+
- lib/actv/quiz_question.rb
|
310
|
+
- lib/actv/quiz_question_answer.rb
|
311
311
|
- lib/actv/recurrence.rb
|
312
312
|
- lib/actv/request/multipart_with_file.rb
|
313
313
|
- lib/actv/response/parse_json.rb
|
@@ -319,6 +319,14 @@ files:
|
|
319
319
|
- lib/actv/tag.rb
|
320
320
|
- lib/actv/topic.rb
|
321
321
|
- lib/actv/user.rb
|
322
|
+
- lib/actv/validators/article_validator.rb
|
323
|
+
- lib/actv/validators/asset_validator.rb
|
324
|
+
- lib/actv/validators/author_validator.rb
|
325
|
+
- lib/actv/validators/event_validator.rb
|
326
|
+
- lib/actv/validators/quiz_outcome_validator.rb
|
327
|
+
- lib/actv/validators/quiz_question_answer_validator.rb
|
328
|
+
- lib/actv/validators/quiz_question_validator.rb
|
329
|
+
- lib/actv/validators/quiz_validator.rb
|
322
330
|
- lib/actv/version.rb
|
323
331
|
- spec/actv/article_search_results_spec.rb
|
324
332
|
- spec/actv/article_spec.rb
|
@@ -353,6 +361,13 @@ files:
|
|
353
361
|
- spec/actv/identifiable_spec.rb
|
354
362
|
- spec/actv/null_object_spec.rb
|
355
363
|
- spec/actv/place_spec.rb
|
364
|
+
- spec/actv/quiz_outcome_validator_spec.rb
|
365
|
+
- spec/actv/quiz_question_answer_spec.rb
|
366
|
+
- spec/actv/quiz_question_answer_validator_spec.rb
|
367
|
+
- spec/actv/quiz_question_spec.rb
|
368
|
+
- spec/actv/quiz_question_validator_spec.rb
|
369
|
+
- spec/actv/quiz_spec.rb
|
370
|
+
- spec/actv/quiz_validator_spec.rb
|
356
371
|
- spec/actv/search_results_spec.rb
|
357
372
|
- spec/actv/user_spec.rb
|
358
373
|
- spec/actv_spec.rb
|
@@ -397,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
397
412
|
version: '0'
|
398
413
|
requirements: []
|
399
414
|
rubyforge_project:
|
400
|
-
rubygems_version: 2.
|
415
|
+
rubygems_version: 2.1.11
|
401
416
|
signing_key:
|
402
417
|
specification_version: 4
|
403
418
|
summary: Active API
|
@@ -435,6 +450,13 @@ test_files:
|
|
435
450
|
- spec/actv/identifiable_spec.rb
|
436
451
|
- spec/actv/null_object_spec.rb
|
437
452
|
- spec/actv/place_spec.rb
|
453
|
+
- spec/actv/quiz_outcome_validator_spec.rb
|
454
|
+
- spec/actv/quiz_question_answer_spec.rb
|
455
|
+
- spec/actv/quiz_question_answer_validator_spec.rb
|
456
|
+
- spec/actv/quiz_question_spec.rb
|
457
|
+
- spec/actv/quiz_question_validator_spec.rb
|
458
|
+
- spec/actv/quiz_spec.rb
|
459
|
+
- spec/actv/quiz_validator_spec.rb
|
438
460
|
- spec/actv/search_results_spec.rb
|
439
461
|
- spec/actv/user_spec.rb
|
440
462
|
- spec/actv_spec.rb
|