yt 0.25.30 → 0.25.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/yt/collections/claims.rb +1 -6
- data/lib/yt/collections/videos.rb +2 -2
- data/lib/yt/models/video.rb +7 -4
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/content_owner_spec.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5112275b960c0a74c635c08e48280553d397766
|
4
|
+
data.tar.gz: eaa061ab2f0bb09c39cc7d0d6b898ac0f009773b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53d8901fd8f0359de6c065ee43a89ca54b66466db6db76d8ed22a9d8d4fe98f9d78d4ddcbbf9f34b6ea5365ccfd883e1558700777214d054589726bf93cf800d
|
7
|
+
data.tar.gz: 3503b64bc60c66ff51ce7998cc3b83785529edee66cc63882a6930833ac100a8bf785b3fcb5c16313f86b5a84debe6a8e3b2e702c469e9d6a6f5f57491acf7f3
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 0.25.31 - 2016-04-11
|
10
|
+
|
11
|
+
* [BUGFIX] Don’t try to instantiate video.claim if a video does not have a claim.
|
12
|
+
|
9
13
|
## 0.25.30 - 2016-04-07
|
10
14
|
|
11
15
|
* [FEATURE] Add ability for videos to eager load claims. For example, `$content_owner.videos.includes(:claim).first.claim.id`.
|
@@ -37,12 +37,7 @@ module Yt
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def claims_params
|
40
|
-
|
41
|
-
owner_name = @parent.owner_name
|
42
|
-
else
|
43
|
-
owner_name = @auth.owner_name
|
44
|
-
end
|
45
|
-
apply_where_params! on_behalf_of_content_owner: owner_name
|
40
|
+
apply_where_params! on_behalf_of_content_owner: @parent.owner_name
|
46
41
|
end
|
47
42
|
|
48
43
|
# @private
|
@@ -26,8 +26,8 @@ module Yt
|
|
26
26
|
attributes[:content_details] = data['contentDetails']
|
27
27
|
attributes[:statistics] = data['statistics']
|
28
28
|
attributes[:video_category] = data['videoCategory']
|
29
|
-
attributes[:auth] = @auth
|
30
29
|
attributes[:claim] = data['claim']
|
30
|
+
attributes[:auth] = @auth
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -57,7 +57,7 @@ module Yt
|
|
57
57
|
if include_claim
|
58
58
|
video_ids = items.map{|item| item['id']['videoId']}.uniq
|
59
59
|
conditions = { video_id: video_ids.join(',') }
|
60
|
-
claims =
|
60
|
+
claims = @parent.claims.where conditions
|
61
61
|
items.each do |item|
|
62
62
|
claim = claims.find { |c| c.video_id == item['id']['videoId']}
|
63
63
|
item['claim'] = claim
|
data/lib/yt/models/video.rb
CHANGED
@@ -379,6 +379,13 @@ module Yt
|
|
379
379
|
|
380
380
|
has_many :resumable_sessions
|
381
381
|
|
382
|
+
# @!attribute [r] channel
|
383
|
+
# @return [Yt::Models::Claim, nil] the first claim on the video by
|
384
|
+
# the content owner of the video, if eagerly loaded.
|
385
|
+
def claim
|
386
|
+
@claim
|
387
|
+
end
|
388
|
+
|
382
389
|
### ANALYTICS ###
|
383
390
|
|
384
391
|
# @macro reports
|
@@ -554,10 +561,6 @@ module Yt
|
|
554
561
|
super
|
555
562
|
end
|
556
563
|
|
557
|
-
### Claim ###
|
558
|
-
|
559
|
-
has_one :claim
|
560
|
-
|
561
564
|
### PRIVATE API ###
|
562
565
|
|
563
566
|
# @private
|
data/lib/yt/version.rb
CHANGED
@@ -51,12 +51,13 @@ describe Yt::ContentOwner, :partner do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
describe '.includes(:claim)' do
|
54
|
-
let(:
|
54
|
+
let(:videos) { $content_owner.videos.includes(:claim) }
|
55
|
+
let(:video_with_claim) { videos.find{|v| v.claim.present?} }
|
55
56
|
|
56
57
|
specify 'eager-loads the claim of each video' do
|
57
|
-
expect(
|
58
|
-
expect(
|
59
|
-
expect(
|
58
|
+
expect(video_with_claim.claim).to be_a Yt::Claim
|
59
|
+
expect(video_with_claim.claim.id).to be_a String
|
60
|
+
expect(video_with_claim.claim.video_id).to eq video_with_claim.id
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.25.
|
4
|
+
version: 0.25.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|