boxr 1.19.0 → 1.20.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/.env.example +6 -0
- data/README.md +9 -0
- data/boxr.gemspec +2 -1
- 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 +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc9199475be8f2f434b78c3e9f97235a81070d0feb4ebd194816ba5fe6f78bfb
|
4
|
+
data.tar.gz: d758a7ada5f0761da42c8dff7accb946ad8567b19c0aa0e5b970d082d8a7ca34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 343eac2cc180333da53e939e584c0beccd21a4ed0a72ef46f6a208f11c782fc35646ba7af14979789f4de541aeebd96a2a70db352944278ba8dc8ef44e791aef
|
7
|
+
data.tar.gz: 21f27d4284e8b713e10a8cf1a97b4929b946aca1c64452baebd50c1bbe4516a60cfcbe1fa9a7e2dbd03593c87bbb635bde380143fb63d298a4c7c8155a45645d
|
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,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~>
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.3"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.1"
|
26
26
|
spec.add_development_dependency "simplecov", "~> 0.9"
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "awesome_print", "~> 1.8"
|
29
29
|
spec.add_development_dependency "lru_redux", "~> 0.8"
|
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"
|
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.20.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-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,14 +17,14 @@ 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
|
@@ -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
|
@@ -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.
|