boxr 1.19.0 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +6 -0
- data/README.md +9 -0
- data/boxr.gemspec +6 -5
- data/lib/boxr/auth.rb +3 -1
- data/lib/boxr/client.rb +1 -0
- data/lib/boxr/version.rb +1 -1
- data/lib/boxr/zip_downloads.rb +14 -0
- data/lib/boxr.rb +1 -0
- metadata +28 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 533074dd768a58f5d07c2018af0fb6bcbdc609b580dc2d645f2547419cbcbbf8
|
4
|
+
data.tar.gz: 7f70218ebdad46163c96bb8a1a314230aa01da161f8d137cf4e96fb9ba925103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfc53303a5bad816089dcfb65b2b9b7e9b1d39a816d2a7b8f4a2af3d7638984696dff3d6ed0712afcbf8cc766fc73e3d9ecd6c4b2b7b07dd16a716bb9ba860b5
|
7
|
+
data.tar.gz: a5f58b2d5bfe960d9b46c564576abda03f9bb6d2eaa7e8dc1afa969501c211dea3ecb77ec28752be09c65fa75b02ffcb023bd80ee679999317d2e614b39887e6
|
data/.env.example
CHANGED
@@ -7,6 +7,10 @@
|
|
7
7
|
#7. copy and paste the client id and client secret of your Box app below
|
8
8
|
#8. save this file as .env
|
9
9
|
|
10
|
+
# You will need to create two custom apps for testing. One of them will be a JWT app
|
11
|
+
# and the other will be a server authentication app. The server authentication app
|
12
|
+
# credentials will be used to test the client credentials grant
|
13
|
+
|
10
14
|
BOX_DEVELOPER_TOKEN={a valid developer token for your Box app}
|
11
15
|
BOX_CLIENT_ID={client id of your Box app}
|
12
16
|
BOX_CLIENT_SECRET={client secret of your Box app}
|
@@ -15,3 +19,5 @@ JWT_PRIVATE_KEY_PATH={path to your JWT private key}
|
|
15
19
|
JWT_PRIVATE_KEY_PASSWORD={JWT private key password}
|
16
20
|
BOX_PRIMARY_SIGNATURE_KEY={primary key for webhooks}
|
17
21
|
BOX_SECONDARY_SIGNATURE_KEY={secondary key for webhooks}
|
22
|
+
BOX_OAUTH_CLIENT_ID={client_id for your server authentication app}
|
23
|
+
BOX_OAUTH_CLIENT_SECRET={client_secret for your server authentication app}
|
data/README.md
CHANGED
@@ -499,6 +499,15 @@ Boxr::WebhookValidator.new(
|
|
499
499
|
|
500
500
|
```
|
501
501
|
|
502
|
+
#### [Zip Downloads](https://developer.box.com/reference/resources/zip-download/)
|
503
|
+
```ruby
|
504
|
+
# Requests creation of zip archive
|
505
|
+
# Returns a download_url and a status_url that can be used to download the archive.
|
506
|
+
#
|
507
|
+
# Example: create_zip_download([{ id: '1', type: 'file' }, { id: '2', type: 'folder' }])
|
508
|
+
create_zip_download(items, download_file_name: nil)
|
509
|
+
```
|
510
|
+
|
502
511
|
## Contributing
|
503
512
|
|
504
513
|
1. Fork it ( https://github.com/cburnette/boxr/fork )
|
data/boxr.gemspec
CHANGED
@@ -20,17 +20,18 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~>
|
24
|
-
spec.add_development_dependency "rake", "~>
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.3"
|
24
|
+
spec.add_development_dependency "rake", "~> 13.1"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.1"
|
26
26
|
spec.add_development_dependency "simplecov", "~> 0.9"
|
27
|
-
spec.add_development_dependency "dotenv", "~>
|
27
|
+
spec.add_development_dependency "dotenv", "~> 2.8"
|
28
28
|
spec.add_development_dependency "awesome_print", "~> 1.8"
|
29
|
-
spec.add_development_dependency "lru_redux", "~>
|
29
|
+
spec.add_development_dependency "lru_redux", "~> 1.1"
|
30
30
|
spec.add_development_dependency "parallel", "~> 1.0"
|
31
|
+
spec.add_development_dependency "rubyzip", "~> 2.3"
|
31
32
|
|
32
33
|
spec.add_runtime_dependency "httpclient", "~> 2.8"
|
33
34
|
spec.add_runtime_dependency "hashie", ">= 3.5", "< 6"
|
34
|
-
spec.add_runtime_dependency "addressable", "~> 2.
|
35
|
+
spec.add_runtime_dependency "addressable", "~> 2.8"
|
35
36
|
spec.add_runtime_dependency "jwt", ">= 1.4", "< 3"
|
36
37
|
end
|
data/lib/boxr/auth.rb
CHANGED
@@ -15,13 +15,15 @@ module Boxr
|
|
15
15
|
uri
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.get_tokens(code=nil, grant_type: "authorization_code", assertion: nil, scope: nil, username: nil, client_id: ENV['BOX_CLIENT_ID'], client_secret: ENV['BOX_CLIENT_SECRET'])
|
18
|
+
def self.get_tokens(code=nil, grant_type: "authorization_code", assertion: nil, scope: nil, username: nil, client_id: ENV['BOX_CLIENT_ID'], client_secret: ENV['BOX_CLIENT_SECRET'], box_subject_type: nil, box_subject_id: nil)
|
19
19
|
uri = Boxr::Client::AUTH_URI
|
20
20
|
body = "grant_type=#{grant_type}&client_id=#{client_id}&client_secret=#{client_secret}"
|
21
21
|
body = body + "&code=#{code}" unless code.nil?
|
22
22
|
body = body + "&scope=#{scope}" unless scope.nil?
|
23
23
|
body = body + "&username=#{username}" unless username.nil?
|
24
24
|
body = body + "&assertion=#{assertion}" unless assertion.nil?
|
25
|
+
body = body + "&box_subject_type=#{box_subject_type}" unless box_subject_type.nil?
|
26
|
+
body = body + "&box_subject_id=#{box_subject_id}" unless box_subject_id.nil?
|
25
27
|
|
26
28
|
auth_post(uri, body)
|
27
29
|
end
|
data/lib/boxr/client.rb
CHANGED
data/lib/boxr/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boxr
|
4
|
+
class Client
|
5
|
+
def create_zip_download(targets, download_file_name: nil)
|
6
|
+
attributes = {
|
7
|
+
download_file_name: download_file_name,
|
8
|
+
items: targets
|
9
|
+
}
|
10
|
+
zip_download, _response = post(ZIP_DOWNLOADS_URI, attributes, success_codes: [200, 202])
|
11
|
+
zip_download
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/boxr.rb
CHANGED
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: 1.
|
4
|
+
version: 1.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Burnette
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.3'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2.3'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '13.1'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '13.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '2.8'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '2.8'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: awesome_print
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,14 +101,14 @@ dependencies:
|
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
104
|
+
version: '1.1'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
111
|
+
version: '1.1'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: parallel
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +123,20 @@ dependencies:
|
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '1.0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubyzip
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '2.3'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '2.3'
|
126
140
|
- !ruby/object:Gem::Dependency
|
127
141
|
name: httpclient
|
128
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,14 +177,14 @@ dependencies:
|
|
163
177
|
requirements:
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: '2.
|
180
|
+
version: '2.8'
|
167
181
|
type: :runtime
|
168
182
|
prerelease: false
|
169
183
|
version_requirements: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: '2.
|
187
|
+
version: '2.8'
|
174
188
|
- !ruby/object:Gem::Dependency
|
175
189
|
name: jwt
|
176
190
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,6 +255,7 @@ files:
|
|
241
255
|
- lib/boxr/web_links.rb
|
242
256
|
- lib/boxr/webhook_validator.rb
|
243
257
|
- lib/boxr/webhooks.rb
|
258
|
+
- lib/boxr/zip_downloads.rb
|
244
259
|
homepage: https://github.com/cburnette/boxr
|
245
260
|
licenses:
|
246
261
|
- MIT
|
@@ -260,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
275
|
- !ruby/object:Gem::Version
|
261
276
|
version: '0'
|
262
277
|
requirements: []
|
263
|
-
rubygems_version: 3.
|
278
|
+
rubygems_version: 3.1.6
|
264
279
|
signing_key:
|
265
280
|
specification_version: 4
|
266
281
|
summary: A Ruby client library for the Box V2 Content API.
|