yt 0.25.30 → 0.25.31

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28a685b003b607412601a4b2c4cc2858bcc9a83d
4
- data.tar.gz: 15134a642f1c55adef761e87e0c51cf872bad12a
3
+ metadata.gz: f5112275b960c0a74c635c08e48280553d397766
4
+ data.tar.gz: eaa061ab2f0bb09c39cc7d0d6b898ac0f009773b
5
5
  SHA512:
6
- metadata.gz: 9a7e2a387afa16cce3d6614df7381096d097c5e45856efdb94e1746c1f2138c6631d2fd652ac9ce2715dfeed8f9fd6bf516b24c7cbcb74b399d58ca4c8579c6f
7
- data.tar.gz: 39e7426f7eae5d73daa453643fc145fc87608cccadfbfa693a22658849218998ca9c4934c13341b06fa52490b55922a19ee3243c1c6e83f0410c480ec71d0e94
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
- if @parent.respond_to? :owner_name
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 = Collections::Claims.new(auth: @auth, parent: @parent).where conditions
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.25.30'
2
+ VERSION = '0.25.31'
3
3
  end
@@ -51,12 +51,13 @@ describe Yt::ContentOwner, :partner do
51
51
  end
52
52
 
53
53
  describe '.includes(:claim)' do
54
- let(:video) { $content_owner.videos.includes(:claim).first }
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(video.instance_variable_defined? :@claim).to be true
58
- expect(video.claim.id).to be_a String
59
- expect(video.claim.video_id).to eq video.id
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.30
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 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport