yt-audit 0.1.1 → 0.1.2

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: 139d337967690c1ec34e17c899018d9c1ad06720
4
- data.tar.gz: d8d7c438500d02ac78ce2daf8e7e860d34ba4ec2
3
+ metadata.gz: 2836fb86bee42998b942fbdd356c482e756481a1
4
+ data.tar.gz: 932e69b0627fe1fdc4b981cc53b82234bafa7c7b
5
5
  SHA512:
6
- metadata.gz: 8a3d50122efa5615b9402c6d4b3d8739e6e2038b67bd2b7d6a60d9bf1dcd3e7d948dabf9c18135ea7e06e8eebbe73acd05c9e79562635b617b133e39b63915ee
7
- data.tar.gz: fdbc7deaa7636a87b351b8e1fce0d875b65410306f7efb4e188aae951bf3a07f84dcfc9d7f5bd9434e70f365325c3e77f3aab2babf93d6fa70c2ee4022de232d
6
+ metadata.gz: 47941e89187671d6d2bcfeadf36d437c4566d2f5dc282746a0f021a7e53336bb46e6237b74b9522abfd9d7d5978b66966472ffdb26bf18c2335b87010576580e
7
+ data.tar.gz: e2ca1fbfec7693d4bb7a5c10eeb8869fe664f9a48a0292b3592aaac7cb11394545bf5a5246c026c84f9c409c12ed9a4269468bb3fd655f0ab5fbf24aacb63a97
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.1.2 - 2016.02.11
10
+
11
+ * [FEATURE] Add `has_subscribe_annotations?`
12
+
9
13
  ## 0.1.1 - Unreleased
10
14
 
11
15
  * [ENHANCEMENT] Brand name case-insensitive in `has_brand_anchoring?`
data/README.md CHANGED
@@ -19,4 +19,6 @@ Yt::Audit.has_info_cards?('rF711XAtrVg')
19
19
  # => true
20
20
  Yt::Audit.has_brand_anchoring?('rF711XAtrVg', 'Budweiser')
21
21
  # => true
22
+ Yt::Audit.has_subscribe_annotations?('rF711XAtrVg')
23
+ # => false
22
24
  ```
@@ -1,5 +1,5 @@
1
1
  module Yt
2
2
  module Audit
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
data/lib/yt/audit.rb CHANGED
@@ -5,7 +5,7 @@ module Yt
5
5
  module Audit
6
6
  # Audit any info card of a video
7
7
  # @param [String] video_id the video to audit.
8
- # @return true if the video has any info card.
8
+ # @return [Boolean] if the video has any info card.
9
9
  # @raise [NoMethodError] if video_id is not a valid video.
10
10
  def self.has_info_cards?(video_id)
11
11
  Yt::Annotations.for(video_id).any? do |annotation|
@@ -16,11 +16,21 @@ module Yt
16
16
  # Audit brand anchoring of a video
17
17
  # @param [String] video_id the video to audit.
18
18
  # @param [String] brand name of the video to audit.
19
- # @return true if the video title includes brand name.
19
+ # @return [Boolean] if the video title includes brand name.
20
20
  # @raise [Yt::Errors::NoItems] if video_id is not a valid video.
21
21
  def self.has_brand_anchoring?(video_id, brand)
22
22
  video_title = Yt::Video.new(id: video_id).title
23
- video_title.upcase.include? brand.upcase
23
+ !!video_title[/#{brand}/i]
24
+ end
25
+
26
+ # Audit any subscribe annotation of a video
27
+ # @param [String] video_id the video to audit.
28
+ # @return [Boolean] if the video has any link to subscribe in the annotations.
29
+ # @raise [NoMethodError] if video_id is not a valid video.
30
+ def self.has_subscribe_annotations?(video_id)
31
+ Yt::Annotations.for(video_id).any? do |annotation|
32
+ annotation.link && annotation.link[:type] == :subscribe
33
+ end
24
34
  end
25
35
  end
26
36
  end
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.1.1
4
+ version: 0.1.2
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-09 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yt