boxr 0.10.0 → 0.11.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
  SHA1:
3
- metadata.gz: 899e4b38f5025cfbd597d3e73efb4779befd1677
4
- data.tar.gz: 4ce61c545bb2b7c1634b2a4dc7a44ab30a045a94
3
+ metadata.gz: cc55f67539d8e74fff66d7516fd9f4cc8cd2dbdb
4
+ data.tar.gz: bfaf437be6e34775e61bc9c4144740b7fa467c1f
5
5
  SHA512:
6
- metadata.gz: c84ac5f3451d2bd13c25e27a6c9dd31ed8d9c5a58b95adfce1207cd819fba7f254ec8183aab5712ba4e01adc32cdfdbdca12b2c1a2199af7061d09ec8acd246d
7
- data.tar.gz: eea9cbf4af775f0ec27dc851811571ac5b183690148ff6f818ec25772792e31e45cf2e3c3a386a67e7864f3908126214067d6fb275fd9643ca10edc90b15608b
6
+ metadata.gz: 53a31ddf944b164e2363718f7308dd0ac061d7132a8707035b40a79f1382852e3442230aa91e530dce0d4384cb92fb9abea576b3e613f9a7d0f136ebebf06bfc
7
+ data.tar.gz: 048c73b9ab455c0ac31d02cffe20903054c9c30801a1c7654dde42feb46d3520a8ff3a3e64b8afff99417414fcd36a4249d4fcf430ddf29870dd4162ba0427a2
data/README.md CHANGED
@@ -93,6 +93,18 @@ puts "Shared Link: #{file.shared_link.url}"
93
93
  ```
94
94
 
95
95
  ### Methods
96
+ #### [OAuth](https://developers.box.com/docs/#oauth-2)
97
+ ```ruby
98
+ #NOTE: these are all module methods
99
+
100
+ Boxr::oauth_url(state, response_type: "code", scope: nil, folder_id: nil, box_client_id: ENV['BOX_CLIENT_ID'])
101
+
102
+ Boxr::get_tokens(code, grant_type: "authorization_code", username: nil, box_client_id: ENV['BOX_CLIENT_ID'], box_client_secret: ENV['BOX_CLIENT_SECRET'])
103
+
104
+ Boxr::refresh_tokens(refresh_token, box_client_id: ENV['BOX_CLIENT_ID'], box_client_secret: ENV['BOX_CLIENT_SECRET'])
105
+
106
+ Boxr::revoke_tokens(token, box_client_id: ENV['BOX_CLIENT_ID'], box_client_secret: ENV['BOX_CLIENT_SECRET'])
107
+ ```
96
108
  #### [Folders](https://developers.box.com/docs/#folders)
97
109
  ```ruby
98
110
  folder_from_path(path)
@@ -32,8 +32,7 @@ module Boxr
32
32
  private
33
33
 
34
34
  def self.auth_post(uri, body)
35
- client = HTTPClient.new
36
- res = client.post(uri, body: body)
35
+ res = BOX_CLIENT.post(uri, body: body)
37
36
 
38
37
  if(res.status==200)
39
38
  body_json = Oj.load(res.body)
@@ -1,30 +1,30 @@
1
1
  module Boxr
2
2
  class Client
3
3
 
4
- def create_metadata(file, metadata, type: :properties)
4
+ def create_metadata(file, metadata, scope: :global, template: :properties)
5
5
  file_id = ensure_id(file)
6
- uri = "#{METADATA_URI}/#{file_id}/metadata/#{type}"
6
+ uri = "#{METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
7
7
  metadata, response = post(uri, metadata, content_type: "application/json")
8
8
  metadata
9
9
  end
10
10
 
11
- def metadata(file, type: :properties)
11
+ def metadata(file, scope: :global, template: :properties)
12
12
  file_id = ensure_id(file)
13
- uri = "#{METADATA_URI}/#{file_id}/metadata/#{type}"
13
+ uri = "#{METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
14
14
  metadata, response = get(uri)
15
15
  metadata
16
16
  end
17
17
 
18
- def update_metadata(file, updates, type: :properties)
18
+ def update_metadata(file, updates, scope: :global, template: :properties)
19
19
  file_id = ensure_id(file)
20
- uri = "#{METADATA_URI}/#{file_id}/metadata/#{type}"
20
+ uri = "#{METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
21
21
  metadata, response = put(uri, updates, content_type: "application/json-patch+json")
22
22
  metadata
23
23
  end
24
24
 
25
- def delete_metadata(file, type: :properties)
25
+ def delete_metadata(file, scope: :global, template: :properties)
26
26
  file_id = ensure_id(file)
27
- uri = "#{METADATA_URI}/#{file_id}/metadata/#{type}"
27
+ uri = "#{METADATA_URI}/#{file_id}/metadata/#{scope}/#{template}"
28
28
  result, response = delete(uri)
29
29
  result
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Burnette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler