boxview 0.0.0 → 0.0.1
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/lib/boxview.rb +24 -25
- 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: f7f96d70192aec96b8ab00dcea53d124c9de52d0
|
4
|
+
data.tar.gz: d91ec71c482cb609dcd22829be15ff874069547f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a39b7dc435469f08101f3dd16d7caac1ace439db00776e5d2c3718aeff2aadcb89fa5afd98421539e3692815c37044ee7a6b303b4a2c5b613c55f34fbb2d5149
|
7
|
+
data.tar.gz: 09dd6ef7d06308243ff440d60b31ffc9eadb347820c5f8e8182943de0038cc7cb5e349ea24cc488f4b7b4c3611a0c1e26107becde3a2358801bdb860873f7c8f
|
data/lib/boxview.rb
CHANGED
@@ -1,36 +1,35 @@
|
|
1
1
|
require 'faraday_middleware'
|
2
2
|
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
3
|
+
module BoxView
|
4
|
+
def self.init token
|
5
|
+
@@api_token = token
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def self.api_url
|
9
|
+
"https://view-api.box.com/1"
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
conn.adapter Faraday.default_adapter
|
20
|
-
end
|
12
|
+
def self.connection
|
13
|
+
connection = Faraday.new(:url => BoxView.api_url) do |conn|
|
14
|
+
#conn.request :url_encoded # convert request params as "www-form-urlencoded"
|
15
|
+
conn.response :mashify
|
16
|
+
conn.response :json, :content_type => /\bjson$/
|
17
|
+
conn.adapter Faraday.default_adapter
|
21
18
|
end
|
19
|
+
connection.headers['Authorization'] = "Token #{@@api_token}"
|
20
|
+
connection.headers['Content-Type'] = 'application/json'
|
21
|
+
return connection
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
+
module Documents
|
25
|
+
@@endpoint = "documents"
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
req.headers['Authorization'] = "Token #{Box::View.token}"
|
30
|
-
req.body = '{"url": "' + url + '"}'
|
31
|
-
end
|
27
|
+
def self.create url
|
28
|
+
BoxView.connection.post do |request|
|
29
|
+
request.url @@endpoint
|
30
|
+
request.body = '{"url": "' + url + '"}'
|
32
31
|
end
|
33
|
-
|
34
32
|
end
|
33
|
+
|
35
34
|
end
|
36
35
|
end
|