adn_viewer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/adn_viewer.rb +30 -0
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YWE0ZTBjODQxMjkzOTQxMTE1OGY0Yjk3ODY0MGE5N2E4NTBlN2EwZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d735bfaa8dee379ef031b4709e20e77c27fff26a
|
4
|
+
data.tar.gz: 00cacf180866823dca311b42bb239a42df1704de
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ODQyMGVkZjYxMGM1NGJhODQ5N2U3YzBhOWI0ZTBkZDI2NTBhMzlkMjRjNzlh
|
11
|
-
YWViYmNhZGEwNTJjZGM1MjNkODhjMzdkOTcwNTExZmZmMmVmZGQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Yjk0OWY5ZGM1MjhhZjgzOGM4NWZmZWI3ZTdiMTBmNTczNWI5Y2FlYmU2ZGE2
|
14
|
-
YzMzMmUxOWE1MDkyNzdlMWIzOGFlNDU4MGY0Y2FhNGUyOTAyMGMxMDBiYjcw
|
15
|
-
NzJmNTlmMWRjNDQ0MjIwNGRhMWFjYWI4N2FjNmMxMjI2NDllM2I=
|
6
|
+
metadata.gz: 99b7a2aa185f485ea9bc274760520bd9f2461ddbb26f7486166c35f44ae4239ba105c2d17e217857bd140dbc2adf7c645d29a3cedf25698fe37d989144e6539a
|
7
|
+
data.tar.gz: b5f7f9ee54ac3714d3ba1c16bdf438f9a56315e421aad59bdb1a848409edfc8a13d99d77275450831691e78bc93ff8a596b43542b330204cacd8eee5cbe89c72
|
data/lib/adn_viewer.rb
CHANGED
@@ -1,5 +1,35 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'curb-fu'
|
4
|
+
require 'json'
|
5
|
+
|
1
6
|
class Adn_Viewer
|
7
|
+
|
2
8
|
def self.token(key, secret)
|
3
9
|
JSON.parse(CurbFu.post({:host => 'developer.api.autodesk.com', :path => '/authentication/v1/authenticate', :protocol => "https"}, { :client_id => key, :client_secret => secret, :grant_type => 'client_credentials' }).body)
|
4
10
|
end
|
11
|
+
|
12
|
+
def self.create_bucket(token, name, policy)
|
13
|
+
url = URI("https://developer.api.autodesk.com/oss/v1/buckets")
|
14
|
+
http = Net::HTTP.new(url.host, url.port)
|
15
|
+
http.use_ssl = true
|
16
|
+
request = Net::HTTP::Post.new(url)
|
17
|
+
request["content-type"] = 'application/json'
|
18
|
+
request["authorization"] = 'Bearer ' + token
|
19
|
+
request.body = "{\"bucketKey\":\"" + name + "\",\"policy\":\"" + policy + "\"}"
|
20
|
+
http.request(request).read_body
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.check_bucket(token, name)
|
24
|
+
JSON.parse(CurbFu.get({:host => 'developer.api.autodesk.com', :path => '/oss/v1/buckets/' + name + '/details', :protocol => "https", :headers => { "Authorization" => "Bearer " + token, "Content-Type" => "application/json" }}).body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.supported_formats(token)
|
28
|
+
JSON.parse(CurbFu.get({:host => 'developer.api.autodesk.com', :path => '/viewingservice/v1/supported', :protocol => "https", :headers => { "Authorization" => "Bearer " + token, "Content-Type" => "application/json" }}).body)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.upload_file(token, name, file)
|
32
|
+
JSON.parse(CurbFu.get({:host => 'developer.api.autodesk.com', :path => '/oss/v1/buckets/' + name + '/objects/' + file, :protocol => "https", :headers => { "Authorization" => "Bearer " + token, "Content-Type" => "application/octet-stream" , "Content-Length" => 308331 }, "upload-file" => file }).body)
|
33
|
+
end
|
34
|
+
|
5
35
|
end
|
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.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pratham Makhni Alag
|
@@ -14,80 +14,80 @@ dependencies:
|
|
14
14
|
name: curb
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.5'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.5.4.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.5'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.5.4.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: curb-fu
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0.6'
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.6.2
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0.6'
|
50
|
-
- -
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.6.2
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: json
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - ~>
|
57
|
+
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '1.8'
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 1.8.3
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.8'
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 1.8.3
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: gon
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- - ~>
|
77
|
+
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '5.2'
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 5.2.3
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '5.2'
|
90
|
-
- -
|
90
|
+
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 5.2.3
|
93
93
|
description: ADN Viewer Starter
|
@@ -107,17 +107,17 @@ require_paths:
|
|
107
107
|
- lib
|
108
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 1.9.3
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.4.
|
120
|
+
rubygems_version: 2.4.6
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Ruby gem to make usage of Autodesk View and Data API in a Ruby on Rails app
|