boxr 0.8.0 → 0.9.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: 0aa4abe4312f4c46511db9986e8ad93b35b8cfe8
4
- data.tar.gz: 47fb80ce3be0012b8690957bcc0e284d86e9c1c2
3
+ metadata.gz: 50b4a867d4fc5a6446ae5f142d580c371e7748ae
4
+ data.tar.gz: 143e912a0826575b25016119b54690103a9e2a3d
5
5
  SHA512:
6
- metadata.gz: 53efb9140c1c6b83d14d83a825aad2541423f98508cb659b9946d093a5455ad675dc8abd9d71a19d8252c4b7e0ff4ce9d4c4d1330de132743a46d83c2244a26b
7
- data.tar.gz: 7b93b21a33d06744eb47aa6af0c6352b54a358da83a5c7663b91163830e7a92117e122627cec995c3c7df2eb9e9dcca3f69578c98c214554d3467ed7295cbff6
6
+ metadata.gz: a9631bd2bd6a8ef95ecacfb9b64d88b94498b59543535195d3a36b03f4e5d5f22b3c4d43210957720c38dca5731456697bedf5f07a85176aabcaa78991113e62
7
+ data.tar.gz: bb56e7e644834021a2047ac7605e2d23448a2187fb1f890916433d914b4d1e5a72eea440af4e394bd5b7ed7f89b84c3abba53094c0bffbe524c728c1f77ab7eb
data/README.md CHANGED
@@ -40,6 +40,7 @@ items.each {|i| puts i.name}
40
40
 
41
41
  ### Creating a client
42
42
  There are a few different ways to create a Boxr client. The simplest is to use a Box Developer Token (you generate these from your Box app's General Information page). They last for 60 minutes and you don't have to go through OAuth2.
43
+
43
44
  ```ruby
44
45
  client = Boxr::Client.new('yPDWOvnumUFaKIMrNBg6PGJpWXC0oaFW')
45
46
 
@@ -50,6 +51,7 @@ client = Boxr::Client.new #uses ENV['BOX_DEVELOPER_TOKEN']
50
51
  ```
51
52
 
52
53
  The next way is to use an access token retrieved after going through the OAuth2 process. If your application is going to handle refreshing the tokens in a scheduled way (more on this later) then this is the way to go.
54
+
53
55
  ```ruby
54
56
  client = Boxr::Client.new('v2eAXqhZ28WIEpIWeAJcmyamLLt77icP') #a valid OAuth2 access token
55
57
 
@@ -58,6 +60,7 @@ client = Boxr::Client.new('v2eAXqhZ28WIEpIWeAJcmyamLLt77icP') #a valid OAuth2 a
58
60
  ```
59
61
 
60
62
  If you want Boxr to automatically refresh the tokens once the access token becomes invalid you can supply a refresh token, along with your client_id and client_secret, and a block that will get invoked when the refresh occurs.
63
+
61
64
  ```ruby
62
65
  token_refresh_callback = lambda {|access, refresh, identifier| some_method_that_saves_them(access, refresh)}
63
66
  client = Boxr::Client.new('zX3UjFwNerOy5PSWc2WI8aJgMHtAjs8T',
@@ -77,6 +80,7 @@ client = Boxr::Client.new('zX3UjFwNerOy5PSWc2WI8aJgMHtAjs8T',
77
80
 
78
81
  ### A quick example
79
82
  Before diving into detailed documentation, let's take a look at how to accomplish a simple task with Boxr. This script will find a specific folder given its path, upload a file to that folder, and create an open shared link to that file.
83
+
80
84
  ```ruby
81
85
  require 'boxr'
82
86
 
@@ -33,9 +33,9 @@ module Boxr
33
33
  attributes = {}
34
34
  attributes[:name] = name unless name.nil?
35
35
  attributes[:description] = description unless description.nil?
36
- attributes[:parent_id] = {id: parent_id} unless parent_id.nil?
36
+ attributes[:parent] = {id: parent_id} unless parent_id.nil?
37
37
  attributes[:shared_link] = shared_link unless shared_link.nil?
38
- attributes[:tags] = tags unless tags.nil?
38
+ attributes[:tags] = tags unless tags.nil?
39
39
 
40
40
  updated_file, response = put(uri, attributes, if_match: if_match)
41
41
  updated_file
@@ -70,7 +70,7 @@ module Boxr
70
70
  download_file(file, version: version, follow_redirect: false)
71
71
  end
72
72
 
73
- def upload_file(path_to_file, parent, content_created_at: nil, content_modified_at: nil,
73
+ def upload_file(path_to_file, parent, content_created_at: nil, content_modified_at: nil,
74
74
  preflight_check: true, send_content_md5: true)
75
75
 
76
76
  parent_id = ensure_id(parent)
@@ -97,7 +97,7 @@ module Boxr
97
97
  result
98
98
  end
99
99
 
100
- def upload_new_version_of_file(path_to_file, file, content_modified_at: nil, send_content_md5: true,
100
+ def upload_new_version_of_file(path_to_file, file, content_modified_at: nil, send_content_md5: true,
101
101
  preflight_check: true, if_match: nil)
102
102
  file_id = ensure_id(file)
103
103
  preflight_check_new_version_of_file(path_to_file, file_id) if preflight_check
@@ -136,7 +136,7 @@ module Boxr
136
136
  def delete_old_version_of_file(file, file_version, if_match: nil)
137
137
  file_id = ensure_id(file)
138
138
  file_version_id = ensure_id(file_version)
139
-
139
+
140
140
  uri = "#{FILES_URI}/#{file_id}/versions/#{file_version_id}"
141
141
  result, response = delete(uri, if_match: if_match)
142
142
  result
@@ -213,7 +213,7 @@ module Boxr
213
213
 
214
214
  def preflight_check(path_to_file, parent_id)
215
215
  size = File.size(path_to_file)
216
-
216
+
217
217
  #TODO: need to make sure that figuring out the filename from the path_to_file works for people using Winblows
218
218
  filename = File.basename(path_to_file)
219
219
  attributes = {"name" => filename, "parent" => {"id" => "#{parent_id}"}, "size" => size}
@@ -227,4 +227,4 @@ module Boxr
227
227
  end
228
228
 
229
229
  end
230
- end
230
+ end
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -18,7 +18,7 @@ describe Boxr::Client do
18
18
  BOX_CLIENT = Boxr::Client.new(ENV['BOX_DEVELOPER_TOKEN'])
19
19
 
20
20
  #uncomment this line to see the HTTP request and response debug info in the rspec output
21
- #Boxr::Client.turn_on_debugging
21
+ #Boxr::turn_on_debugging
22
22
 
23
23
  BOX_SERVER_SLEEP = 5
24
24
  TEST_FOLDER_NAME = 'Boxr Test'
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.8.0
4
+ version: 0.9.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-01-27 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler