files.com 1.0.66 → 1.0.67

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
  SHA256:
3
- metadata.gz: 7e4a2bc035d0e4d4e0f653c54d0b5e78a6b10a2976ae0d002dd88ce76b55c414
4
- data.tar.gz: 3d8337b9ee382d61c0d63a279b25cccc72e785c52af0e99604e2171ce659eafa
3
+ metadata.gz: ad3dc40bcbf022324c5002a75477568d213893b79d0f0e2538a3f48720bc6135
4
+ data.tar.gz: 3f4b7093d51bb6ea3da0b8cfee2266f32a0b0f3570ae481c7b28c4241a68180a
5
5
  SHA512:
6
- metadata.gz: 3035d31c71891d53be25324ac06d26d92ecced24ab73574cbb2b73786b3f25666d07a06d6589a1363daf289d87dea93c3f2dabfd05ac652d061050d18974da25
7
- data.tar.gz: d6fcd3f9394bf481cb94dfddbcc0c92a3e5cb68c6673632dff2a4557f1fe396206a563fba5b38ad53798d14479ec3453c6e9b84b17f205d8cbcc8ea60d01ae23
6
+ metadata.gz: cd13285ed3725855ed062d740e3b16b8eb073f864fd8d6f93f70a80f23c237d44d84233e3e7f6c70618b862164f9ee4eb068a76d59a4153ea1373ef0dc6d4dec
7
+ data.tar.gz: c6d134d8fa1c968537db4c738bae87e15c8518a8440d7a253638f9bd73782464647405c54f9b8978f7f04dfeded4f1feef0bdffc5f68a9720fb10e01f6d45014
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.66
1
+ 1.0.67
@@ -8,4 +8,4 @@
8
8
  }
9
9
  ```
10
10
 
11
- * `dynamic` (object): Additional data
11
+ * `dynamic` (object):
@@ -105,7 +105,9 @@ Files::Behavior.create(
105
105
  Files::Behavior.webhook_test(
106
106
  url: "https://www.site.com/...",
107
107
  method: "GET",
108
- encoding: "RAW"
108
+ encoding: "RAW",
109
+ headers: "x-test-header => testvalue",
110
+ body: "test-param => testvalue"
109
111
  )
110
112
  ```
111
113
 
@@ -114,6 +116,8 @@ Files::Behavior.webhook_test(
114
116
  * `url` (string): Required - URL for testing the webhook.
115
117
  * `method` (string): HTTP method(GET or POST).
116
118
  * `encoding` (string): HTTP encoding method. Can be JSON, XML, or RAW (form data).
119
+ * `headers` (object): Additional request headers.
120
+ * `body` (object): Additional body parameters.
117
121
 
118
122
 
119
123
  ---
@@ -4,21 +4,25 @@
4
4
 
5
5
  ```
6
6
  {
7
- "name": "My Group",
8
- "id": 1,
7
+ "group_name": "My Group",
8
+ "group_id": 1,
9
+ "user_id": 1,
9
10
  "admin": true,
10
11
  "usernames": [
11
12
 
12
- ]
13
+ ],
14
+ "name": "",
15
+ "id": ""
13
16
  }
14
17
  ```
15
18
 
16
- * `name` (string): Group name
17
- * `id` (int64): Group ID
19
+ * `group_name` (string): Group name
20
+ * `group_id` (int64): Group ID
21
+ * `user_id` (int64): User ID
18
22
  * `admin` (boolean): Is this user an administrator of this group?
19
23
  * `usernames` (array): A list of usernames for users in this group
20
- * `group_id` (int64): Group ID to add user to.
21
- * `user_id` (int64): User ID to add to group.
24
+ * `name` (string):
25
+ * `id` (string):
22
26
 
23
27
 
24
28
  ---
@@ -36,11 +40,11 @@ Files::GroupUser.list(
36
40
 
37
41
  ### Parameters
38
42
 
39
- * `user_id` (int64): User ID. If provided, will return groups of which this user is a member.
43
+ * `user_id` (int64): User ID. If provided, will return group_users of this user.
40
44
  * `page` (int64): Current page number.
41
45
  * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
42
46
  * `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
43
- * `group_id` (int64): Group ID. If provided, will return members of this group.
47
+ * `group_id` (int64): Group ID. If provided, will return group_users of this group.
44
48
 
45
49
 
46
50
  ---
@@ -4,7 +4,9 @@
4
4
 
5
5
  ```
6
6
  {
7
- "protocol": "okta",
7
+ "protocol": [
8
+
9
+ ],
8
10
  "provider": "okta",
9
11
  "label": "My Corporate SSO Provider",
10
12
  "logo_url": "https://mysite.files.com/.../logo.png",
@@ -38,13 +40,12 @@
38
40
  "ldap_host_3": "ldap3.site.com",
39
41
  "ldap_port": 1,
40
42
  "ldap_secure": true,
41
- "ldap_user_include_groups": "",
42
43
  "ldap_username": "[ldap username]",
43
44
  "ldap_username_field": "sAMAccountName"
44
45
  }
45
46
  ```
46
47
 
47
- * `protocol` (string): SSO Protocol
48
+ * `protocol` (array): SSO Protocol
48
49
  * `provider` (string): Provider name
49
50
  * `label` (string): Custom label for the SSO provider on the login page.
50
51
  * `logo_url` (string): URL holding a custom logo for the SSO provider on the login page.
@@ -78,7 +79,6 @@
78
79
  * `ldap_host_3` (string): LDAP backup host
79
80
  * `ldap_port` (int64): LDAP port
80
81
  * `ldap_secure` (boolean): Use secure LDAP?
81
- * `ldap_user_include_groups` (string): Comma or newline separated list of group names (with optional wildcards) - if provided, only users in these groups will be added or synced.
82
82
  * `ldap_username` (string): Username for signing in to LDAP server.
83
83
  * `ldap_username_field` (string): LDAP username field
84
84
 
@@ -17,5 +17,5 @@
17
17
  * `code` (int64): Status http code
18
18
  * `message` (string): Error message
19
19
  * `status` (string): Status message
20
- * `data`:
20
+ * `data`: Additional data
21
21
  * `errors` (array): A list of api errors
@@ -132,6 +132,8 @@ Files::User.list(
132
132
  * `q[password_validity_days]` (string): If set, list only users with overridden password validity days setting.
133
133
  * `q[ssl_required]` (string): If set, list only users with overridden SSL required setting.
134
134
  * `search` (string): Searches for partial matches of name, username, or email.
135
+ * `sort_by[last_login_at]` (string): If set, sort users by 'last_login_at' in either 'asc' or 'desc' direction
136
+ * `sort_by[authenticate_until]` (string): If set, sort users by 'authenticate_until' in either 'asc' or 'desc' direction
135
137
 
136
138
 
137
139
  ---
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_dependency 'faraday', ">= 1.0.1"
15
15
  s.add_dependency 'net-http-persistent'
16
16
  s.add_dependency 'addressable', ">= 2.7.0"
17
+ s.add_dependency 'concurrent-ruby', ">= 1.1.6"
17
18
 
18
19
  s.files = `find *`.split("\n").uniq.sort.reject(&:empty?)
19
20
  s.executables = [ "files", "files-console" ]
@@ -11,11 +11,13 @@ require "set"
11
11
  require "socket"
12
12
  require "uri"
13
13
  require "addressable/uri"
14
+ require "concurrent/promise"
14
15
 
15
16
  $LOAD_PATH.push __dir__
16
17
 
17
18
  require "files.com/version"
18
19
 
20
+ require "files.com/sizable_io"
19
21
  require "files.com/api"
20
22
  require "files.com/api_client"
21
23
  require "files.com/errors"
@@ -146,13 +146,19 @@ module Files
146
146
 
147
147
  def stream_download(uri, io)
148
148
  if conn.adapter == Faraday::Adapter::NetHttp
149
- remote_request(:get, uri) do |req|
150
- req.options.on_data = proc do |chunk, _overall_received_bytes|
151
- io.write(chunk.encode!)
149
+ uri = URI(uri)
150
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
151
+ request = Net::HTTP::Get.new uri
152
+ http.request request do |response|
153
+ io.fulfill_content_length(response.content_length) if io.respond_to?(:fulfill_content_length)
154
+ response.read_body do |chunk|
155
+ io << chunk.encode!
156
+ end
152
157
  end
153
158
  end
154
159
  else
155
160
  response = remote_request(:get, uri)
161
+ io.fulfill_content_length(response.content_length) if io.respond_to?(:fulfill_content_length)
156
162
  io.write(response.body)
157
163
  end
158
164
  end
@@ -9,7 +9,7 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
- # object - Additional data
12
+ # object
13
13
  def dynamic
14
14
  @attributes[:dynamic]
15
15
  end
@@ -175,10 +175,14 @@ module Files
175
175
  # url (required) - string - URL for testing the webhook.
176
176
  # method - string - HTTP method(GET or POST).
177
177
  # encoding - string - HTTP encoding method. Can be JSON, XML, or RAW (form data).
178
+ # headers - object - Additional request headers.
179
+ # body - object - Additional body parameters.
178
180
  def self.webhook_test(params = {}, options = {})
179
181
  raise InvalidParameterError.new("Bad parameter: url must be an String") if params.dig(:url) and !params.dig(:url).is_a?(String)
180
182
  raise InvalidParameterError.new("Bad parameter: method must be an String") if params.dig(:method) and !params.dig(:method).is_a?(String)
181
183
  raise InvalidParameterError.new("Bad parameter: encoding must be an String") if params.dig(:encoding) and !params.dig(:encoding).is_a?(String)
184
+ raise InvalidParameterError.new("Bad parameter: headers must be an Hash") if params.dig(:headers) and !params.dig(:headers).is_a?(Hash)
185
+ raise InvalidParameterError.new("Bad parameter: body must be an Hash") if params.dig(:body) and !params.dig(:body).is_a?(Hash)
182
186
  raise MissingParameterError.new("Parameter missing: url") unless params.dig(:url)
183
187
 
184
188
  response, _options = Api.send_request("/behaviors/webhook/test", :post, params, options)
@@ -389,7 +389,7 @@ module Files
389
389
 
390
390
  def read_io
391
391
  @read_io ||= begin
392
- r, w = IO.pipe
392
+ r, w = SizableIO.pipe
393
393
  Thread.new do
394
394
  download_content(w)
395
395
  ensure
@@ -10,21 +10,30 @@ module Files
10
10
  end
11
11
 
12
12
  # string - Group name
13
- def name
14
- @attributes[:name]
13
+ def group_name
14
+ @attributes[:group_name]
15
15
  end
16
16
 
17
- def name=(value)
18
- @attributes[:name] = value
17
+ def group_name=(value)
18
+ @attributes[:group_name] = value
19
19
  end
20
20
 
21
21
  # int64 - Group ID
22
- def id
23
- @attributes[:id]
22
+ def group_id
23
+ @attributes[:group_id]
24
24
  end
25
25
 
26
- def id=(value)
27
- @attributes[:id] = value
26
+ def group_id=(value)
27
+ @attributes[:group_id] = value
28
+ end
29
+
30
+ # int64 - User ID
31
+ def user_id
32
+ @attributes[:user_id]
33
+ end
34
+
35
+ def user_id=(value)
36
+ @attributes[:user_id] = value
28
37
  end
29
38
 
30
39
  # boolean - Is this user an administrator of this group?
@@ -45,22 +54,22 @@ module Files
45
54
  @attributes[:usernames] = value
46
55
  end
47
56
 
48
- # int64 - Group ID to add user to.
49
- def group_id
50
- @attributes[:group_id]
57
+ # string
58
+ def name
59
+ @attributes[:name]
51
60
  end
52
61
 
53
- def group_id=(value)
54
- @attributes[:group_id] = value
62
+ def name=(value)
63
+ @attributes[:name] = value
55
64
  end
56
65
 
57
- # int64 - User ID to add to group.
58
- def user_id
59
- @attributes[:user_id]
66
+ # string
67
+ def id
68
+ @attributes[:id]
60
69
  end
61
70
 
62
- def user_id=(value)
63
- @attributes[:user_id] = value
71
+ def id=(value)
72
+ @attributes[:id] = value
64
73
  end
65
74
 
66
75
  # Parameters:
@@ -100,11 +109,11 @@ module Files
100
109
  end
101
110
 
102
111
  # Parameters:
103
- # user_id - int64 - User ID. If provided, will return groups of which this user is a member.
112
+ # user_id - int64 - User ID. If provided, will return group_users of this user.
104
113
  # page - int64 - Current page number.
105
114
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
106
115
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
107
- # group_id - int64 - Group ID. If provided, will return members of this group.
116
+ # group_id - int64 - Group ID. If provided, will return group_users of this group.
108
117
  def self.list(params = {}, options = {})
109
118
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
110
119
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
@@ -9,7 +9,7 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
- # string - SSO Protocol
12
+ # array - SSO Protocol
13
13
  def protocol
14
14
  @attributes[:protocol]
15
15
  end
@@ -179,11 +179,6 @@ module Files
179
179
  @attributes[:ldap_secure]
180
180
  end
181
181
 
182
- # string - Comma or newline separated list of group names (with optional wildcards) - if provided, only users in these groups will be added or synced.
183
- def ldap_user_include_groups
184
- @attributes[:ldap_user_include_groups]
185
- end
186
-
187
182
  # string - Username for signing in to LDAP server.
188
183
  def ldap_username
189
184
  @attributes[:ldap_username]
@@ -24,6 +24,7 @@ module Files
24
24
  @attributes[:status]
25
25
  end
26
26
 
27
+ # Additional data
27
28
  def data
28
29
  @attributes[:data]
29
30
  end
@@ -612,6 +612,8 @@ module Files
612
612
  # q[password_validity_days] - string - If set, list only users with overridden password validity days setting.
613
613
  # q[ssl_required] - string - If set, list only users with overridden SSL required setting.
614
614
  # search - string - Searches for partial matches of name, username, or email.
615
+ # sort_by[last_login_at] - string - If set, sort users by 'last_login_at' in either 'asc' or 'desc' direction
616
+ # sort_by[authenticate_until] - string - If set, sort users by 'authenticate_until' in either 'asc' or 'desc' direction
615
617
  def self.list(params = {}, options = {})
616
618
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
617
619
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
@@ -0,0 +1,32 @@
1
+ module Files
2
+ class SizableIO < IO
3
+ def self.pipe
4
+ r, w = super
5
+
6
+ w.instance_variable_set(:@read_io, r)
7
+
8
+ [r, w]
9
+ end
10
+
11
+ def size
12
+ read_io.content_length_promise.wait.value
13
+ end
14
+
15
+ def fulfill_content_length(length)
16
+ read_io.content_length = length
17
+ read_io.content_length_promise.execute
18
+ end
19
+
20
+ protected
21
+
22
+ attr_accessor :content_length
23
+
24
+ def content_length_promise
25
+ @content_length_promise ||= Concurrent::Promise.new { content_length }
26
+ end
27
+
28
+ def read_io
29
+ @read_io || self
30
+ end
31
+ end
32
+ end
@@ -24,8 +24,9 @@ RSpec.describe Files::File, :with_test_folder do
24
24
 
25
25
  it "returns an IO Object" do
26
26
  file = Files::File.find(test_folder.join("read.txt").to_s, {}, options)
27
- expect(file.read_io.class).to eq(IO)
27
+ expect(file.read_io).to be_a_kind_of(IO)
28
28
  expect(file.read_io.read).to eq("contents")
29
+ expect(file.read_io.size).to eq("contents".length)
29
30
  end
30
31
  end
31
32
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.66
4
+ version: 1.0.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-11 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.6
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.6
55
69
  description: The Files.com Ruby client.
56
70
  email:
57
71
  - support@files.com
@@ -173,6 +187,7 @@ files:
173
187
  - lib/files.com/models/user.rb
174
188
  - lib/files.com/models/user_cipher_use.rb
175
189
  - lib/files.com/response.rb
190
+ - lib/files.com/sizable_io.rb
176
191
  - lib/files.com/system_profiler.rb
177
192
  - lib/files.com/util.rb
178
193
  - lib/files.com/version.rb