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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4b56f62f19efeb0a8dceda9d6202e1ae48482e7
4
- data.tar.gz: 90061fcec499a86417cac92dffb1c98f82a6ae1e
3
+ metadata.gz: 8e288ec193acb62b043385675eb9774600010f64
4
+ data.tar.gz: 04154af36d232ae6f5383708c3f759c99d86d8d4
5
5
  SHA512:
6
- metadata.gz: fb9ae2f87f8f9179f4170bf9d8fa1c236d2eff8e4f92cd3775cd024d52eeb63491f045e9750bcc15b99519e3756f72cc52d1c6d1b0949cefea274658fb7789c6
7
- data.tar.gz: 985e8aa0dcd6605732eeacf929b6b14d38ea3e157d63739c345c1d0fe406a1a64074b37ab5b5c06f2537af7ef4508fafd0561db9730bd19ae191448970e8bc67
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
- # Additionally, you can provide one other parameter called identifier. This can be used, for example, to
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.
@@ -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, as_user_id: nil, &token_refresh_listener)
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 = as_user_id
63
+ @as_user_id = ensure_id(as_user)
62
64
  @token_refresh_listener = token_refresh_listener
63
65
  end
64
66
 
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "0.12.0"
2
+ VERSION = "0.13.0"
3
3
  end
@@ -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(ENV['BOX_DEVELOPER_TOKEN'])
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
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: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Burnette