aspose_diagram_cloud 18.10.2 → 18.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4047a65e6f952baef8b7fdede53b42182ac07d2
4
- data.tar.gz: d8c5202cbac13142589c0a131614f39a32c4d04e
3
+ metadata.gz: c2a794767fe37a6b4ba9866b5e67d2329b0e2674
4
+ data.tar.gz: 738ade2f45d6ea81f7b5cb0b6180678e098ed8a1
5
5
  SHA512:
6
- metadata.gz: e2fb1866df9d334941aabf97443ddc98105af3ad799fbb4a6bcfa45aa84510439247039b72190c3fb7c925010be5645ecff6e87cd410ae42868f927ab2268626
7
- data.tar.gz: 016b31185e5d23dfdb97d17d2cd47db7ed6e4125124e117431a17ccadde018095097e85adbf54d07f7f0fe8c0715469d2552fa2169f6395203ce9fff786af148
6
+ metadata.gz: 8398637e8b6b5a36ca51f6c1e988727d3581f71d4aa0ecb93af51b6383fd6a32105d52ec53b41dc5c9b4f1bfd576c08d5dcd28c441b25d92bb22d47369743680
7
+ data.tar.gz: 1694b612d464eabb49c71b15960c07cb495dda430df3196760ba97f1f8b39849ccd33317d80023505e8443d19d97649dc8c2c28247fc9b74f793bca7c1181d96
@@ -18,6 +18,22 @@ module AsposeDiagramCloud
18
18
 
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
+ request_token
22
+ end
23
+
24
+ #
25
+ # Gets a request token from server
26
+ #
27
+ def request_token
28
+ config = @api_client.config
29
+ base_path = config.base_path
30
+ config.base_path = '/'
31
+ request_url = "/oauth2/token"
32
+ post_data = "grant_type=client_credentials" + "&client_id=" + config.api_key['app_sid'] + "&client_secret=" + config.api_key['api_key']
33
+ data, status_code, header = @api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
34
+ @api_client.config.access_token = data[:access_token]
35
+ @api_client.config.base_path = base_path
36
+ @api_client.default_headers["Authorization"] ="Bearer " + data[:access_token]
21
37
  end
22
38
 
23
39
  # Read document info or export.
@@ -30,6 +46,7 @@ module AsposeDiagramCloud
30
46
  # @return [File]
31
47
  def diagram_file_get_diagram(name, opts = {})
32
48
  data, _status_code, _headers = diagram_file_get_diagram_with_http_info(name, opts)
49
+ request_token if _status_code == 401
33
50
  return data
34
51
  end
35
52
 
@@ -96,6 +113,7 @@ module AsposeDiagramCloud
96
113
  # @return [SaveResponse]
97
114
  def diagram_file_post_save_as(name, opts = {})
98
115
  data, _status_code, _headers = diagram_file_post_save_as_with_http_info(name, opts)
116
+ request_token if _status_code == 401
99
117
  return data
100
118
  end
101
119
 
@@ -163,6 +181,7 @@ module AsposeDiagramCloud
163
181
  # @return [SaaSposeResponse]
164
182
  def diagram_file_put_create(name, opts = {})
165
183
  data, _status_code, _headers = diagram_file_put_create_with_http_info(name, opts)
184
+ request_token if _status_code == 401
166
185
  return data
167
186
  end
168
187
 
@@ -227,6 +246,7 @@ module AsposeDiagramCloud
227
246
  # @return [SaaSposeResponse]
228
247
  def diagram_file_put_upload(name, opts = {})
229
248
  data, _status_code, _headers = diagram_file_put_upload_with_http_info(name, opts)
249
+ request_token if _status_code == 401
230
250
  return data
231
251
  end
232
252
 
@@ -49,7 +49,6 @@ module AsposeDiagramCloud
49
49
  def call_api(http_method, path, opts = {})
50
50
  request = build_request(http_method, path, opts)
51
51
  response = request.run
52
-
53
52
  if @config.debugging
54
53
  @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
55
54
  end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.3.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module AsposeDiagramCloud
14
- VERSION = "18.10.2"
14
+ VERSION = "18.10.3"
15
15
  end
@@ -19,18 +19,10 @@ require 'json'
19
19
  describe 'DiagramFileApi' do
20
20
  before do
21
21
  # run before each test
22
- # run before each test
23
- if $access_token == nil then
24
- conf = AsposeDiagramCloud::Configuration.new
25
- conf.base_path = ""
26
- instance = AsposeDiagramCloud::OAuthApi.new(AsposeDiagramCloud::ApiClient.new(conf))
27
- $access_token = instance.o_auth_post($grant_type,$client_id,$client_secret).access_token
28
- end
29
-
30
- conf = AsposeDiagramCloud::Configuration.new
31
- conf.access_token = $access_token
32
- client = AsposeDiagramCloud::ApiClient.new(conf)
33
- client.default_headers["Authorization"] ="Bearer " + $access_token
22
+ conf = AsposeDiagramCloud::Configuration.new
23
+ conf.api_key['app_sid'] = $client_id
24
+ conf.api_key['api_key'] = $client_secret
25
+ client = AsposeDiagramCloud::ApiClient.new(conf)
34
26
  @instance = AsposeDiagramCloud::DiagramFileApi.new(client)
35
27
  end
36
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_diagram_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.10.2
4
+ version: 18.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aspose Diagram Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -200,8 +200,6 @@ files:
200
200
  - Gemfile
201
201
  - README.md
202
202
  - Rakefile
203
- - aspose_diagram_cloud-18.10.1.gem
204
- - aspose_diagram_cloud-18.10.gem
205
203
  - aspose_diagram_cloud.gemspec
206
204
  - docs/AccessTokenResponse.md
207
205
  - docs/DiagramFileApi.md
Binary file
Binary file