boxr 0.12.0 → 0.13.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/README.md +7 -1
- data/lib/boxr/client.rb +5 -3
- data/lib/boxr/version.rb +1 -1
- data/spec/boxr_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e288ec193acb62b043385675eb9774600010f64
|
4
|
+
data.tar.gz: 04154af36d232ae6f5383708c3f759c99d86d8d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 089b8d6d04ac0258883b23522a781a6dc1f8e40f31436a64de711fd691f089b2245dffa6dcc6185dd8b3489d9c1d0c20fdc6d8c03a9223336a3adb054fa1eb9e
|
7
|
+
data.tar.gz: 858f7f86ada92d1d0ce9668355a226f58f216946790030fd9aa6299f7cb9deb8ea7bc5147e160bfb699001c1686f05c8d80bd8983258de83dac8fd6dffaa4a1f
|
data/README.md
CHANGED
@@ -73,10 +73,16 @@ client = Boxr::Client.new('zX3UjFwNerOy5PSWc2WI8aJgMHtAjs8T',
|
|
73
73
|
# BOX_CLIENT_ID and BOX_CLIENT_SECRET, respectively. You can omit the two optional parameters above
|
74
74
|
# if those are present.
|
75
75
|
|
76
|
-
#
|
76
|
+
# You can provide another parameter called as_user. Read about what that means here: https://developers.box.com/docs/#users-as-user
|
77
|
+
|
78
|
+
# You can provide yet another parameter called identifier. This can be used, for example, to
|
77
79
|
# hold the id of the user associated with this Boxr client. When the callback is invoked this value
|
78
80
|
# will be provided.
|
79
81
|
```
|
82
|
+
Here's the complete method signature to initialize an instance of Boxr::Client
|
83
|
+
```ruby
|
84
|
+
initialize(access_token=ENV['BOX_DEVELOPER_TOKEN'], refresh_token: nil, box_client_id: ENV['BOX_CLIENT_ID'], box_client_secret: ENV['BOX_CLIENT_SECRET'], identifier: nil, as_user: nil, &token_refresh_listener)
|
85
|
+
```
|
80
86
|
|
81
87
|
### A quick example
|
82
88
|
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.
|
data/lib/boxr/client.rb
CHANGED
@@ -51,14 +51,16 @@ module Boxr
|
|
51
51
|
GROUP_FIELDS_QUERY = GROUP_FIELDS.join(',')
|
52
52
|
|
53
53
|
|
54
|
-
def initialize(access_token, refresh_token: nil, box_client_id: ENV['BOX_CLIENT_ID'], box_client_secret: ENV['BOX_CLIENT_SECRET'],
|
55
|
-
identifier: nil,
|
54
|
+
def initialize(access_token=ENV['BOX_DEVELOPER_TOKEN'], refresh_token: nil, box_client_id: ENV['BOX_CLIENT_ID'], box_client_secret: ENV['BOX_CLIENT_SECRET'],
|
55
|
+
identifier: nil, as_user: nil, &token_refresh_listener)
|
56
56
|
@access_token = access_token
|
57
|
+
raise BoxrException.new(boxr_message: "Access token cannot be nil") if @access_token.nil?
|
58
|
+
|
57
59
|
@refresh_token = refresh_token
|
58
60
|
@box_client_id = box_client_id
|
59
61
|
@box_client_secret = box_client_secret
|
60
62
|
@identifier = identifier
|
61
|
-
@as_user_id =
|
63
|
+
@as_user_id = ensure_id(as_user)
|
62
64
|
@token_refresh_listener = token_refresh_listener
|
63
65
|
end
|
64
66
|
|
data/lib/boxr/version.rb
CHANGED
data/spec/boxr_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Boxr::Client do
|
|
15
15
|
|
16
16
|
#follow the directions in .env.example to set up your BOX_DEVELOPER_TOKEN
|
17
17
|
#keep in mind it is only valid for 60 minutes
|
18
|
-
BOX_CLIENT = Boxr::Client.new
|
18
|
+
BOX_CLIENT = Boxr::Client.new #using 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
21
|
#Boxr::turn_on_debugging
|