boxr 0.24.0 → 0.25.0
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/lib/boxr/auth.rb +6 -6
- data/lib/boxr/users.rb +3 -2
- data/lib/boxr/version.rb +1 -1
- data/spec/boxr_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f91a21daf6cd40a57ba2b240f980ecdd9b0bc53
|
4
|
+
data.tar.gz: 5a44c1b4e0750902636de3d96444863be26f6f4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19377c61c9d9f3b36d7319d0048c291629af9b03099820b8ec732236fd24856186ce540c65a47c24830cc2ecffba313738f017e2b1e8b0a8ccda7d699e226b6d
|
7
|
+
data.tar.gz: cbbe61b6758e677b23494b971f7cdf7e84f48dee81dd4c8bf6aba1258157ba0b4056b35365b3a787b24a37eadc0f7ffc7e601007570bca321498bcc27e320696
|
data/lib/boxr/auth.rb
CHANGED
@@ -24,12 +24,12 @@ module Boxr
|
|
24
24
|
auth_post(uri, body)
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.get_enterprise_token(private_key, enterprise_id: ENV['BOX_ENTERPRISE_ID'], client_id: ENV['BOX_CLIENT_ID'])
|
28
|
-
jwt_auth_post(private_key, client_id, enterprise_id, "enterprise")
|
27
|
+
def self.get_enterprise_token(private_key, scope: nil, enterprise_id: ENV['BOX_ENTERPRISE_ID'], client_id: ENV['BOX_CLIENT_ID'])
|
28
|
+
jwt_auth_post(private_key, scope, client_id, enterprise_id, "enterprise")
|
29
29
|
end
|
30
30
|
|
31
|
-
def self.get_user_token(private_key, user_id, client_id: ENV['BOX_CLIENT_ID'])
|
32
|
-
jwt_auth_post(private_key, client_id, user_id, "user")
|
31
|
+
def self.get_user_token(private_key, user_id, scope: nil, client_id: ENV['BOX_CLIENT_ID'])
|
32
|
+
jwt_auth_post(private_key, scope, client_id, user_id, "user")
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.refresh_tokens(refresh_token, client_id: ENV['BOX_CLIENT_ID'], client_secret: ENV['BOX_CLIENT_SECRET'])
|
@@ -54,7 +54,7 @@ module Boxr
|
|
54
54
|
|
55
55
|
private
|
56
56
|
|
57
|
-
def self.jwt_auth_post(private_key, iss, sub, box_sub_type)
|
57
|
+
def self.jwt_auth_post(private_key, scope, iss, sub, box_sub_type)
|
58
58
|
payload = {
|
59
59
|
iss: iss,
|
60
60
|
sub: sub,
|
@@ -65,7 +65,7 @@ module Boxr
|
|
65
65
|
}
|
66
66
|
assertion = JWT.encode(payload, private_key, "RS256")
|
67
67
|
|
68
|
-
get_token(grant_type: JWT_GRANT_TYPE, assertion: assertion)
|
68
|
+
get_token(grant_type: JWT_GRANT_TYPE, assertion: assertion, scope: scope)
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.auth_post(uri, body)
|
data/lib/boxr/users.rb
CHANGED
@@ -36,14 +36,15 @@ module Boxr
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def create_user(
|
39
|
+
def create_user(name, login: nil, role: nil, language: nil, is_sync_enabled: nil, job_title: nil,
|
40
40
|
phone: nil, address: nil, space_amount: nil, tracking_codes: nil,
|
41
41
|
can_see_managed_users: nil, is_external_collab_restricted: nil, status: nil, timezone: nil,
|
42
42
|
is_exempt_from_device_limits: nil, is_exempt_from_login_verification: nil,
|
43
43
|
is_platform_access_only: nil)
|
44
44
|
|
45
45
|
uri = USERS_URI
|
46
|
-
attributes = {
|
46
|
+
attributes = {name: name}
|
47
|
+
attributes[:login] = login unless login.nil? #login is not required for platform users, so needed to make this optional
|
47
48
|
attributes[:role] = role unless role.nil?
|
48
49
|
attributes[:language] = language unless language.nil?
|
49
50
|
attributes[:is_sync_enabled] = is_sync_enabled unless is_sync_enabled.nil?
|
data/lib/boxr/version.rb
CHANGED
data/spec/boxr_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe Boxr::Client do
|
|
51
51
|
BOX_CLIENT.delete_user(u, force: true)
|
52
52
|
end
|
53
53
|
sleep BOX_SERVER_SLEEP
|
54
|
-
test_user = BOX_CLIENT.create_user(
|
54
|
+
test_user = BOX_CLIENT.create_user(TEST_USER_NAME, login: TEST_USER_LOGIN)
|
55
55
|
@test_user = test_user
|
56
56
|
|
57
57
|
all_groups = BOX_CLIENT.groups
|