g5_authentication_client 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +4 -10
- data/lib/g5_authentication_client/client.rb +2 -1
- data/lib/g5_authentication_client/version.rb +1 -1
- data/spec/g5_authentication_client/client_spec.rb +52 -18
- 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: 0feb9bbacf734abc8f82d494f5b2e0d19342e851
|
4
|
+
data.tar.gz: 1c671a19a12f098fdc271ef64fbe6f3ec62b3645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0a1a80419a069ebe94d04204fe1f3cf5f53a2454e4cd94ecdb6a86b7e8996dad81245758a1f856ff5517ca9f804b8288df2ec7eafedd8a27a4b11dbd6faa88d
|
7
|
+
data.tar.gz: b4450179fffa6f0bffa364bf5c28b02c6564c9be166efcc2f80c4e166506116a76fa84910ddedbeac68ba90c0203f303835bc9cb7276a70e74ac8371ed1273eb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## v0.5.1 (2015-08-21)
|
2
|
+
|
3
|
+
* Allow user attributes to be selectively updated
|
4
|
+
([#25](https://github.com/G5/g5_authentication_client/pull/25))
|
5
|
+
|
6
|
+
## v0.5.0 (2015-06-01)
|
7
|
+
|
8
|
+
* Add support for resource-scoped roles
|
9
|
+
([#24](https://github.com/G5/g5_authentication_client/pull/24))
|
10
|
+
|
1
11
|
## v0.4.0 (2015-05-20)
|
2
12
|
|
3
13
|
* Add `G5AuthenticationClient::Client#list_roles`, a new
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A client library for the g5-authentication service.
|
|
4
4
|
|
5
5
|
## Current version ##
|
6
6
|
|
7
|
-
0.
|
7
|
+
0.5.1
|
8
8
|
|
9
9
|
## Requirements ##
|
10
10
|
|
@@ -217,15 +217,9 @@ service:
|
|
217
217
|
```ruby
|
218
218
|
auth_client = G5AuthenticationClient::Client.new(access_token: 'my_access_token')
|
219
219
|
auth_client.list_roles
|
220
|
-
# => [#<G5AuthenticationClient::Role
|
221
|
-
|
222
|
-
|
223
|
-
To retrieve information about a particular role:
|
224
|
-
|
225
|
-
```ruby
|
226
|
-
auth_client = G5AuthenticationClient::Client.new(access_token: 'my_access_token')
|
227
|
-
auth_client.get_role(4)
|
228
|
-
# => #<G5AuthenticationClient::Role id=4 name="viewer">
|
220
|
+
# => [#<G5AuthenticationClient::Role name="admin" type="GLOBAL" urn=nil>,
|
221
|
+
# #<G5AuthenticationClient::Role name="viewer" type="G5Updatable::Client" urn="g5-c-1abc2de-custom-client">,
|
222
|
+
# ...]
|
229
223
|
```
|
230
224
|
|
231
225
|
## Examples ##
|
@@ -41,28 +41,40 @@ describe G5AuthenticationClient::Client do
|
|
41
41
|
|
42
42
|
let(:new_user_options) do
|
43
43
|
{email: email,
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
password: new_password,
|
45
|
+
password_confirmation: new_password,
|
46
|
+
id: user_id,
|
47
|
+
first_name: first_name,
|
48
|
+
last_name: last_name,
|
49
|
+
organization_name: organization_name,
|
50
|
+
phone_number: phone_number,
|
51
|
+
title: title,
|
52
|
+
roles: [{name: role_name, urn: role_urn, type: role_type}]}
|
47
53
|
end
|
48
54
|
|
49
55
|
let(:new_user_request) do
|
50
56
|
{
|
51
|
-
'email'=>email,
|
52
|
-
'first_name'=>
|
53
|
-
'last_name'=>
|
54
|
-
'organization_name'=>
|
55
|
-
'password'=>
|
56
|
-
'password_confirmation'=>
|
57
|
-
'phone_number'=>
|
58
|
-
'title'=>
|
59
|
-
'roles'=>['name'=>role_name,'urn'=> role_urn, 'type'=>role_type]
|
57
|
+
'email' => email,
|
58
|
+
'first_name' => first_name,
|
59
|
+
'last_name'=> last_name,
|
60
|
+
'organization_name' => organization_name,
|
61
|
+
'password' => new_password,
|
62
|
+
'password_confirmation' => new_password,
|
63
|
+
'phone_number' => phone_number,
|
64
|
+
'title' => title,
|
65
|
+
'roles' => [{'name' => role_name, 'urn'=> role_urn, 'type' => role_type}]
|
60
66
|
}
|
61
67
|
end
|
62
68
|
|
63
|
-
let(:email){'foo@blah.com'}
|
64
|
-
let(:password){'mybigtestpasswored'}
|
65
|
-
let(:
|
69
|
+
let(:email) { 'foo@blah.com' }
|
70
|
+
let(:password) { 'mybigtestpasswored' }
|
71
|
+
let(:new_password) { "#{password}x" }
|
72
|
+
let(:user_id) { 1 }
|
73
|
+
let(:first_name) { 'Fred' }
|
74
|
+
let(:last_name) { 'Rogers' }
|
75
|
+
let(:organization_name) { 'The Neighborhood' }
|
76
|
+
let(:phone_number) { '(555) 555-5555' }
|
77
|
+
let(:title) { 'Neighbor' }
|
66
78
|
let(:role_name) { 'my_role_1' }
|
67
79
|
let(:role_type) { 'G5Updatable::Client1' }
|
68
80
|
let(:role_urn) { 'someurn1' }
|
@@ -320,11 +332,33 @@ describe G5AuthenticationClient::Client do
|
|
320
332
|
|
321
333
|
it_should_behave_like 'an oauth protected resource', G5AuthenticationClient::User
|
322
334
|
|
323
|
-
|
324
|
-
|
325
|
-
|
335
|
+
context 'when all user options are populated' do
|
336
|
+
it 'will have the appropriate body and Authorization header' do
|
337
|
+
update_user
|
338
|
+
expect(a_request(:put, /#{endpoint}\/v1\/users\/#{user_id}/).
|
326
339
|
with(body: Faraday::NestedParamsEncoder.encode({'user'=>new_user_request}), headers: {'Authorization' => auth_header_value})).
|
327
340
|
to have_been_made.once
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
context 'when some user options are not populated' do
|
345
|
+
let(:new_user_options) do
|
346
|
+
{id: user_id,
|
347
|
+
email: email,
|
348
|
+
first_name: first_name}
|
349
|
+
end
|
350
|
+
|
351
|
+
let(:new_user_request) do
|
352
|
+
{'email' => email,
|
353
|
+
'first_name' => first_name}
|
354
|
+
end
|
355
|
+
|
356
|
+
it 'only sends the populated attributes and ignores the rest' do
|
357
|
+
update_user
|
358
|
+
expect(a_request(:put, /#{endpoint}\/v1\/users\/#{user_id}/).
|
359
|
+
with(body: Faraday::NestedParamsEncoder.encode({'user'=>new_user_request}), headers: {'Authorization' => auth_header_value})).
|
360
|
+
to have_been_made.once
|
361
|
+
end
|
328
362
|
end
|
329
363
|
end
|
330
364
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_authentication_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Revels
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: modelish
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project: g5_authentication_client
|
249
|
-
rubygems_version: 2.4.
|
249
|
+
rubygems_version: 2.4.6
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Client for the G5 Auth service
|