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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f6b8f2bce035186870e3cddbfe09fb78e6196e1d702a5dfa5cf27a92375b610
4
- data.tar.gz: e929906cfba8506d72df7bbb37efa782a84e1890dbf75b0a08798ac0ab3fddf1
3
+ metadata.gz: bc9199475be8f2f434b78c3e9f97235a81070d0feb4ebd194816ba5fe6f78bfb
4
+ data.tar.gz: d758a7ada5f0761da42c8dff7accb946ad8567b19c0aa0e5b970d082d8a7ca34
5
5
  SHA512:
6
- metadata.gz: f254ec12207c54482a3e06870a07f70c570d1dc9e8f2e30f4ff0ea3e8114185450d38b9fb99b3a2fd94bd57c9497ccfd32c79a26a2b0380a90b8a7c4a2e675ca
7
- data.tar.gz: 54db201675a4c45944f7e592639f819af97b3102b080c2149684455a2938bf18839d4a9109a8e62e8e838e9cd024cf375cf5e9baff86984723ac96a580840f05
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", "~> 1.6"
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
@@ -30,6 +30,7 @@ module Boxr
30
30
  EVENTS_URI = "#{API_URI}/events"
31
31
  WEB_LINKS_URI = "#{API_URI}/web_links"
32
32
  WEBHOOKS_URI = "#{API_URI}/webhooks"
33
+ ZIP_DOWNLOADS_URI = "#{API_URI}/zip_downloads"
33
34
 
34
35
  DEFAULT_LIMIT = 100
35
36
  FOLDER_ITEMS_LIMIT = 1000
data/lib/boxr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "1.19.0".freeze
2
+ VERSION = "1.20.0".freeze
3
3
  end
@@ -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
@@ -26,6 +26,7 @@ require 'boxr/web_links'
26
26
  require 'boxr/watermarking'
27
27
  require 'boxr/webhooks'
28
28
  require 'boxr/webhook_validator'
29
+ require 'boxr/zip_downloads'
29
30
 
30
31
  class BoxrCollection < Array
31
32
  def files
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.19.0
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: 2022-01-05 00:00:00.000000000 Z
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: '1.6'
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: '1.6'
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.2.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.