qtc-sdk 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +18 -18
  3. data/Changelog.md +18 -14
  4. data/Gemfile +4 -4
  5. data/LICENSE.txt +22 -22
  6. data/README.md +44 -44
  7. data/Rakefile +1 -1
  8. data/bin/qtc-cli +13 -13
  9. data/lib/qtc-sdk.rb +1 -1
  10. data/lib/qtc/cli/commands.rb +15 -15
  11. data/lib/qtc/cli/common.rb +146 -146
  12. data/lib/qtc/cli/eds/base.rb +27 -27
  13. data/lib/qtc/cli/eds/commands.rb +20 -20
  14. data/lib/qtc/cli/eds/instances.rb +30 -30
  15. data/lib/qtc/cli/mar/apps.rb +116 -116
  16. data/lib/qtc/cli/mar/base.rb +60 -60
  17. data/lib/qtc/cli/mar/commands.rb +221 -221
  18. data/lib/qtc/cli/mar/debug.rb +88 -87
  19. data/lib/qtc/cli/mar/domains.rb +35 -35
  20. data/lib/qtc/cli/mar/env.rb +38 -38
  21. data/lib/qtc/cli/mar/repository.rb +24 -24
  22. data/lib/qtc/cli/mar/ssl_certificates.rb +40 -40
  23. data/lib/qtc/cli/mar/stack.rb +29 -29
  24. data/lib/qtc/cli/mdb/base.rb +47 -47
  25. data/lib/qtc/cli/mdb/commands.rb +43 -43
  26. data/lib/qtc/cli/mdb/instances.rb +79 -79
  27. data/lib/qtc/cli/platform/clouds.rb +33 -33
  28. data/lib/qtc/cli/platform/commands.rb +132 -132
  29. data/lib/qtc/cli/platform/datacenters.rb +23 -23
  30. data/lib/qtc/cli/platform/ssh_keys.rb +41 -41
  31. data/lib/qtc/cli/platform/user.rb +25 -25
  32. data/lib/qtc/cli/platform/vpn.rb +93 -93
  33. data/lib/qtc/client.rb +170 -170
  34. data/lib/qtc/eds/client.rb +116 -116
  35. data/lib/qtc/eds/collection.rb +124 -124
  36. data/lib/qtc/eds/user_collection.rb +13 -13
  37. data/lib/qtc/eds/usergroup_collection.rb +41 -41
  38. data/lib/qtc/errors.rb +13 -13
  39. data/lib/qtc/version.rb +3 -3
  40. data/qtc-sdk.gemspec +28 -28
  41. data/spec/unit/qtc/client_spec.rb +147 -147
  42. metadata +18 -18
@@ -1,23 +1,23 @@
1
- require 'qtc/client'
2
- require_relative '../common'
3
-
4
- module Qtc::Cli::Platform
5
- class Datacenters
6
- include Qtc::Cli::Common
7
-
8
- def list
9
- datacenters = platform_client.get('/datacenters')
10
- inifile['datacenters'] = {}
11
-
12
- template = '%-20.20s %-40.40s'
13
- puts template % ['NAME', 'DESCRIPTION']
14
- datacenters['results'].each do |datacenter|
15
- datacenter['services'].each do |service|
16
- inifile['datacenters']["#{service['id']}-#{datacenter['id']}"] = service['url']
17
- end
18
- puts template % [datacenter['id'], datacenter['description']]
19
- end
20
- inifile.save(filename: ini_filename)
21
- end
22
- end
23
- end
1
+ require 'qtc/client'
2
+ require_relative '../common'
3
+
4
+ module Qtc::Cli::Platform
5
+ class Datacenters
6
+ include Qtc::Cli::Common
7
+
8
+ def list
9
+ datacenters = platform_client.get('/datacenters')
10
+ inifile['datacenters'] = {}
11
+
12
+ template = '%-20.20s %-40.40s'
13
+ puts template % ['NAME', 'DESCRIPTION']
14
+ datacenters['results'].each do |datacenter|
15
+ datacenter['services'].each do |service|
16
+ inifile['datacenters']["#{service['id']}-#{datacenter['id']}"] = service['url']
17
+ end
18
+ puts template % [datacenter['id'], datacenter['description']]
19
+ end
20
+ inifile.save(filename: ini_filename)
21
+ end
22
+ end
23
+ end
@@ -1,41 +1,41 @@
1
- require 'qtc/client'
2
- require_relative '../common'
3
-
4
- module Qtc::Cli::Platform
5
- class SshKeys
6
- include Qtc::Cli::Common
7
-
8
- def list
9
- response = platform_client.get('/user/ssh_keys')
10
- response['results'].each do |ssh_key|
11
- say "~ #{ssh_key['name']}"
12
- end
13
- end
14
-
15
- def create(options)
16
- raise ArgumentError.new('--name is required') if options.name.nil?
17
- raise ArgumentError.new('--key is required') if options.key.nil?
18
- unless File.exists?(options.key)
19
- raise ArgumentError.new("#{options.key} does not exist")
20
- end
21
-
22
- data = {
23
- name: options.name,
24
- key: File.read(options.key)
25
- }
26
-
27
- platform_client.post('/user/ssh_keys', data)
28
- end
29
-
30
- def destroy(options)
31
- raise ArgumentError.new('--name is required') if options.name.nil?
32
- response = platform_client.get('/user/ssh_keys')
33
- matches = response['results'].select{|r| r['name'] == options.name}
34
- if matches.size == 0
35
- raise ArgumentError.new("SSH key with name #{options.name} does not exist")
36
- else
37
- platform_client.delete("/user/ssh_keys/#{matches[0]['id']}")
38
- end
39
- end
40
- end
41
- end
1
+ require 'qtc/client'
2
+ require_relative '../common'
3
+
4
+ module Qtc::Cli::Platform
5
+ class SshKeys
6
+ include Qtc::Cli::Common
7
+
8
+ def list
9
+ response = platform_client.get('/user/ssh_keys')
10
+ response['results'].each do |ssh_key|
11
+ say "~ #{ssh_key['name']}"
12
+ end
13
+ end
14
+
15
+ def create(options)
16
+ raise ArgumentError.new('--name is required') if options.name.nil?
17
+ raise ArgumentError.new('--key is required') if options.key.nil?
18
+ unless File.exists?(options.key)
19
+ raise ArgumentError.new("#{options.key} does not exist")
20
+ end
21
+
22
+ data = {
23
+ name: options.name,
24
+ key: File.read(options.key)
25
+ }
26
+
27
+ platform_client.post('/user/ssh_keys', data)
28
+ end
29
+
30
+ def destroy(options)
31
+ raise ArgumentError.new('--name is required') if options.name.nil?
32
+ response = platform_client.get('/user/ssh_keys')
33
+ matches = response['results'].select{|r| r['name'] == options.name}
34
+ if matches.size == 0
35
+ raise ArgumentError.new("SSH key with name #{options.name} does not exist")
36
+ else
37
+ platform_client.delete("/user/ssh_keys/#{matches[0]['id']}")
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,25 +1,25 @@
1
- require 'qtc/client'
2
- require_relative '../common'
3
-
4
- module Qtc::Cli::Platform
5
- class User
6
- include Qtc::Cli::Common
7
-
8
- def login
9
- pass = password("Personal Access Token (copy from https://console.qtcloudservices.com/#/user/profile):")
10
- inifile['platform']['token'] = pass
11
-
12
- response = platform_client(pass).get('/user/accounts', {}) rescue nil
13
- if response
14
- inifile.save(filename: ini_filename)
15
- else
16
- print color('Invalid Personal Access Token', :red)
17
- end
18
- end
19
-
20
- def logout
21
- inifile['platform'].delete('token')
22
- inifile.save(filename: ini_filename)
23
- end
24
- end
25
- end
1
+ require 'qtc/client'
2
+ require_relative '../common'
3
+
4
+ module Qtc::Cli::Platform
5
+ class User
6
+ include Qtc::Cli::Common
7
+
8
+ def login
9
+ pass = password("Personal Access Token (copy from https://console.qtcloudservices.com/#/user/profile):")
10
+ inifile['platform']['token'] = pass
11
+
12
+ response = platform_client(pass).get('/user/accounts', {}) rescue nil
13
+ if response
14
+ inifile.save(filename: ini_filename)
15
+ else
16
+ print color('Invalid Personal Access Token', :red)
17
+ end
18
+ end
19
+
20
+ def logout
21
+ inifile['platform'].delete('token')
22
+ inifile.save(filename: ini_filename)
23
+ end
24
+ end
25
+ end
@@ -1,93 +1,93 @@
1
- require 'base64'
2
-
3
- module Qtc
4
- module Cli
5
- class Platform::Vpn
6
- include Qtc::Cli::Common
7
-
8
- def create
9
- self.datacenter_id = vpn_datacenter_id
10
- client.post('/vpn_containers', {name: 'default vpn'}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
11
- end
12
-
13
- def show
14
- result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
15
- vpn = result['results'][0]
16
- if vpn
17
- puts "id: #{vpn['id']}"
18
- puts "name: #{vpn['name']}"
19
- puts "state: #{vpn['state']}"
20
- else
21
- puts 'vpn not found, you can create vpn service with: qtc-cli vpn:create'
22
- end
23
- end
24
-
25
- def start
26
- result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
27
- vpn = result['results'][0]
28
- if vpn
29
- client.post("/vpn_containers/#{vpn['id']}/start", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
30
- else
31
- puts 'vpn not found, you can create vpn service with: qtc-cli vpn:create'
32
- end
33
- end
34
-
35
- def stop
36
- result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
37
- vpn = result['results'][0]
38
- if vpn
39
- client.post("/vpn_containers/#{vpn['id']}/stop", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
40
- else
41
- puts 'vpn not found, you can create vpn service with: qtc-cli mdb vpn:create'
42
- end
43
- end
44
-
45
- def destroy
46
- result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
47
- vpn = result['results'][0]
48
- if vpn
49
- client.delete("/vpn_containers/#{vpn['id']}", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
50
- end
51
- end
52
-
53
- def config
54
- all = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
55
- if all['results'][0]
56
- vpn = all['results'][0]
57
- if vpn['state'] != 'running'
58
- puts 'Cannot get config because vpn is not running'
59
- exit 1
60
- end
61
-
62
- vpn = client.get("/vpn_containers/#{vpn['id']}", {}, {'Authorization' => "Bearer #{current_cloud_token}"})
63
- if vpn['vpn_config']
64
- puts Base64.decode64(vpn['vpn_config'])
65
- end
66
- end
67
- end
68
-
69
- def vpn_datacenter_id
70
- "mdb-#{current_cloud_dc}"
71
- end
72
-
73
- ##
74
- # @return [Qtc::Client]
75
- def client
76
- if @client.nil?
77
- @client = Qtc::Client.new(base_url)
78
- end
79
-
80
- @client
81
- end
82
-
83
- def base_url
84
- datacenters = inifile['datacenters'] || {}
85
- if !self.vpn_datacenter_id.nil? && datacenters.has_key?(self.vpn_datacenter_id)
86
- "#{datacenters[self.vpn_datacenter_id]}/v1"
87
- else
88
- raise ArgumentError.new('Unknown datacenter. Please run qtc-cli datacenters to get latest list of your datacenters')
89
- end
90
- end
91
- end
92
- end
93
- end
1
+ require 'base64'
2
+
3
+ module Qtc
4
+ module Cli
5
+ class Platform::Vpn
6
+ include Qtc::Cli::Common
7
+
8
+ def create
9
+ self.datacenter_id = vpn_datacenter_id
10
+ client.post('/vpn_containers', {name: 'default vpn'}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
11
+ end
12
+
13
+ def show
14
+ result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
15
+ vpn = result['results'][0]
16
+ if vpn
17
+ puts "id: #{vpn['id']}"
18
+ puts "name: #{vpn['name']}"
19
+ puts "state: #{vpn['state']}"
20
+ else
21
+ puts 'vpn not found, you can create vpn service with: qtc-cli vpn:create'
22
+ end
23
+ end
24
+
25
+ def start
26
+ result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
27
+ vpn = result['results'][0]
28
+ if vpn
29
+ client.post("/vpn_containers/#{vpn['id']}/start", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
30
+ else
31
+ puts 'vpn not found, you can create vpn service with: qtc-cli vpn:create'
32
+ end
33
+ end
34
+
35
+ def stop
36
+ result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
37
+ vpn = result['results'][0]
38
+ if vpn
39
+ client.post("/vpn_containers/#{vpn['id']}/stop", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
40
+ else
41
+ puts 'vpn not found, you can create vpn service with: qtc-cli mdb vpn:create'
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ result = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
47
+ vpn = result['results'][0]
48
+ if vpn
49
+ client.delete("/vpn_containers/#{vpn['id']}", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
50
+ end
51
+ end
52
+
53
+ def config
54
+ all = client.get('/vpn_containers', {}, {'Authorization' => "Bearer #{current_cloud_token}"})
55
+ if all['results'][0]
56
+ vpn = all['results'][0]
57
+ if vpn['state'] != 'running'
58
+ puts 'Cannot get config because vpn is not running'
59
+ exit 1
60
+ end
61
+
62
+ vpn = client.get("/vpn_containers/#{vpn['id']}", {}, {'Authorization' => "Bearer #{current_cloud_token}"})
63
+ if vpn['vpn_config']
64
+ puts Base64.decode64(vpn['vpn_config'])
65
+ end
66
+ end
67
+ end
68
+
69
+ def vpn_datacenter_id
70
+ "mdb-#{current_cloud_dc}"
71
+ end
72
+
73
+ ##
74
+ # @return [Qtc::Client]
75
+ def client
76
+ if @client.nil?
77
+ @client = Qtc::Client.new(base_url)
78
+ end
79
+
80
+ @client
81
+ end
82
+
83
+ def base_url
84
+ datacenters = inifile['datacenters'] || {}
85
+ if !self.vpn_datacenter_id.nil? && datacenters.has_key?(self.vpn_datacenter_id)
86
+ "#{datacenters[self.vpn_datacenter_id]}/v1"
87
+ else
88
+ raise ArgumentError.new('Unknown datacenter. Please run qtc-cli datacenters to get latest list of your datacenters')
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
data/lib/qtc/client.rb CHANGED
@@ -1,170 +1,170 @@
1
- require 'json'
2
- require 'httpclient'
3
- require_relative 'errors'
4
-
5
- module Qtc
6
- class Client
7
-
8
- attr_accessor :default_headers
9
- attr_reader :http_client
10
-
11
- # Initialize api client
12
- #
13
- # @param [String] api_url
14
- # @param [Hash] default_headers
15
- def initialize(api_url, default_headers = {})
16
- @http_client = HTTPClient.new
17
- @default_headers = {'Accept' => 'application/json', 'Content-Type' => 'application/json'}.merge(default_headers)
18
- @api_url = api_url
19
- end
20
-
21
- # Get request
22
- #
23
- # @param [String] path
24
- # @param [Hash,NilClass] params
25
- # @return [Hash]
26
- def get(path, params = nil, headers = {})
27
- response = http_client.get(request_uri(path), params, request_headers(headers))
28
- if response.status == 200
29
- parse_response(response)
30
- else
31
- handle_error_response(response)
32
- end
33
- end
34
-
35
- # Post request
36
- #
37
- # @param [String] path
38
- # @param [Object] obj
39
- # @param [Hash] params
40
- # @param [Hash] headers
41
- # @return [Hash]
42
- def post(path, obj, params = {}, headers = {})
43
- request_headers = request_headers(headers)
44
- request_options = {
45
- header: request_headers,
46
- body: encode_body(obj, request_headers['Content-Type']),
47
- query: params
48
- }
49
- response = http_client.post(request_uri(path), request_options)
50
- if [200, 201].include?(response.status)
51
- parse_response(response)
52
- else
53
- handle_error_response(response)
54
- end
55
- end
56
-
57
- # Put request
58
- #
59
- # @param [String] path
60
- # @param [Object] obj
61
- # @param [Hash] params
62
- # @param [Hash] headers
63
- # @return [Hash]
64
- def put(path, obj, params = {}, headers = {})
65
- request_headers = request_headers(headers)
66
- request_options = {
67
- header: request_headers,
68
- body: encode_body(obj, request_headers['Content-Type']),
69
- query: params
70
- }
71
-
72
- response = http_client.put(request_uri(path), request_options)
73
- if [200, 201].include?(response.status)
74
- parse_response(response)
75
- else
76
- handle_error_response(response)
77
- end
78
- end
79
-
80
- # Delete request
81
- #
82
- # @param [String] path
83
- # @param [Hash,String] body
84
- # @param [Hash] params
85
- # @param [Hash] headers
86
- # @return [Hash]
87
- def delete(path, body = nil, params = {}, headers = {})
88
- request_headers = request_headers(headers)
89
- request_options = {
90
- header: request_headers,
91
- body: encode_body(body, request_headers['Content-Type']),
92
- query: params
93
- }
94
- response = http_client.delete(request_uri(path), request_options)
95
- if response.status == 200
96
- parse_response(response)
97
- else
98
- handle_error_response(response)
99
- end
100
- end
101
-
102
- private
103
-
104
- ##
105
- # Get full request uri
106
- #
107
- # @param [String] path
108
- # @return [String]
109
- def request_uri(path)
110
- "#{@api_url}#{path}"
111
- end
112
-
113
- ##
114
- # Get request headers
115
- #
116
- # @param [Hash] headers
117
- # @return [Hash]
118
- def request_headers(headers = {})
119
- @default_headers.merge(headers)
120
- end
121
-
122
- ##
123
- # Encode body based on content type
124
- #
125
- # @param [Object] body
126
- # @param [String] content_type
127
- def encode_body(body, content_type)
128
- if content_type == 'application/json'
129
- dump_json(body)
130
- else
131
- body
132
- end
133
- end
134
-
135
- ##
136
- # Parse response
137
- #
138
- # @param [HTTP::Message]
139
- # @return [Object]
140
- def parse_response(response)
141
- if response.headers['Content-Type'].include?('application/json')
142
- parse_json(response.body)
143
- else
144
- response.body
145
- end
146
- end
147
-
148
- ##
149
- # Parse json
150
- #
151
- # @param [String] json
152
- # @return [Hash,Object,NilClass]
153
- def parse_json(json)
154
- JSON.parse(json) rescue nil
155
- end
156
-
157
- ##
158
- # Dump json
159
- #
160
- # @param [Object] obj
161
- # @return [String]
162
- def dump_json(obj)
163
- JSON.dump(obj)
164
- end
165
-
166
- def handle_error_response(response)
167
- raise Qtc::Errors::StandardError.new(response.status, response.body)
168
- end
169
- end
170
- end
1
+ require 'json'
2
+ require 'httpclient'
3
+ require_relative 'errors'
4
+
5
+ module Qtc
6
+ class Client
7
+
8
+ attr_accessor :default_headers
9
+ attr_reader :http_client
10
+
11
+ # Initialize api client
12
+ #
13
+ # @param [String] api_url
14
+ # @param [Hash] default_headers
15
+ def initialize(api_url, default_headers = {})
16
+ @http_client = HTTPClient.new
17
+ @default_headers = {'Accept' => 'application/json', 'Content-Type' => 'application/json'}.merge(default_headers)
18
+ @api_url = api_url
19
+ end
20
+
21
+ # Get request
22
+ #
23
+ # @param [String] path
24
+ # @param [Hash,NilClass] params
25
+ # @return [Hash]
26
+ def get(path, params = nil, headers = {})
27
+ response = http_client.get(request_uri(path), params, request_headers(headers))
28
+ if response.status == 200
29
+ parse_response(response)
30
+ else
31
+ handle_error_response(response)
32
+ end
33
+ end
34
+
35
+ # Post request
36
+ #
37
+ # @param [String] path
38
+ # @param [Object] obj
39
+ # @param [Hash] params
40
+ # @param [Hash] headers
41
+ # @return [Hash]
42
+ def post(path, obj, params = {}, headers = {})
43
+ request_headers = request_headers(headers)
44
+ request_options = {
45
+ header: request_headers,
46
+ body: encode_body(obj, request_headers['Content-Type']),
47
+ query: params
48
+ }
49
+ response = http_client.post(request_uri(path), request_options)
50
+ if [200, 201].include?(response.status)
51
+ parse_response(response)
52
+ else
53
+ handle_error_response(response)
54
+ end
55
+ end
56
+
57
+ # Put request
58
+ #
59
+ # @param [String] path
60
+ # @param [Object] obj
61
+ # @param [Hash] params
62
+ # @param [Hash] headers
63
+ # @return [Hash]
64
+ def put(path, obj, params = {}, headers = {})
65
+ request_headers = request_headers(headers)
66
+ request_options = {
67
+ header: request_headers,
68
+ body: encode_body(obj, request_headers['Content-Type']),
69
+ query: params
70
+ }
71
+
72
+ response = http_client.put(request_uri(path), request_options)
73
+ if [200, 201].include?(response.status)
74
+ parse_response(response)
75
+ else
76
+ handle_error_response(response)
77
+ end
78
+ end
79
+
80
+ # Delete request
81
+ #
82
+ # @param [String] path
83
+ # @param [Hash,String] body
84
+ # @param [Hash] params
85
+ # @param [Hash] headers
86
+ # @return [Hash]
87
+ def delete(path, body = nil, params = {}, headers = {})
88
+ request_headers = request_headers(headers)
89
+ request_options = {
90
+ header: request_headers,
91
+ body: encode_body(body, request_headers['Content-Type']),
92
+ query: params
93
+ }
94
+ response = http_client.delete(request_uri(path), request_options)
95
+ if response.status == 200
96
+ parse_response(response)
97
+ else
98
+ handle_error_response(response)
99
+ end
100
+ end
101
+
102
+ private
103
+
104
+ ##
105
+ # Get full request uri
106
+ #
107
+ # @param [String] path
108
+ # @return [String]
109
+ def request_uri(path)
110
+ "#{@api_url}#{path}"
111
+ end
112
+
113
+ ##
114
+ # Get request headers
115
+ #
116
+ # @param [Hash] headers
117
+ # @return [Hash]
118
+ def request_headers(headers = {})
119
+ @default_headers.merge(headers)
120
+ end
121
+
122
+ ##
123
+ # Encode body based on content type
124
+ #
125
+ # @param [Object] body
126
+ # @param [String] content_type
127
+ def encode_body(body, content_type)
128
+ if content_type == 'application/json'
129
+ dump_json(body)
130
+ else
131
+ body
132
+ end
133
+ end
134
+
135
+ ##
136
+ # Parse response
137
+ #
138
+ # @param [HTTP::Message]
139
+ # @return [Object]
140
+ def parse_response(response)
141
+ if response.headers['Content-Type'].include?('application/json')
142
+ parse_json(response.body)
143
+ else
144
+ response.body
145
+ end
146
+ end
147
+
148
+ ##
149
+ # Parse json
150
+ #
151
+ # @param [String] json
152
+ # @return [Hash,Object,NilClass]
153
+ def parse_json(json)
154
+ JSON.parse(json) rescue nil
155
+ end
156
+
157
+ ##
158
+ # Dump json
159
+ #
160
+ # @param [Object] obj
161
+ # @return [String]
162
+ def dump_json(obj)
163
+ JSON.dump(obj)
164
+ end
165
+
166
+ def handle_error_response(response)
167
+ raise Qtc::Errors::StandardError.new(response.status, response.body)
168
+ end
169
+ end
170
+ end