boxr 0.24.0 → 0.25.0

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: a0d35442147a7859ff1e7836f4046b25da444bb2
4
- data.tar.gz: 622c1804bacc35c7e93a0f745b1c6ac51e3c4ae6
3
+ metadata.gz: 9f91a21daf6cd40a57ba2b240f980ecdd9b0bc53
4
+ data.tar.gz: 5a44c1b4e0750902636de3d96444863be26f6f4e
5
5
  SHA512:
6
- metadata.gz: 266c516b45ad743e435269d82f455a4f93abbcb25f8dab734ae87bb088b781526445153aaa113ce81ea35c7c913738edca5606cd2efd8db93f8349cb987b95ce
7
- data.tar.gz: 8077b76c399e2007df9d8b3e21825ba32c6618d4183d8e5a6609dd228eeb76071407eb9d3f87c4abdc3e13ccb18aea350a63ea0b37d01361791b8484fdd9cd32
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(login, name, role: nil, language: nil, is_sync_enabled: nil, job_title: nil,
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 = {login: login, name: name}
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
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "0.24.0"
2
+ VERSION = "0.25.0"
3
3
  end
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(TEST_USER_LOGIN, TEST_USER_NAME)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Burnette