yt-audit 0.2.2 → 0.3.0

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: dfac3e84708259316ddfcea48bdd2b2db0cc2790
4
- data.tar.gz: 8ce6cf3835a6d36e03f87fc50ad684623dd9300e
3
+ metadata.gz: f7bc9f29587e691fd0f693a570cdcbc39deca4ec
4
+ data.tar.gz: 022b95848d5c6d63ad818e803623ad430cabbe59
5
5
  SHA512:
6
- metadata.gz: 5da8a6b32c8b3b8429d754f5ff31a88395a39835ec11da93fed01e47a7c8e023ecc1975f96779074e194ee973fe9af82a94613bbf1b6806779e58001f8004f3d
7
- data.tar.gz: c51d7405aa9e6d1d64bc19c71a4565b3ed563c4e578dbe5b29443e4cb90d5e8e467155658ada4d5d31fb21abc868d5b1a080fdc7aa1439b5cedc885cbc130b5a
6
+ metadata.gz: c1106b3b5308e86c1da812c2534c899ed75118d0db8157a262b317f2a5691a6cbfa3a97274e9bdff6839afdb4c0fb45ffa97adb19e98fd8da0f4664d57941760
7
+ data.tar.gz: dcae062f93467af330f789d0335e166f5bb89d6600def3952d590f775cc415aeabe9742e378c668b653987c319325b8bff64315afc5541f00f3f647cec1eb0e9
@@ -6,9 +6,19 @@ 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.3.0 - 2016.03.01
10
+
11
+ **How to upgrade**
12
+
13
+ When your code defines an `Yt::Audit` object, it should be initialized with a `Yt::Channel` object as `channel:` argument. It used to accept `channel_id` string directly but now your code should define a channel with it first.
14
+
15
+ * [ENHANCEMENT] Optionally send in `Yt::Collections::Videos` or `Yt::Collections::Playlists` object as arguments of an `Yt::Audit`, accompanied with `Yt::Models::Channel` object of yt.
16
+ * [ENHANCEMENT] Send in brand name as an optional argument.
17
+ * [BUGFIX] Fix videos input with longer description, for Youtube Association.
18
+
9
19
  ## 0.2.2 - 2016.02.24
10
20
 
11
- ## [BUGFIX] Fix condition of Info Card
21
+ * [BUGFIX] Fix condition of Info Card
12
22
 
13
23
  ## 0.2.1 - 2016.02.19
14
24
 
data/README.md CHANGED
@@ -24,11 +24,14 @@ The **source code** is available on [GitHub](https://github.com/Fullscreen/yt-au
24
24
 
25
25
  ## Usage
26
26
 
27
- `run` method returns an array of objects. It uses channel title as brand name, and 10 recent videos of channel, currently.
27
+ `run` method returns an array of objects. `Yt::Audit` should be initialized with a `Yt::Channel` object of [yt](https://github.com/Fullscreen/yt) as `channel`.
28
+
29
+ It can also have videos, brand name, and playlists as optional, but by default it uses maximum 10 recent videos of channel as `videos`, channel title as `brand` and maximum 10 recent playlists as `playlists` keyword argument.
28
30
 
29
31
  ```ruby
30
- audit = Yt::Audit.new(channel_id: 'UCPCk_8dtVyR1lLHMBEILW4g')
31
- # => #<Yt::Audit:0x007f94ec8050b0 @channel_id="UCPCk_8dtVyR1lLHMBEILW4g">
32
+ channel = Yt::Channel.new(id: 'UCPCk_8dtVyR1lLHMBEILW4g')
33
+ audit = Yt::Audit.new(channel: channel)
34
+ # => #<Yt::Audit:0x007ffbb43fe780 @channel=#<Yt::Models::Channel...>, @videos=[...], @playlists=[...], @brand="budweiser">
32
35
  audit.run
33
36
  # => [#<Yt::VideoAudit::InfoCard:0x007f94ec8c6f30 @videos=[...]>, #<Yt::VideoAudit::BrandAnchoring...>, #<Yt::VideoAudit::SubscribeAnnotation...>, #<Yt::VideoAudit::YoutubeAssociation...>, #<Yt::VideoAudit::EndCard...>, #<Yt::PlaylistAudit::Description...>]
34
37
  ```
@@ -8,8 +8,9 @@ rescue LoadError
8
8
  end
9
9
 
10
10
  channel_id = ARGV[0] || 'UCKM-eG7PBcw3flaBvd0q2TQ'
11
- audit = Yt::Audit.new(channel_id: channel_id)
12
11
  puts "Channel: https://www.youtube.com/channel/#{channel_id}"
12
+ channel = Yt::Channel.new(id: channel_id)
13
+ audit = Yt::Audit.new(channel: channel)
13
14
  audit.run.each do |audit_item|
14
15
  puts
15
16
  puts "#{audit_item.description}"
@@ -9,33 +9,22 @@ require 'yt/playlist_audit/description'
9
9
 
10
10
  module Yt
11
11
  class Audit
12
- def initialize(channel_id:)
13
- @channel_id = channel_id
12
+ def initialize(channel:, videos: nil, playlists: nil, brand: nil)
13
+ @channel = channel
14
+ @videos = videos || channel.videos.includes(:snippet).first(10)
15
+ @playlists = playlists || channel.playlists.first(10)
16
+ @brand = brand || channel.title
14
17
  end
15
18
 
16
19
  def run
17
20
  [
18
- Yt::VideoAudit::InfoCard.new(videos: videos),
19
- Yt::VideoAudit::BrandAnchoring.new(videos: videos, brand: channel.title),
20
- Yt::VideoAudit::SubscribeAnnotation.new(videos: videos),
21
- Yt::VideoAudit::YoutubeAssociation.new(videos: videos),
22
- Yt::VideoAudit::EndCard.new(videos: videos),
23
- Yt::PlaylistAudit::Description.new(playlists: playlists)
21
+ Yt::VideoAudit::InfoCard.new(videos: @videos),
22
+ Yt::VideoAudit::BrandAnchoring.new(videos: @videos, brand: @brand),
23
+ Yt::VideoAudit::SubscribeAnnotation.new(videos: @videos),
24
+ Yt::VideoAudit::YoutubeAssociation.new(videos: @videos),
25
+ Yt::VideoAudit::EndCard.new(videos: @videos),
26
+ Yt::PlaylistAudit::Description.new(playlists: @playlists)
24
27
  ]
25
28
  end
26
-
27
- private
28
-
29
- def playlists
30
- @playlists ||= channel.playlists.first 10
31
- end
32
-
33
- def videos
34
- @videos ||= channel.videos.first 10
35
- end
36
-
37
- def channel
38
- @channel ||= Yt::Channel.new id: @channel_id
39
- end
40
29
  end
41
30
  end
@@ -1,5 +1,5 @@
1
1
  module Yt
2
2
  class Audit
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -2,8 +2,8 @@ module Yt
2
2
  module PlaylistAudit
3
3
  # Count how many playlists have its description.
4
4
  class Description
5
- def initialize(playlists:)
6
- @playlists = playlists
5
+ def initialize(options={})
6
+ @playlists = options[:playlists]
7
7
  end
8
8
 
9
9
  def total_count
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kang-Kyu Lee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yt