yt 0.25.31 → 0.25.32

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: f5112275b960c0a74c635c08e48280553d397766
4
- data.tar.gz: eaa061ab2f0bb09c39cc7d0d6b898ac0f009773b
3
+ metadata.gz: 7575ef55d789bc1593546bcf77b7b5848c368b28
4
+ data.tar.gz: 5f5ced71d9ecc23625250b485051d3570ca85fc2
5
5
  SHA512:
6
- metadata.gz: 53d8901fd8f0359de6c065ee43a89ca54b66466db6db76d8ed22a9d8d4fe98f9d78d4ddcbbf9f34b6ea5365ccfd883e1558700777214d054589726bf93cf800d
7
- data.tar.gz: 3503b64bc60c66ff51ce7998cc3b83785529edee66cc63882a6930833ac100a8bf785b3fcb5c16313f86b5a84debe6a8e3b2e702c469e9d6a6f5f57491acf7f3
6
+ metadata.gz: beed739ec7eee33a1eea1cfcce8e23094b2516ebb469ab212b3508f57a2db6b2cbbcbb3f6d8caf90b2b5f6ab35136fa052d947a8c1cbd18e36b82dee5fd9459a
7
+ data.tar.gz: d59ecde5eefcfec8e43ec2bbccd130273240ea21b94f8d62e086b61a29f3a3bfbc5b765f4dc3992aa83129dc8ed241d5d26fb68a9617fb19e83694c58f30751d
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.32 - 2016-04-12
10
+
11
+ * [BUGFIX] Fix where videos did not eager load claims or categories in subsequent requests.
12
+
9
13
  ## 0.25.31 - 2016-04-11
10
14
 
11
15
  * [BUGFIX] Don’t try to instantiate video.claim if a video does not have a claim.
@@ -33,13 +33,16 @@ module Yt
33
33
 
34
34
  def eager_load_items_from(items)
35
35
  if included_relationships.any?
36
- include_category = included_relationships.delete(:category)
37
- include_claim = included_relationships.delete(:claim)
38
- included_relationships.append(:snippet).uniq! if include_category || include_claim
36
+ associations = [:claim, :category]
37
+ if (included_relationships & associations).any?
38
+ included_relationships.append(:snippet).uniq!
39
+ end
39
40
 
40
41
  ids = items.map{|item| item['id']['videoId']}
41
- parts = included_relationships.map{|r| r.to_s.camelize(:lower)}
42
- conditions = {id: ids.join(','), part: parts.join(',')}
42
+ parts = (included_relationships - associations).map do |r|
43
+ r.to_s.camelize(:lower)
44
+ end
45
+ conditions = { id: ids.join(','), part: parts.join(',') }
43
46
  videos = Collections::Videos.new(auth: @auth).where conditions
44
47
 
45
48
  items.each do |item|
@@ -54,7 +57,7 @@ module Yt
54
57
  end if video
55
58
  end
56
59
 
57
- if include_claim
60
+ if included_relationships.include? :claim
58
61
  video_ids = items.map{|item| item['id']['videoId']}.uniq
59
62
  conditions = { video_id: video_ids.join(',') }
60
63
  claims = @parent.claims.where conditions
@@ -64,7 +67,7 @@ module Yt
64
67
  end
65
68
  end
66
69
 
67
- if include_category
70
+ if included_relationships.include? :category
68
71
  category_ids = items.map{|item| item['snippet']['categoryId']}.uniq
69
72
  conditions = {id: category_ids.join(',')}
70
73
  video_categories = Collections::VideoCategories.new(auth: @auth).where conditions
data/lib/yt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.25.31'
2
+ VERSION = '0.25.32'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.31
4
+ version: 0.25.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo