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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/adn_viewer.rb +8 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e2bf07132997c4608a933efe44630de4bad6cce
4
- data.tar.gz: 1d1d2dc75bbeaeefd29fdc23840658036685ed12
3
+ metadata.gz: 1c9254adc74e64e46f5a3045085975e258cb6899
4
+ data.tar.gz: 751494b39be10eab1292d30223fea6c229214671
5
5
  SHA512:
6
- metadata.gz: bc79f0256574ce1e3e3f93ab08de956035402ca538e8becd117934e6dc7b988245ec4fb99fe4bee5c82b4b9083f801d76de435036e4ab0bd30ffd1da32c8bb0f
7
- data.tar.gz: 1211e7197a77f258797cc7f14593c60541459cdf897e4cd9b9cd2ecf672c86c12ec13d5985ec27d32ab5e6a792aa80d4fb2dc50fbbe6b9b4e033e6242d9009b1
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
- url = URI("https://developer.api.autodesk.com/oss/v1/buckets/" + name + "/objects/" + file)
33
- http = Net::HTTP.new(url.host, url.port)
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(url)
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"] = 308331
39
+ request["Content-Length"] = File.size(file)
38
40
  request["authorization"] = 'Bearer ' + token
39
- puts JSON.parse(http.request(request, file).read_body)
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adn_viewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pratham Makhni Alag