actv 2.7.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/actv/article.rb +11 -0
- data/lib/actv/asset_image.rb +8 -0
- data/lib/actv/version.rb +1 -1
- data/spec/actv/article_spec.rb +27 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5be987786adfd862d0b145397b300844790b88f
|
4
|
+
data.tar.gz: dee9639f64ef7abbf3aeba373edb6522c0ebea82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9815563da8c30eb6108048ce92397505e0502f3962162e57ea31efd27282fc258243e6992bc86eb805faf4848f5056bf38a7a033f17de1042a7fb39138baa576
|
7
|
+
data.tar.gz: 0729627b24f583c0c441dd9a44f71455b03af37af0a17d6123d9f3f5e25e4f247debfaea6630442b7ca0c4e2d9d4bf294ab60b808a24c68f45beb6eb195fab57
|
data/lib/actv/article.rb
CHANGED
@@ -28,6 +28,10 @@ module ACTV
|
|
28
28
|
@image ||= image_by_name 'image2'
|
29
29
|
end
|
30
30
|
|
31
|
+
def thumbnail
|
32
|
+
@thumbnail ||= image_by_name 'small'
|
33
|
+
end
|
34
|
+
|
31
35
|
def subtitle
|
32
36
|
@subtitle ||= description_by_type 'subtitle'
|
33
37
|
end
|
@@ -45,6 +49,13 @@ module ACTV
|
|
45
49
|
true
|
46
50
|
end
|
47
51
|
|
52
|
+
def reference_articles
|
53
|
+
article_references = references.select { |ref| ref.type.downcase == 'reference-article' }
|
54
|
+
if article_references.present?
|
55
|
+
@reference_articles ||= ACTV.asset(article_references.map(&:id))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
48
59
|
private
|
49
60
|
|
50
61
|
def resolve_inline_ad_tag
|
data/lib/actv/asset_image.rb
CHANGED
data/lib/actv/version.rb
CHANGED
data/spec/actv/article_spec.rb
CHANGED
@@ -76,6 +76,21 @@ describe ACTV::Article do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
describe '#thumbnail' do
|
80
|
+
context 'when article has an image named small' do
|
81
|
+
let(:asset_images) { [ { imageName: "small" } ] }
|
82
|
+
it 'returns the image' do
|
83
|
+
expect(article.thumbnail).to be_a ACTV::AssetImage
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'when article does not have an image named small' do
|
88
|
+
it 'returns nil' do
|
89
|
+
expect(article.thumbnail).to be_nil
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
79
94
|
describe '#subtitle' do
|
80
95
|
context 'when a subtitle description exists' do
|
81
96
|
its(:subtitle) { should eq "article subtitle" }
|
@@ -151,4 +166,16 @@ describe ACTV::Article do
|
|
151
166
|
its(:author_name_from_by_line) { should be_nil }
|
152
167
|
end
|
153
168
|
end
|
169
|
+
|
170
|
+
describe '#reference_articles' do
|
171
|
+
let(:asset_references) { [ { referenceAsset: { assetGuid: "123" },
|
172
|
+
referenceType: { referenceTypeName: "reference-article" } } ] }
|
173
|
+
let(:article_asset) { double :article, id: "123" }
|
174
|
+
before { allow(ACTV).to receive(:asset) { [article_asset] } }
|
175
|
+
|
176
|
+
it 'returns reference articles if exist' do
|
177
|
+
expect(article.reference_articles.first.id).to eq article_asset.id
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
154
181
|
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: 2.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Barnes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -414,7 +414,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
414
414
|
version: '0'
|
415
415
|
requirements: []
|
416
416
|
rubyforge_project:
|
417
|
-
rubygems_version: 2.
|
417
|
+
rubygems_version: 2.4.5
|
418
418
|
signing_key:
|
419
419
|
specification_version: 4
|
420
420
|
summary: Active API
|