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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: baad6f4f9c172d6d5793d213e26d3f6ffc5088c2
4
- data.tar.gz: db3acfb70e93f8dbda52748b597eb389ea05dc8b
3
+ metadata.gz: c5be987786adfd862d0b145397b300844790b88f
4
+ data.tar.gz: dee9639f64ef7abbf3aeba373edb6522c0ebea82
5
5
  SHA512:
6
- metadata.gz: 666a458842f2708b6be73bb81128d10e264f3a2c25f7e120b4b855df2fa59937658a0e35293da6d16cf8371db76bd2362958687dbe8a7c6c9569d2928e9dd4cc
7
- data.tar.gz: ba25786369fd418dd75a924273d0912591556cc9c5a54267f2bfca19d9be13c13bc4037bb24769b03bf71328dae07bb1d64cccd39bfe6e9fc964b5d4d8cf6bad
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
@@ -12,5 +12,13 @@ module ACTV
12
12
  def video?
13
13
  target == "VIDEO" || type == "VIDEO"
14
14
  end
15
+
16
+ def to_str
17
+ imageUrlAdr
18
+ end
19
+
20
+ def to_s
21
+ imageUrlAdr
22
+ end
15
23
  end
16
24
  end
data/lib/actv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ACTV
2
- VERSION = "2.7.0"
2
+ VERSION = "2.8.1"
3
3
  end
@@ -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.7.0
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-01-27 00:00:00.000000000 Z
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.0.14
417
+ rubygems_version: 2.4.5
418
418
  signing_key:
419
419
  specification_version: 4
420
420
  summary: Active API