yt 0.25.35 → 0.25.36

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: 2dec437252cd2418fc5ff1352347f2d1c03c8a5b
4
- data.tar.gz: ba4235539102e153a98e03762e5708a6b1142cd8
3
+ metadata.gz: 03df481de8d8dab964d533b1dd85718556c3a42c
4
+ data.tar.gz: aba3bea32baeefa3b394814027c8f687ab6942eb
5
5
  SHA512:
6
- metadata.gz: 351eb09f09237648bf9ed6ef8954becd0df5b8f5d18020d02ce33276008ad79c4f163f5a643afdd7c0c741793c634ec149e9b1cf613de535f18b64d2cb3674a2
7
- data.tar.gz: d1e4583f8f12b5d734431b45687f63f4e5db47fd03c1425fe2326dbc863b0afaec317b7c0c9b7654b7c0728207211ada7c985d73c2792b0bf183504bb9c748bc
6
+ metadata.gz: 2b747dde037c9a2cb7d0ce840a80940a86c99a234da290c3b9d7212b73d1c713a60cee192b8aa517c0f723826787cc5403933637c8e8d5d1cd7e437c89afe332
7
+ data.tar.gz: a1765da3785f055e37e64f83c697e3c79a230cbe0e2b08b09b305fc4d8d5859cdc33aaa281d0fddec4a148f06daccfdc2b9e73d116caeaef9731ab6af75e346c
@@ -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
@@ -3,11 +3,9 @@ require 'yt/errors/request_error'
3
3
  module Yt
4
4
  module Errors
5
5
  class Forbidden < RequestError
6
- private
7
-
8
6
  def explanation
9
7
  'A request to YouTube API was considered forbidden by the server'
10
8
  end
11
9
  end
12
10
  end
13
- end
11
+ end
@@ -3,11 +3,9 @@ require 'yt/errors/request_error'
3
3
  module Yt
4
4
  module Errors
5
5
  class NoItems < RequestError
6
- private
7
-
8
6
  def explanation
9
7
  'A request to YouTube API returned no items but some were expected'
10
8
  end
11
9
  end
12
10
  end
13
- end
11
+ end
@@ -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
@@ -3,11 +3,9 @@ require 'yt/errors/request_error'
3
3
  module Yt
4
4
  module Errors
5
5
  class ServerError < RequestError
6
- private
7
-
8
6
  def explanation
9
7
  'A request to YouTube API caused an unexpected server error'
10
8
  end
11
9
  end
12
10
  end
13
- end
11
+ 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
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.25.35'
2
+ VERSION = '0.25.36'
3
3
  end
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.35
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-04-27 00:00:00.000000000 Z
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.5.1
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,