yt 0.25.35 → 0.25.36
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/yt/collections/authentications.rb +9 -2
- data/lib/yt/errors/forbidden.rb +1 -3
- data/lib/yt/errors/no_items.rb +1 -3
- data/lib/yt/errors/request_error.rb +10 -7
- data/lib/yt/errors/server_error.rb +1 -3
- data/lib/yt/errors/unauthorized.rb +3 -3
- data/lib/yt/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03df481de8d8dab964d533b1dd85718556c3a42c
|
|
4
|
+
data.tar.gz: aba3bea32baeefa3b394814027c8f687ab6942eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b747dde037c9a2cb7d0ce840a80940a86c99a234da290c3b9d7212b73d1c713a60cee192b8aa517c0f723826787cc5403933637c8e8d5d1cd7e437c89afe332
|
|
7
|
+
data.tar.gz: a1765da3785f055e37e64f83c697e3c79a230cbe0e2b08b09b305fc4d8d5859cdc33aaa281d0fddec4a148f06daccfdc2b9e73d116caeaef9731ab6af75e346c
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ 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
|
+
|
|
10
|
+
## 0.25.36 - 2016-05-10
|
|
11
|
+
|
|
12
|
+
* [BUGFIX] Raise RequestError when authentication code is "invalid" or "already redeemed"
|
|
13
|
+
* [FEATURE] Make two methods `#explanation` and `#response_body` public for `Yt::Errors::RequestError`
|
|
14
|
+
|
|
9
15
|
## 0.25.35 - 2016-04-27
|
|
10
16
|
|
|
11
17
|
* [BUGFIX] Don’t try to eager load more than 50 assets at the time from claims
|
|
@@ -40,8 +40,15 @@ module Yt
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def expected?(error)
|
|
43
|
-
error.kind == 'invalid_grant'
|
|
43
|
+
error.kind == 'invalid_grant' &&
|
|
44
|
+
invalid_code_errors.exclude?(error.description)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def invalid_code_errors
|
|
50
|
+
["Code was already redeemed.", "Invalid code."]
|
|
44
51
|
end
|
|
45
52
|
end
|
|
46
53
|
end
|
|
47
|
-
end
|
|
54
|
+
end
|
data/lib/yt/errors/forbidden.rb
CHANGED
data/lib/yt/errors/no_items.rb
CHANGED
|
@@ -19,6 +19,10 @@ module Yt
|
|
|
19
19
|
response_body.fetch 'error', {}
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
def description
|
|
23
|
+
response_body.fetch 'error_description', {}
|
|
24
|
+
end
|
|
25
|
+
|
|
22
26
|
def reasons
|
|
23
27
|
case kind
|
|
24
28
|
when Hash then kind.fetch('errors', []).map{|e| e['reason']}
|
|
@@ -26,12 +30,15 @@ module Yt
|
|
|
26
30
|
end
|
|
27
31
|
end
|
|
28
32
|
|
|
29
|
-
private
|
|
30
|
-
|
|
31
33
|
def explanation
|
|
32
34
|
'A request to YouTube API failed'
|
|
33
35
|
end
|
|
34
36
|
|
|
37
|
+
def response_body
|
|
38
|
+
json['response_body'].is_a?(Hash) ? json['response_body'] : {}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
35
42
|
|
|
36
43
|
def details
|
|
37
44
|
<<-MSG.gsub(/^ {8}/, '')
|
|
@@ -56,10 +63,6 @@ module Yt
|
|
|
56
63
|
def more_details
|
|
57
64
|
end
|
|
58
65
|
|
|
59
|
-
def response_body
|
|
60
|
-
json['response_body'].is_a?(Hash) ? json['response_body'] : {}
|
|
61
|
-
end
|
|
62
|
-
|
|
63
66
|
def request_curl
|
|
64
67
|
json['request_curl']
|
|
65
68
|
end
|
|
@@ -71,4 +74,4 @@ module Yt
|
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
Error = Errors::RequestError
|
|
74
|
-
end
|
|
77
|
+
end
|
|
@@ -4,12 +4,12 @@ require 'yt/config'
|
|
|
4
4
|
module Yt
|
|
5
5
|
module Errors
|
|
6
6
|
class Unauthorized < RequestError
|
|
7
|
-
private
|
|
8
|
-
|
|
9
7
|
def explanation
|
|
10
8
|
'A request to YouTube API was sent without a valid authentication'
|
|
11
9
|
end
|
|
12
10
|
|
|
11
|
+
private
|
|
12
|
+
|
|
13
13
|
def more_details
|
|
14
14
|
if [Yt.configuration.client_id, Yt.configuration.api_key].none?
|
|
15
15
|
<<-MSG.gsub(/^ {10}/, '')
|
|
@@ -47,4 +47,4 @@ module Yt
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
|
-
end
|
|
50
|
+
end
|
data/lib/yt/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.25.36
|
|
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-
|
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -332,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
332
332
|
version: '0'
|
|
333
333
|
requirements: []
|
|
334
334
|
rubyforge_project:
|
|
335
|
-
rubygems_version: 2.
|
|
335
|
+
rubygems_version: 2.6.4
|
|
336
336
|
signing_key:
|
|
337
337
|
specification_version: 4
|
|
338
338
|
summary: Yt makes it easy to interact with Youtube V3 API by providing a modular,
|