boxr 1.19.0 → 1.21.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: 533074dd768a58f5d07c2018af0fb6bcbdc609b580dc2d645f2547419cbcbbf8
4
+ data.tar.gz: 7f70218ebdad46163c96bb8a1a314230aa01da161f8d137cf4e96fb9ba925103
5
5
  SHA512:
6
- metadata.gz: f254ec12207c54482a3e06870a07f70c570d1dc9e8f2e30f4ff0ea3e8114185450d38b9fb99b3a2fd94bd57c9497ccfd32c79a26a2b0380a90b8a7c4a2e675ca
7
- data.tar.gz: 54db201675a4c45944f7e592639f819af97b3102b080c2149684455a2938bf18839d4a9109a8e62e8e838e9cd024cf375cf5e9baff86984723ac96a580840f05
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", "~> 1.6"
24
- spec.add_development_dependency "rake", "~> 10.0"
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", "~> 0.11"
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", "~> 0.8"
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.3"
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
@@ -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.21.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.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: 2022-01-05 00:00:00.000000000 Z
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: '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
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
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: '10.0'
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: '0.11'
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: '0.11'
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: '0.8'
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: '0.8'
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.3'
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.3'
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.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.