yt-annotations 1.4.1 → 1.4.2

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: 5af7335a71c02853df3dc551ac1644636fbfeb08
4
- data.tar.gz: 972ddc78ffc07d534dc907218a3187bcb8bc0b89
3
+ metadata.gz: e90f02ea969bbc11df732a40a5e2f943b24507f1
4
+ data.tar.gz: 05bbc8a4ba7fb944e4e77cd211406cdd4fa07b3c
5
5
  SHA512:
6
- metadata.gz: ab38e436b2323ee00fbd2d9643c44138f9c4b3dabbb7f12ae787a2ab47002b44eafc19765519559954f49bdbe43b685939a5886f63239b248c76f3f7258efc48
7
- data.tar.gz: 72cc855dea18be49d1a17db7662eecbd6874c5cb536936847d3a72900e4639fb569462e599dd06332fbce59b04824d1e1b3a0c19208314473391ad35a7748421
6
+ metadata.gz: 8a20ea07b37fb8e6a6545dc49233084907f368fbb01265b1f95bedb86e046fa438f370cda210f8e0e22c663e757731d269e52232804c9bd0fc601eeeda7b13c6
7
+ data.tar.gz: 2d3675386a5c15030081f27b4f4d27dfddce214166a10f397e74cf17f3b54f5637625dd04ab0a722182c9e0628102c37cbfd13d4e59c9f84f3cdd9835dd40199
data/.travis.yml CHANGED
@@ -2,3 +2,6 @@ language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
4
  - 2.2.2
5
+ script:
6
+ - bundle exec rspec
7
+ - bundle exec yard stats | grep "100.00% documented"
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ For more information about changelogs, check
7
7
  [Vandamme](http://tech-angels.github.io/vandamme).
8
8
 
9
9
 
10
+ ## 1.4.2 - 2017.05.24
11
+
12
+ * [BUGFIX] Do not raise errors from endscreens with different title format
13
+
10
14
  ## 1.4.1 - 2017.03.31
11
15
 
12
16
  * [BUGFIX] Change `EndScreen` according to its endpoint change on YouTube
data/README.md CHANGED
@@ -37,14 +37,17 @@ Yt::Annotations requires **Ruby 2.2.2 or higher**.
37
37
 
38
38
  To include in your project, add `gem 'yt-annotations', ~> '1.0'` to the `Gemfile` file of your Ruby project.
39
39
 
40
+
40
41
  How to contribute
41
42
  =================
42
43
 
43
- If you’ve made it this far in the README… thanks! :v:
44
- Feel free to try it the gem, explore the code, and send issues or pull requests.
44
+ Contribute to the code by forking the project, adding the missing code,
45
+ writing the appropriate tests and submitting a pull request.
45
46
 
46
- All pull requests will have to make Travis and Code Climate happy in order to be accepted. :kissing_smiling_eyes:
47
+ In order for a PR to be approved, all the tests need to pass and all the public
48
+ methods need to be documented and listed in the guides. Remember:
47
49
 
48
- You can also run the tests locally with `bundle exec rspec`.
50
+ - to run all tests locally: `bundle exec rspec`
51
+ - to generate the docs locally: `bundle exec yard`
52
+ - to list undocumented methods: `bundle exec yard stats --list-undoc`
49
53
 
50
- Happy hacking!
@@ -4,10 +4,10 @@ module Yt
4
4
  module Annotations
5
5
  # An end screen annotation shows in the last 5 to seconds of the video.
6
6
  class EndScreen < Base
7
- # @param [Hash] data the Hash representation of the XML data returned by
7
+ # @param [Hash] json the Hash representation of the XML data returned by
8
8
  # YouTube for each end screen of a video.
9
9
  def initialize(json = {})
10
- @text = json['title']['runs'][0]['text']
10
+ @text = text_in json
11
11
  @starts_at = json['startMs'].to_i / 1000.0
12
12
  @ends_at = ends_at_in json
13
13
  @link = to_link json
@@ -15,6 +15,14 @@ module Yt
15
15
 
16
16
  private
17
17
 
18
+ def text_in(json)
19
+ if json['title']['runs'].nil?
20
+ json['title']['simpleText']
21
+ else
22
+ json['title']['runs'][0]['text']
23
+ end
24
+ end
25
+
18
26
  def ends_at_in(json)
19
27
  json['endMs'].to_i / 1000.0
20
28
  end
@@ -9,11 +9,16 @@ require 'yt/annotations/spotlight'
9
9
  require 'yt/annotations/title'
10
10
  require 'yt/annotations/pause'
11
11
 
12
+ # An object-oriented Ruby client for YouTube.
13
+ # @see http://www.rubydoc.info/gems/yt/
12
14
  module Yt
13
15
  module Annotations
16
+ # Provides a method to fetch annotations and cards for a YouTube video.
14
17
  module For
18
+ # @param [String] video_id the unique ID of a YouTube video.
19
+ # @return [Array<Yt::Annotation>] the annotations/end cards of the video.
15
20
  def for(video_id)
16
- (annotations(video_id) + end_screens(video_id)).sort_by &:starts_at
21
+ (annotations(video_id) + end_screens(video_id)).sort_by(&:starts_at)
17
22
  end
18
23
 
19
24
  private
@@ -1,5 +1,8 @@
1
1
  module Yt
2
+ # Provides functionality to fetch annotations and cards from YouTube videos.
2
3
  module Annotations
3
- VERSION = '1.4.1'
4
+ # @return [String] the SemVer-compatible gem version.
5
+ # @see http://semver.org
6
+ VERSION = '1.4.2'
4
7
  end
5
8
  end
@@ -6,8 +6,8 @@ require 'yt/annotations/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'yt-annotations'
8
8
  spec.version = Yt::Annotations::VERSION
9
- spec.authors = ['claudiob']
10
- spec.email = ['claudiob@gmail.com']
9
+ spec.authors = ['Claudio Baccigalupo', 'Kang-Kyu Lee']
10
+ spec.email = ['claudio@fullscreen.net', 'kang-kyu.lee@fullscreen.net']
11
11
 
12
12
  spec.summary = %q{Fetch annotations and cards from YouTube videos.}
13
13
  spec.description = %q{A Ruby library to retrieve every type of annotation from
@@ -17,16 +17,19 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.required_ruby_version = '>= 2.2.2'
19
19
 
20
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
21
23
  spec.bindir = 'exe'
22
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
25
  spec.require_paths = ['lib']
24
26
 
25
27
  spec.add_dependency 'activesupport', '>= 4', '< 6'
26
28
 
27
- spec.add_development_dependency 'bundler', '~> 1.7'
28
- spec.add_development_dependency 'rake', '~> 10.0'
29
- spec.add_development_dependency 'rspec', '~> 3.3'
30
- spec.add_development_dependency 'coveralls', '~> 0.8.10'
29
+ spec.add_development_dependency 'bundler', '~> 1.14'
30
+ spec.add_development_dependency 'rspec', '~> 3.5'
31
+ spec.add_development_dependency 'rake', '~> 12.0'
32
+ spec.add_development_dependency 'coveralls', '~> 0.8.20'
31
33
  spec.add_development_dependency 'pry-nav', '~> 0.2.4'
34
+ spec.add_development_dependency 'yard', '~> 0.9.8'
32
35
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt-annotations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
- - claudiob
7
+ - Claudio Baccigalupo
8
+ - Kang-Kyu Lee
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
12
+ date: 2017-05-24 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport
@@ -36,56 +37,56 @@ dependencies:
36
37
  requirements:
37
38
  - - "~>"
38
39
  - !ruby/object:Gem::Version
39
- version: '1.7'
40
+ version: '1.14'
40
41
  type: :development
41
42
  prerelease: false
42
43
  version_requirements: !ruby/object:Gem::Requirement
43
44
  requirements:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
- version: '1.7'
47
+ version: '1.14'
47
48
  - !ruby/object:Gem::Dependency
48
- name: rake
49
+ name: rspec
49
50
  requirement: !ruby/object:Gem::Requirement
50
51
  requirements:
51
52
  - - "~>"
52
53
  - !ruby/object:Gem::Version
53
- version: '10.0'
54
+ version: '3.5'
54
55
  type: :development
55
56
  prerelease: false
56
57
  version_requirements: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - "~>"
59
60
  - !ruby/object:Gem::Version
60
- version: '10.0'
61
+ version: '3.5'
61
62
  - !ruby/object:Gem::Dependency
62
- name: rspec
63
+ name: rake
63
64
  requirement: !ruby/object:Gem::Requirement
64
65
  requirements:
65
66
  - - "~>"
66
67
  - !ruby/object:Gem::Version
67
- version: '3.3'
68
+ version: '12.0'
68
69
  type: :development
69
70
  prerelease: false
70
71
  version_requirements: !ruby/object:Gem::Requirement
71
72
  requirements:
72
73
  - - "~>"
73
74
  - !ruby/object:Gem::Version
74
- version: '3.3'
75
+ version: '12.0'
75
76
  - !ruby/object:Gem::Dependency
76
77
  name: coveralls
77
78
  requirement: !ruby/object:Gem::Requirement
78
79
  requirements:
79
80
  - - "~>"
80
81
  - !ruby/object:Gem::Version
81
- version: 0.8.10
82
+ version: 0.8.20
82
83
  type: :development
83
84
  prerelease: false
84
85
  version_requirements: !ruby/object:Gem::Requirement
85
86
  requirements:
86
87
  - - "~>"
87
88
  - !ruby/object:Gem::Version
88
- version: 0.8.10
89
+ version: 0.8.20
89
90
  - !ruby/object:Gem::Dependency
90
91
  name: pry-nav
91
92
  requirement: !ruby/object:Gem::Requirement
@@ -100,11 +101,26 @@ dependencies:
100
101
  - - "~>"
101
102
  - !ruby/object:Gem::Version
102
103
  version: 0.2.4
104
+ - !ruby/object:Gem::Dependency
105
+ name: yard
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.9.8
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.9.8
103
118
  description: |-
104
119
  A Ruby library to retrieve every type of annotation from
105
120
  any YouTube video, including branding, featured content and info cards.
106
121
  email:
107
- - claudiob@gmail.com
122
+ - claudio@fullscreen.net
123
+ - kang-kyu.lee@fullscreen.net
108
124
  executables: []
109
125
  extensions: []
110
126
  extra_rdoc_files: []
@@ -154,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
170
  version: '0'
155
171
  requirements: []
156
172
  rubyforge_project:
157
- rubygems_version: 2.6.11
173
+ rubygems_version: 2.6.12
158
174
  signing_key:
159
175
  specification_version: 4
160
176
  summary: Fetch annotations and cards from YouTube videos.