yt 0.13.8 → 0.13.9

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: c180d75d3544370dcf5ad0bf29cd7da6a22b62b3
4
- data.tar.gz: f2d6f98305c7f759e63f9350d8b9d15b28326b1c
3
+ metadata.gz: db12d589d5763d973797f580561eff7054db2643
4
+ data.tar.gz: 2e73f17f11c03ae2b1e3805ba855fa7e84eb7610
5
5
  SHA512:
6
- metadata.gz: 733901314de6696b5c92d2e6040d50823fc83e78b7bea221df6c3c9616e4fa640da693dcb1900afb260d3a903a6e46e2763ea4f6d597b8b69faf928ad38b5d87
7
- data.tar.gz: 3b30960bbed06617f1632f41b148946bdc37fad836b5b6a48913a0de7587209e46ba17e1640898facc5f082902b0685a43ccb227e89bb8bcdbdffd33c6f52ff8
6
+ metadata.gz: 9cd65afd9ef4f2837604e2570fa3e404cec78fd183e9cb9cd0e7b0e1896c29cf53b50e2e210a1ed3d1688c747a9b12bffa93e14ed448c7efe35d7365beb34532
7
+ data.tar.gz: e78d7b773dc49accb73b6e33c3285f5cde7dca2c49da55b071ccd9437df46d79a3c83df5c93ed211ba552d0a15c5a0b698c329860c8073eb6235bd113c89ae64
@@ -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.13.9 - 2015-02-16
10
+
11
+ * [ENHANCEMENT] Accept `force: true` in `authentication_url` to force approval prompt.
12
+
9
13
  ## 0.13.8 - 2015-01-15
10
14
 
11
15
  * [FEATURE] AssetSearch resources available.
data/README.md CHANGED
@@ -41,7 +41,7 @@ To install on your system, run
41
41
 
42
42
  To use inside a bundled Ruby project, add this line to the Gemfile:
43
43
 
44
- gem 'yt', '~> 0.13.4'
44
+ gem 'yt', '~> 0.13.9'
45
45
 
46
46
  Since the gem follows [Semantic Versioning](http://semver.org),
47
47
  indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
@@ -319,7 +319,8 @@ video.like #=> true
319
319
  account = Yt::Account.new access_token: 'ya29.1.ABCDEFGHIJ'
320
320
  video = Yt::Video.new id: 'MESycYJytkU', auth: account
321
321
 
322
- video.update title: 'A title', description: 'A description <with angle brackets>', tags: ['a tag'], categoryId: '21'
322
+ video.update title: 'A title', description: 'A description <with angle brackets>'
323
+ video.update tags: ['a tag'], categoryId: '21', license: 'creativeCommon'
323
324
 
324
325
  video.views since: 7.days.ago #=> {Wed, 28 May 2014 => 12.0, Thu, 29 May 2014 => 3.0, …}
325
326
  video.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014 => 4.0, …}
@@ -26,6 +26,7 @@ module Yt
26
26
  @expires_at = options[:expires_at]
27
27
  @authorization_code = options[:authorization_code]
28
28
  @redirect_uri = options[:redirect_uri]
29
+ @force = options[:force]
29
30
  @scopes = options[:scopes]
30
31
  @authentication = options[:authentication]
31
32
  end
@@ -153,6 +154,7 @@ module Yt
153
154
  params[:redirect_uri] = @redirect_uri
154
155
  params[:response_type] = :code
155
156
  params[:access_type] = :offline
157
+ params[:approval_prompt] = @force ? :force : :auto
156
158
  # params[:include_granted_scopes] = true
157
159
  end
158
160
  end
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.13.8'
2
+ VERSION = '0.13.9'
3
3
  end
@@ -109,9 +109,15 @@ describe Yt::Account, :device_app do
109
109
  it { expect{account.authentication}.to raise_error Yt::Errors::MissingAuth }
110
110
  end
111
111
 
112
+ # @note: This test is a reflection of another irrational behavior of
113
+ # YouTube API. When passing a wrong 'device_code', YouTube crashes and
114
+ # raises 500, instead of an expected MissingAuth.
115
+ # The day YouTube fixes it, then this test will finally fail and the
116
+ # commented line will be restored.
112
117
  context 'and an invalid device code' do
113
118
  before { attrs[:device_code] = '--not-a-valid-device-code--' }
114
- it { expect{account.authentication}.to raise_error Yt::Errors::MissingAuth }
119
+ # it { expect{account.authentication}.to raise_error Yt::Errors::MissingAuth }
120
+ it { expect{account.authentication}.to raise_error Yt::Errors::ServerError }
115
121
  end
116
122
  end
117
123
 
@@ -122,9 +128,15 @@ describe Yt::Account, :device_app do
122
128
  end
123
129
 
124
130
  describe '#authentication_url' do
131
+ let(:auth_attrs) { {redirect_uri: 'http://localhost/', scopes: ['userinfo.email', 'userinfo.profile']} }
125
132
  context 'given a redirect URI and scopes' do
126
- let(:attrs) { {redirect_uri: 'http://localhost/', scopes: ['userinfo.email', 'userinfo.profile']} }
133
+ let(:attrs) { auth_attrs }
127
134
  it { expect(account.authentication_url).to match 'access_type=offline' }
135
+
136
+ context 'given a forced approval prompt' do
137
+ let(:attrs) { auth_attrs.merge force: true }
138
+ it { expect(account.authentication_url).to match 'approval_prompt=force' }
139
+ end
128
140
  end
129
141
  end
130
142
  end
@@ -250,24 +250,6 @@ describe Yt::Video, :device_app do
250
250
  end
251
251
  end
252
252
 
253
- context 'given I update the license' do
254
- let!(:old_license) { video.license }
255
- let!(:new_license) { old_license == 'youtube' ? 'creativeCommon' : 'youtube' }
256
- let(:attrs) { {license: new_license} }
257
-
258
- # @note: This test is a reflection of another irrational behavior of
259
- # YouTube API. Although 'license' can be passed as an 'update'
260
- # attribute according to the documentation, it simply does not work.
261
- # The day YouTube fixes it, then this test will finally fail and will
262
- # be removed, documenting how to update 'embeddable' too.
263
- # @see https://developers.google.com/youtube/v3/docs/videos/update
264
- # @see https://code.google.com/p/gdata-issues/issues/detail?id=4861
265
- specify 'does not update the embeddable status' do
266
- expect(update).to be true
267
- expect(video.license).to eq old_license
268
- end
269
- end
270
-
271
253
  context 'given I update the public stats viewable setting' do
272
254
  let!(:old_public_stats_viewable) { video.has_public_stats_viewable? }
273
255
  let!(:new_public_stats_viewable) { !old_public_stats_viewable }
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.13.8
4
+ version: 0.13.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  version: '0'
300
300
  requirements: []
301
301
  rubyforge_project:
302
- rubygems_version: 2.2.2
302
+ rubygems_version: 2.4.5
303
303
  signing_key:
304
304
  specification_version: 4
305
305
  summary: Yt makes it easy to interact with Youtube V3 API by providing a modular,