yt 0.25.14 → 0.25.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/yt/associations/has_authentication.rb +19 -0
- data/lib/yt/collections/revocations.rb +30 -0
- data/lib/yt/models/revocation.rb +12 -0
- data/lib/yt/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9911269f376cd2e904f6ac1137b709a0d0de982f
|
4
|
+
data.tar.gz: 2aeff7eae2cf2506a89f98f6b034f05155f5802b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 014afb4485d06e6b967c56c623cea923bfcb3cc7981a3084863226f82d8868a3b3fca455a7c3308148111cac0f55bdde51865f234b37bd7df7eb3c8a4eaac66b
|
7
|
+
data.tar.gz: 770116f76d5b33c0e1e610118074f3e840a6060aee5ec5ca7b332012f08d61d7e738c99f33ad8888d3d73c780efc7ba4d093672d342c628809f3e95c971beb63
|
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.25.15 - 2015-12-17
|
10
|
+
|
11
|
+
* [FEATURE] Add `revoke_access` to Yt::Account
|
12
|
+
|
9
13
|
## 0.25.14 - 2015-12-16
|
10
14
|
|
11
15
|
* [ENHANCEMENT] Add `:display_name` to each content owner returned by account.content_owners
|
@@ -9,6 +9,7 @@ module Yt
|
|
9
9
|
def has_authentication
|
10
10
|
require 'yt/collections/authentications'
|
11
11
|
require 'yt/collections/device_flows'
|
12
|
+
require 'yt/collections/revocations'
|
12
13
|
require 'yt/errors/missing_auth'
|
13
14
|
require 'yt/errors/no_items'
|
14
15
|
require 'yt/errors/unauthorized'
|
@@ -60,6 +61,18 @@ module Yt
|
|
60
61
|
old_access_token != authentication.access_token
|
61
62
|
end
|
62
63
|
|
64
|
+
# Revoke access given to the application.
|
65
|
+
# Returns true if the access was correctly revoked.
|
66
|
+
# @see https://developers.google.com/identity/protocols/OAuth2WebServer#tokenrevoke
|
67
|
+
def revoke_access
|
68
|
+
revocations.first!
|
69
|
+
@authentication = @access_token = @refreshed_authentications = nil
|
70
|
+
true
|
71
|
+
rescue Errors::RequestError => e
|
72
|
+
raise unless e.reasons.include? 'invalid_token'
|
73
|
+
false
|
74
|
+
end
|
75
|
+
|
63
76
|
private
|
64
77
|
|
65
78
|
def current_authentication
|
@@ -150,6 +163,12 @@ module Yt
|
|
150
163
|
end
|
151
164
|
end
|
152
165
|
|
166
|
+
def revocations
|
167
|
+
@revocations ||= Collections::Revocations.of(self).tap do |auth|
|
168
|
+
auth.auth_params = {token: @refresh_token || @access_token}
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
153
172
|
def authentication_url_params
|
154
173
|
{}.tap do |params|
|
155
174
|
params[:client_id] = client_id
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'yt/collections/authentications'
|
2
|
+
require 'yt/models/revocation'
|
3
|
+
|
4
|
+
module Yt
|
5
|
+
module Collections
|
6
|
+
class Revocations < Authentications
|
7
|
+
attr_accessor :auth_params
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# This overrides the parent mehthod defined in Authentications
|
12
|
+
def attributes_for_new_item(data)
|
13
|
+
{data: data}
|
14
|
+
end
|
15
|
+
|
16
|
+
def list_params
|
17
|
+
super.tap do |params|
|
18
|
+
params[:host] = 'accounts.google.com'
|
19
|
+
params[:path] = '/o/oauth2/revoke'
|
20
|
+
params[:request_format] = nil
|
21
|
+
params[:method] = :get
|
22
|
+
params[:auth] = nil
|
23
|
+
params[:body] = nil
|
24
|
+
params[:camelize_body] = false
|
25
|
+
params[:params] = auth_params
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/yt/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/yt/collections/reports.rb
|
157
157
|
- lib/yt/collections/resources.rb
|
158
158
|
- lib/yt/collections/resumable_sessions.rb
|
159
|
+
- lib/yt/collections/revocations.rb
|
159
160
|
- lib/yt/collections/snippets.rb
|
160
161
|
- lib/yt/collections/statistics_sets.rb
|
161
162
|
- lib/yt/collections/statuses.rb
|
@@ -205,6 +206,7 @@ files:
|
|
205
206
|
- lib/yt/models/reference.rb
|
206
207
|
- lib/yt/models/resource.rb
|
207
208
|
- lib/yt/models/resumable_session.rb
|
209
|
+
- lib/yt/models/revocation.rb
|
208
210
|
- lib/yt/models/right_owner.rb
|
209
211
|
- lib/yt/models/snippet.rb
|
210
212
|
- lib/yt/models/statistics_set.rb
|