adn_viewer 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adn_viewer.rb +8 -5
- 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: 1c9254adc74e64e46f5a3045085975e258cb6899
|
4
|
+
data.tar.gz: 751494b39be10eab1292d30223fea6c229214671
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb86286c454d333acde72e7677aba19d3d3618c32deb3d48c6c2b1945828ee07ac17d659704ca01d8990b7fc7d2f4ea061c2bc4532fd4e5e2f53ea8c5f4997dc
|
7
|
+
data.tar.gz: 4b88690410912f5b3dc48fbaec8172e370d3bc902f954c9fb3f93269b5e6dcbd4f6d465ed003a19c13bbfd3e373ba41acaf3a43e0ce43f6c4807639173480a4e
|
data/lib/adn_viewer.rb
CHANGED
@@ -29,14 +29,17 @@ class Adn_Viewer
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.upload_file(token, name, file)
|
32
|
-
|
33
|
-
|
32
|
+
BOUNDARY = "AaB03xZZZZZZ11322321111XSDW"
|
33
|
+
uri = URI("https://developer.api.autodesk.com/oss/v1/buckets/" + name + "/objects/" + file)
|
34
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
34
35
|
http.use_ssl = true
|
35
|
-
request = Net::HTTP::Put.new(
|
36
|
+
request = Net::HTTP::Put.new(uri)
|
37
|
+
request.body_stream=File.open(file)
|
36
38
|
request["content-type"] = 'application/octet-stream'
|
37
|
-
request["Content-Length"] =
|
39
|
+
request["Content-Length"] = File.size(file)
|
38
40
|
request["authorization"] = 'Bearer ' + token
|
39
|
-
|
41
|
+
request.add_field('session', BOUNDARY)
|
42
|
+
JSON.parse(http.request(request).read_body)
|
40
43
|
end
|
41
44
|
|
42
45
|
def self.register(token, urn)
|