boxr 1.22.0 → 1.23.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.
data/lib/boxr/metadata.rb CHANGED
@@ -1,45 +1,46 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
4
  class Client
3
-
4
5
  def create_metadata(file, metadata, scope: :global, template: :properties)
5
6
  file_id = ensure_id(file)
6
7
  uri = "#{FILE_METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
7
- metadata, response = post(uri, metadata, content_type: "application/json")
8
+ metadata, = post(uri, metadata, content_type: 'application/json')
8
9
  metadata
9
10
  end
10
11
 
11
12
  def create_folder_metadata(folder, metadata, scope, template)
12
13
  folder_id = ensure_id(folder)
13
14
  uri = "#{FOLDER_METADATA_URI}/#{folder_id}/metadata/#{scope}/#{template}"
14
- metadata, response = post(uri, metadata, content_type: "application/json")
15
+ metadata, = post(uri, metadata, content_type: 'application/json')
15
16
  metadata
16
17
  end
17
18
 
18
19
  def metadata(file, scope: :global, template: :properties)
19
20
  file_id = ensure_id(file)
20
21
  uri = "#{FILE_METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
21
- metadata, response = get(uri)
22
+ metadata, = get(uri)
22
23
  metadata
23
24
  end
24
25
 
25
26
  def folder_metadata(folder, scope, template)
26
27
  folder_id = ensure_id(folder)
27
28
  uri = "#{FOLDER_METADATA_URI}/#{folder_id}/metadata/#{scope}/#{template}"
28
- metadata, response = get(uri)
29
+ metadata, = get(uri)
29
30
  metadata
30
31
  end
31
32
 
32
33
  def all_folder_metadata(folder)
33
34
  folder_id = ensure_id(folder)
34
35
  uri = "#{FOLDER_METADATA_URI}/#{folder_id}/metadata"
35
- all_metadata, response = get(uri)
36
+ all_metadata, = get(uri)
36
37
  all_metadata
37
38
  end
38
39
 
39
40
  def all_metadata(file)
40
41
  file_id = ensure_id(file)
41
42
  uri = "#{FILE_METADATA_URI}/#{file_id}/metadata"
42
- all_metadata, response = get(uri)
43
+ all_metadata, = get(uri)
43
44
  all_metadata
44
45
  end
45
46
 
@@ -47,10 +48,10 @@ module Boxr
47
48
  file_id = ensure_id(file)
48
49
  uri = "#{FILE_METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
49
50
 
50
- #in the event just one update is specified ensure that it is packaged inside an array
51
+ # in the event just one update is specified ensure that it is packaged inside an array
51
52
  updates = [updates] unless updates.is_a? Array
52
53
 
53
- metadata, response = put(uri, updates, content_type: "application/json-patch+json")
54
+ metadata, = put(uri, updates, content_type: 'application/json-patch+json')
54
55
  metadata
55
56
  end
56
57
 
@@ -58,65 +59,65 @@ module Boxr
58
59
  folder_id = ensure_id(folder)
59
60
  uri = "#{FOLDER_METADATA_URI}/#{folder_id}/metadata/#{scope}/#{template}"
60
61
 
61
- #in the event just one update is specified ensure that it is packaged inside an array
62
+ # in the event just one update is specified ensure that it is packaged inside an array
62
63
  updates = [updates] unless updates.is_a? Array
63
64
 
64
- metadata, response = put(uri, updates, content_type: "application/json-patch+json")
65
+ metadata, = put(uri, updates, content_type: 'application/json-patch+json')
65
66
  metadata
66
67
  end
67
68
 
68
69
  def delete_metadata(file, scope: :global, template: :properties)
69
70
  file_id = ensure_id(file)
70
71
  uri = "#{FILE_METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
71
- result, response = delete(uri)
72
+ result, = delete(uri)
72
73
  result
73
74
  end
74
75
 
75
76
  def delete_folder_metadata(folder, scope, template)
76
77
  folder_id = ensure_id(folder)
77
78
  uri = "#{FOLDER_METADATA_URI}/#{folder_id}/metadata/#{scope}/#{template}"
78
- result, response = delete(uri)
79
+ result, = delete(uri)
79
80
  result
80
81
  end
81
82
 
82
83
  def enterprise_metadata
83
84
  uri = "#{METADATA_TEMPLATES_URI}/enterprise"
84
- ent_metadata, response = get(uri)
85
+ ent_metadata, = get(uri)
85
86
  ent_metadata
86
87
  end
87
- alias :get_enterprise_templates :enterprise_metadata
88
+ alias get_enterprise_templates enterprise_metadata
88
89
 
89
90
  def metadata_schema(scope, template_key)
90
91
  uri = "#{METADATA_TEMPLATES_URI}/#{scope}/#{template_key}/schema"
91
- schema, response = get(uri)
92
+ schema, = get(uri)
92
93
  schema
93
94
  end
94
- alias :get_metadata_template_by_name :metadata_schema
95
+ alias get_metadata_template_by_name metadata_schema
95
96
 
96
97
  def get_metadata_template_by_id(template_id)
97
98
  template_id = ensure_id(template_id)
98
99
  uri = "#{METADATA_TEMPLATES_URI}/#{template_id}"
99
- schema, response = get(uri)
100
+ schema, = get(uri)
100
101
  schema
101
102
  end
102
103
 
103
104
  def create_metadata_template(display_name, template_key: nil, fields: [], hidden: nil)
104
105
  uri = "#{METADATA_TEMPLATES_URI}/schema"
105
106
  schema = {
106
- scope: "enterprise",
107
- displayName: display_name,
107
+ scope: 'enterprise',
108
+ displayName: display_name
108
109
  }
109
110
  schema[:templateKey] = template_key unless template_key.nil?
110
111
  schema[:hidden] = hidden unless hidden.nil?
111
112
  schema[:fields] = fields unless fields.empty?
112
113
 
113
- metadata_template, response = post(uri, schema, content_type: "application/json")
114
+ metadata_template, = post(uri, schema, content_type: 'application/json')
114
115
  metadata_template
115
116
  end
116
117
 
117
118
  def delete_metadata_template(scope, template_key)
118
119
  uri = "#{METADATA_TEMPLATES_URI}/#{scope}/#{template_key}/schema"
119
- result, response = delete(uri)
120
+ result, = delete(uri)
120
121
  result
121
122
  end
122
123
  end
data/lib/boxr/search.rb CHANGED
@@ -1,43 +1,50 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
4
  class Client
3
-
4
- def search( query=nil, scope: nil, file_extensions: [],
5
- created_at_range_from_date: nil, created_at_range_to_date: nil,
6
- updated_at_range_from_date: nil, updated_at_range_to_date: nil,
7
- size_range_lower_bound_bytes: nil, size_range_upper_bound_bytes: nil,
8
- owner_user_ids: [], ancestor_folder_ids: [], content_types: [], trash_content: nil,
9
- mdfilters: nil, type: nil, limit: 30, offset: 0)
10
-
11
-
12
- unless mdfilters.nil?
13
- unless mdfilters.is_a? String #if a string is passed in assume it is already formatted correctly
14
- unless mdfilters.is_a? Array
15
- mdfilters = [mdfilters] #if just one mdfilter is specified ensure that it is packaged inside an array
16
- end
17
- mdfilters = JSON.dump(mdfilters)
5
+ def search(query = nil, scope: nil, file_extensions: [], fields: [],
6
+ created_at_range_from_date: nil, created_at_range_to_date: nil,
7
+ updated_at_range_from_date: nil, updated_at_range_to_date: nil,
8
+ size_range_lower_bound_bytes: nil, size_range_upper_bound_bytes: nil,
9
+ owner_user_ids: [], ancestor_folder_ids: [], content_types: [], trash_content: nil,
10
+ mdfilters: nil, type: nil, limit: 30, offset: 0)
11
+ # if a string is passed in assume it is already formatted correctly
12
+ if !mdfilters.nil? && !mdfilters.is_a?(String)
13
+ unless mdfilters.is_a? Array
14
+ # if just one mdfilter is specified ensure that it is packaged inside an array
15
+ mdfilters = [mdfilters]
18
16
  end
17
+ mdfilters = JSON.dump(mdfilters)
19
18
  end
20
19
 
21
- #build range strings
22
- created_at_range_string = build_date_range_field(created_at_range_from_date, created_at_range_to_date)
23
- updated_at_range_string = build_date_range_field(updated_at_range_from_date, updated_at_range_to_date)
24
- size_range_string = build_size_range_field(size_range_lower_bound_bytes, size_range_upper_bound_bytes)
20
+ # build range strings
21
+ created_at_range_string = build_date_range_field(created_at_range_from_date,
22
+ created_at_range_to_date)
23
+ updated_at_range_string = build_date_range_field(updated_at_range_from_date,
24
+ updated_at_range_to_date)
25
+ size_range_string = build_size_range_field(size_range_lower_bound_bytes,
26
+ size_range_upper_bound_bytes)
25
27
 
26
- #build comma separated strings
28
+ # build comma separated strings
27
29
  file_extensions_string = to_comma_separated_string(file_extensions)
28
30
  owner_user_ids_string = to_comma_separated_string(owner_user_ids)
29
31
  ancestor_folder_ids_string = to_comma_separated_string(ancestor_folder_ids)
30
32
  content_types_string = to_comma_separated_string(content_types)
33
+ fields_string = to_comma_separated_string(fields)
31
34
 
32
35
  search_query = {}
33
36
  search_query[:query] = query unless query.nil?
34
37
  search_query[:scope] = scope unless scope.nil?
35
38
  search_query[:file_extensions] = file_extensions_string unless file_extensions_string.nil?
39
+ search_query[:fields] = fields_string unless fields_string.nil?
36
40
  search_query[:created_at_range] = created_at_range_string unless created_at_range_string.nil?
37
41
  search_query[:updated_at_range] = updated_at_range_string unless updated_at_range_string.nil?
38
42
  search_query[:size_range] = size_range_string unless size_range_string.nil?
39
43
  search_query[:owner_user_ids] = owner_user_ids_string unless owner_user_ids_string.nil?
40
- search_query[:ancestor_folder_ids] = ancestor_folder_ids_string unless ancestor_folder_ids_string.nil?
44
+ unless ancestor_folder_ids_string.nil?
45
+ search_query[:ancestor_folder_ids] =
46
+ ancestor_folder_ids_string
47
+ end
41
48
  search_query[:content_types] = content_types_string unless content_types_string.nil?
42
49
  search_query[:trash_content] = trash_content unless trash_content.nil?
43
50
  search_query[:mdfilters] = mdfilters unless mdfilters.nil?
@@ -45,23 +52,22 @@ module Boxr
45
52
  search_query[:limit] = limit unless limit.nil?
46
53
  search_query[:offset] = offset unless offset.nil?
47
54
 
48
- results, response = get(SEARCH_URI, query: search_query)
55
+ results, = get(SEARCH_URI, query: search_query)
49
56
  results.entries
50
57
  end
51
58
 
52
59
  private
53
60
 
54
61
  def build_date_range_field(from, to)
55
- from_string = from.nil? ? "" : from.to_datetime.rfc3339
56
- to_string = to.nil? ? "" : to.to_datetime.rfc3339
62
+ from_string = from.nil? ? '' : from.to_datetime.rfc3339
63
+ to_string = to.nil? ? '' : to.to_datetime.rfc3339
57
64
  build_range_string(from_string, to_string)
58
65
  end
59
66
 
60
67
  def build_size_range_field(lower, upper)
61
- lower_string = lower.nil? ? "" : lower.to_i
62
- upper_string = upper.nil? ? "" : upper.to_i
68
+ lower_string = lower.nil? ? '' : lower.to_i
69
+ upper_string = upper.nil? ? '' : upper.to_i
63
70
  build_range_string(lower_string, upper_string)
64
71
  end
65
-
66
72
  end
67
- end
73
+ end
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
4
  class Client
3
-
4
5
  def shared_item(shared_link, shared_link_password: nil)
5
6
  box_api_header = "shared_link=#{shared_link}"
6
- box_api_header += "&shared_link_password=#{shared_link_password}" unless shared_link_password.nil?
7
+ unless shared_link_password.nil?
8
+ box_api_header += "&shared_link_password=#{shared_link_password}"
9
+ end
7
10
 
8
- file_or_folder, response = get(SHARED_ITEMS_URI, box_api_header: box_api_header)
11
+ file_or_folder, = get(SHARED_ITEMS_URI, box_api_header: box_api_header)
9
12
  file_or_folder
10
13
  end
11
-
12
14
  end
13
- end
15
+ end
data/lib/boxr/tasks.rb CHANGED
@@ -1,33 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
4
  class Client
3
-
4
5
  def file_tasks(file, fields: [])
5
6
  file_id = ensure_id(file)
6
7
  uri = "#{FILES_URI}/#{file_id}/tasks"
7
8
  query = build_fields_query(fields, TASK_FIELDS_QUERY)
8
9
 
9
- tasks, response = get(uri, query: query)
10
+ tasks, = get(uri, query: query)
10
11
  tasks.entries
11
12
  end
12
13
 
13
14
  def create_task(file, action: :review, message: nil, due_at: nil)
14
15
  file_id = ensure_id(file)
15
- attributes = {item: {type: :file, id: file_id}}
16
+ attributes = { item: { type: :file, id: file_id } }
16
17
  attributes[:action] = action unless action.nil?
17
18
  attributes[:message] = message unless message.nil?
18
19
  attributes[:due_at] = due_at.to_datetime.rfc3339 unless due_at.nil?
19
20
 
20
- new_task, response = post(TASKS_URI, attributes)
21
+ new_task, = post(TASKS_URI, attributes)
21
22
  new_task
22
23
  end
23
24
 
24
25
  def task_from_id(task_id)
25
26
  task_id = ensure_id(task_id)
26
27
  uri = "#{TASKS_URI}/#{task_id}"
27
- task, response = get(uri)
28
+ task, = get(uri)
28
29
  task
29
30
  end
30
- alias :task :task_from_id
31
+ alias task task_from_id
31
32
 
32
33
  def update_task(task, action: :review, message: nil, due_at: nil)
33
34
  task_id = ensure_id(task)
@@ -37,48 +38,48 @@ module Boxr
37
38
  attributes[:message] = message unless message.nil?
38
39
  attributes[:due_at] = due_at.to_datetime.rfc3339 unless due_at.nil?
39
40
 
40
- task, response = put(uri, attributes)
41
+ task, = put(uri, attributes)
41
42
  task
42
43
  end
43
44
 
44
45
  def delete_task(task)
45
46
  task_id = ensure_id(task)
46
47
  uri = "#{TASKS_URI}/#{task_id}"
47
- result, response = delete(uri)
48
+ result, = delete(uri)
48
49
  result
49
50
  end
50
51
 
51
52
  def task_assignments(task)
52
53
  task_id = ensure_id(task)
53
54
  uri = "#{TASKS_URI}/#{task_id}/assignments"
54
- assignments, response = get(uri)
55
+ assignments, = get(uri)
55
56
  assignments['entries']
56
57
  end
57
58
 
58
59
  def create_task_assignment(task, assign_to: nil, assign_to_login: nil)
59
60
  task_id = ensure_id(task)
60
61
  assign_to_id = ensure_id(assign_to)
61
- attributes = {task: {type: :task, id: "#{task_id}"}}
62
-
63
- attributes[:assign_to] = {}
62
+ attributes = { task: { type: :task, id: task_id.to_s } }
63
+
64
+ attributes[:assign_to] = {}
64
65
  attributes[:assign_to][:login] = assign_to_login unless assign_to_login.nil?
65
66
  attributes[:assign_to][:id] = assign_to_id unless assign_to_id.nil?
66
67
 
67
- new_task_assignment, response = post(TASK_ASSIGNMENTS_URI, attributes)
68
+ new_task_assignment, = post(TASK_ASSIGNMENTS_URI, attributes)
68
69
  new_task_assignment
69
70
  end
70
71
 
71
72
  def task_assignment(task)
72
73
  task_id = ensure_id(task)
73
74
  uri = "#{TASK_ASSIGNMENTS_URI}/#{task_id}"
74
- task_assignment, response = get(uri)
75
+ task_assignment, = get(uri)
75
76
  task_assignment
76
77
  end
77
78
 
78
79
  def delete_task_assignment(task)
79
80
  task_id = ensure_id(task)
80
81
  uri = "#{TASK_ASSIGNMENTS_URI}/#{task_id}"
81
- result, response = delete(uri)
82
+ result, = delete(uri)
82
83
  result
83
84
  end
84
85
 
@@ -89,9 +90,8 @@ module Boxr
89
90
  attributes[:message] = message unless message.nil?
90
91
  attributes[:resolution_state] = resolution_state unless resolution_state.nil?
91
92
 
92
- updated_task, response = put(uri, attributes)
93
+ updated_task, = put(uri, attributes)
93
94
  updated_task
94
95
  end
95
-
96
96
  end
97
- end
97
+ end
data/lib/boxr/users.rb CHANGED
@@ -1,24 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
4
  class Client
3
-
4
5
  def current_user(fields: [])
5
6
  uri = "#{USERS_URI}/me"
6
7
  query = build_fields_query(fields, USER_FIELDS_QUERY)
7
8
 
8
- user, response = get(uri, query: query)
9
+ user, = get(uri, query: query)
9
10
  user
10
11
  end
11
- alias :me :current_user
12
+ alias me current_user
12
13
 
13
14
  def user_from_id(user_id, fields: [])
14
15
  user_id = ensure_id(user_id)
15
16
  uri = "#{USERS_URI}/#{user_id}"
16
17
  query = build_fields_query(fields, USER_FIELDS_QUERY)
17
18
 
18
- user, response = get(uri, query: query)
19
+ user, = get(uri, query: query)
19
20
  user
20
21
  end
21
- alias :user :user_from_id
22
+ alias user user_from_id
22
23
 
23
24
  def all_users(filter_term: nil, fields: [], offset: nil, limit: nil)
24
25
  uri = USERS_URI
@@ -26,25 +27,25 @@ module Boxr
26
27
  query[:filter_term] = filter_term unless filter_term.nil?
27
28
 
28
29
  if offset.nil? || limit.nil?
29
- users = get_all_with_pagination(uri, query: query, offset: 0, limit: DEFAULT_LIMIT)
30
+ get_all_with_pagination(uri, query: query, offset: 0, limit: DEFAULT_LIMIT)
30
31
  else
31
32
  query[:offset] = offset
32
33
  query[:limit] = limit
33
34
 
34
- users, response = get(uri, query: query)
35
+ users, = get(uri, query: query)
35
36
  users['entries']
36
37
  end
37
38
  end
38
39
 
39
40
  def create_user(name, login: nil, role: nil, language: nil, is_sync_enabled: nil, job_title: nil,
40
- phone: nil, address: nil, space_amount: nil, tracking_codes: nil,
41
- can_see_managed_users: nil, is_external_collab_restricted: nil, status: nil, timezone: nil,
42
- is_exempt_from_device_limits: nil, is_exempt_from_login_verification: nil,
43
- is_platform_access_only: nil)
44
-
41
+ phone: nil, address: nil, space_amount: nil, tracking_codes: nil,
42
+ can_see_managed_users: nil, is_external_collab_restricted: nil, status: nil, timezone: nil,
43
+ is_exempt_from_device_limits: nil, is_exempt_from_login_verification: nil,
44
+ is_platform_access_only: nil)
45
45
  uri = USERS_URI
46
- attributes = {name: name}
47
- attributes[:login] = login unless login.nil? #login is not required for platform users, so needed to make this optional
46
+ attributes = { name: name }
47
+ # login is not required for platform users, so needed to make this optional
48
+ attributes[:login] = login unless login.nil?
48
49
  attributes[:role] = role unless role.nil?
49
50
  attributes[:language] = language unless language.nil?
50
51
  attributes[:is_sync_enabled] = is_sync_enabled unless is_sync_enabled.nil?
@@ -54,28 +55,41 @@ module Boxr
54
55
  attributes[:space_amount] = space_amount unless space_amount.nil?
55
56
  attributes[:tracking_codes] = tracking_codes unless tracking_codes.nil?
56
57
  attributes[:can_see_managed_users] = can_see_managed_users unless can_see_managed_users.nil?
57
- attributes[:is_external_collab_restricted] = is_external_collab_restricted unless is_external_collab_restricted.nil?
58
+ unless is_external_collab_restricted.nil?
59
+ attributes[:is_external_collab_restricted] =
60
+ is_external_collab_restricted
61
+ end
58
62
  attributes[:status] = status unless status.nil?
59
63
  attributes[:timezone] = timezone unless timezone.nil?
60
- attributes[:is_exempt_from_device_limits] = is_exempt_from_device_limits unless is_exempt_from_device_limits.nil?
61
- attributes[:is_exempt_from_login_verification] = is_exempt_from_login_verification unless is_exempt_from_login_verification.nil?
62
- attributes[:is_platform_access_only] = is_platform_access_only unless is_platform_access_only.nil?
64
+ unless is_exempt_from_device_limits.nil?
65
+ attributes[:is_exempt_from_device_limits] =
66
+ is_exempt_from_device_limits
67
+ end
68
+ unless is_exempt_from_login_verification.nil?
69
+ attributes[:is_exempt_from_login_verification] =
70
+ is_exempt_from_login_verification
71
+ end
72
+ unless is_platform_access_only.nil?
73
+ attributes[:is_platform_access_only] =
74
+ is_platform_access_only
75
+ end
63
76
 
64
- new_user, response = post(uri, attributes)
77
+ new_user, = post(uri, attributes)
65
78
  new_user
66
79
  end
67
80
 
68
81
  def update_user(user, notify: nil, enterprise: true, name: nil, role: nil, language: nil, is_sync_enabled: nil,
69
- job_title: nil, phone: nil, address: nil, space_amount: nil, tracking_codes: nil,
70
- can_see_managed_users: nil, status: nil, timezone: nil, is_exempt_from_device_limits: nil,
71
- is_exempt_from_login_verification: nil, is_exempt_from_reset_required: nil, is_external_collab_restricted: nil)
72
-
82
+ job_title: nil, phone: nil, address: nil, space_amount: nil, tracking_codes: nil,
83
+ can_see_managed_users: nil, status: nil, timezone: nil, is_exempt_from_device_limits: nil,
84
+ is_exempt_from_login_verification: nil, is_exempt_from_reset_required: nil, is_external_collab_restricted: nil)
73
85
  user_id = ensure_id(user)
74
86
  uri = "#{USERS_URI}/#{user_id}"
75
- query = {notify: notify} unless notify.nil?
87
+ query = {}
88
+ query[:notify] = notify unless notify.nil?
76
89
 
77
90
  attributes = {}
78
- attributes[:enterprise] = nil if enterprise.nil? #this is a special condition where setting this to nil means to roll this user out of the enterprise
91
+ # this is a special condition where setting this to nil means to roll this user out of the enterprise
92
+ attributes[:enterprise] = nil if enterprise.nil?
79
93
  attributes[:name] = name unless name.nil?
80
94
  attributes[:role] = role unless role.nil?
81
95
  attributes[:language] = language unless language.nil?
@@ -88,12 +102,24 @@ module Boxr
88
102
  attributes[:can_see_managed_users] = can_see_managed_users unless can_see_managed_users.nil?
89
103
  attributes[:status] = status unless status.nil?
90
104
  attributes[:timezone] = timezone unless timezone.nil?
91
- attributes[:is_exempt_from_device_limits] = is_exempt_from_device_limits unless is_exempt_from_device_limits.nil?
92
- attributes[:is_exempt_from_login_verification] = is_exempt_from_login_verification unless is_exempt_from_login_verification.nil?
93
- attributes[:is_exempt_from_reset_required] = is_exempt_from_reset_required unless is_exempt_from_reset_required.nil?
94
- attributes[:is_external_collab_restricted] = is_external_collab_restricted unless is_external_collab_restricted.nil?
105
+ unless is_exempt_from_device_limits.nil?
106
+ attributes[:is_exempt_from_device_limits] =
107
+ is_exempt_from_device_limits
108
+ end
109
+ unless is_exempt_from_login_verification.nil?
110
+ attributes[:is_exempt_from_login_verification] =
111
+ is_exempt_from_login_verification
112
+ end
113
+ unless is_exempt_from_reset_required.nil?
114
+ attributes[:is_exempt_from_reset_required] =
115
+ is_exempt_from_reset_required
116
+ end
117
+ unless is_external_collab_restricted.nil?
118
+ attributes[:is_external_collab_restricted] =
119
+ is_external_collab_restricted
120
+ end
95
121
 
96
- updated_user, response = put(uri, attributes, query: query)
122
+ updated_user, = put(uri, attributes, query: query)
97
123
  updated_user
98
124
  end
99
125
 
@@ -104,7 +130,7 @@ module Boxr
104
130
  query[:notify] = notify unless notify.nil?
105
131
  query[:force] = force unless force.nil?
106
132
 
107
- result, response = delete(uri, query: query)
133
+ result, = delete(uri, query: query)
108
134
  result
109
135
  end
110
136
 
@@ -114,9 +140,9 @@ module Boxr
114
140
  destination_user_id = ensure_id(destination_user)
115
141
  source_folder_id = ensure_id(source_folder)
116
142
  uri = "#{USERS_URI}/#{user_id}/folders/#{source_folder_id}"
117
- attributes = {owned_by: {id: destination_user_id}}
143
+ attributes = { owned_by: { id: destination_user_id } }
118
144
 
119
- folder, response = put(uri, attributes)
145
+ folder, = put(uri, attributes)
120
146
  folder
121
147
  end
122
148
 
@@ -124,16 +150,16 @@ module Boxr
124
150
  user_id = ensure_id(user)
125
151
  uri = "#{USERS_URI}/#{user_id}/email_aliases"
126
152
 
127
- aliases, response = get(uri)
153
+ aliases, = get(uri)
128
154
  aliases['entries']
129
155
  end
130
156
 
131
157
  def add_email_alias_for_user(user, email)
132
158
  user_id = ensure_id(user)
133
159
  uri = "#{USERS_URI}/#{user_id}/email_aliases"
134
- attributes = {email: email}
160
+ attributes = { email: email }
135
161
 
136
- updated_user, response = post(uri, attributes)
162
+ updated_user, = post(uri, attributes)
137
163
  updated_user
138
164
  end
139
165
 
@@ -142,9 +168,8 @@ module Boxr
142
168
  email_alias_id = ensure_id(email_alias)
143
169
  uri = "#{USERS_URI}/#{user_id}/email_aliases/#{email_alias_id}"
144
170
 
145
- result, response = delete(uri)
171
+ result, = delete(uri)
146
172
  result
147
173
  end
148
-
149
174
  end
150
175
  end
data/lib/boxr/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
- VERSION = "1.22.0".freeze
4
+ VERSION = '1.23.0'
3
5
  end
@@ -1,66 +1,59 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Boxr
2
4
  class Client
3
-
4
5
  def get_watermark_on_file(file)
5
-
6
6
  file_id = ensure_id(file)
7
7
  uri = "#{FILES_URI}/#{file_id}/watermark"
8
8
 
9
- file, response = get(uri)
9
+ file, = get(uri)
10
10
  file
11
11
  end
12
12
 
13
13
  def apply_watermark_on_file(file)
14
-
15
14
  file_id = ensure_id(file)
16
15
  uri = "#{FILES_URI}/#{file_id}/watermark"
17
16
 
18
17
  attributes = {}
19
- attributes[:watermark] = {:imprint => "default"}
18
+ attributes[:watermark] = { imprint: 'default' }
20
19
 
21
- file, response = put(uri, attributes, content_type: "application/json")
20
+ file, = put(uri, attributes, content_type: 'application/json')
22
21
  file
23
22
  end
24
23
 
25
24
  def remove_watermark_on_file(file)
26
-
27
25
  file_id = ensure_id(file)
28
26
  uri = "#{FILES_URI}/#{file_id}/watermark"
29
27
 
30
- result, response = delete(uri)
28
+ result, = delete(uri)
31
29
  result
32
30
  end
33
31
 
34
32
  def get_watermark_on_folder(folder)
35
-
36
33
  folder_id = ensure_id(folder)
37
34
  uri = "#{FOLDERS_URI}/#{folder_id}/watermark"
38
35
 
39
- folder, response = get(uri)
36
+ folder, = get(uri)
40
37
  folder
41
38
  end
42
39
 
43
40
  def apply_watermark_on_folder(folder)
44
-
45
41
  folder_id = ensure_id(folder)
46
42
  uri = "#{FOLDERS_URI}/#{folder_id}/watermark"
47
43
 
48
44
  attributes = {}
49
- attributes[:watermark] = {:imprint => "default"}
45
+ attributes[:watermark] = { imprint: 'default' }
50
46
 
51
- folder, response = put(uri, attributes, content_type: "application/json")
47
+ folder, = put(uri, attributes, content_type: 'application/json')
52
48
  folder
53
49
  end
54
50
 
55
51
  def remove_watermark_on_folder(folder)
56
-
57
52
  folder_id = ensure_id(folder)
58
53
  uri = "#{FOLDERS_URI}/#{folder_id}/watermark"
59
54
 
60
- result, response = delete(uri)
55
+ result, = delete(uri)
61
56
  result
62
57
  end
63
-
64
-
65
58
  end
66
59
  end