leantesting 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +10 -0
  4. data/README.md +348 -0
  5. data/Rakefile +9 -0
  6. data/leantesting.gemspec +20 -0
  7. data/lib/BaseClass/APIRequest.rb +195 -0
  8. data/lib/BaseClass/Entity.rb +33 -0
  9. data/lib/BaseClass/EntityHandler.rb +183 -0
  10. data/lib/BaseClass/EntityList.rb +188 -0
  11. data/lib/Entity/Bug/Bug.rb +11 -0
  12. data/lib/Entity/Bug/BugAttachment.rb +7 -0
  13. data/lib/Entity/Bug/BugComment.rb +7 -0
  14. data/lib/Entity/Platform/PlatformBrowser.rb +10 -0
  15. data/lib/Entity/Platform/PlatformBrowserVersion.rb +7 -0
  16. data/lib/Entity/Platform/PlatformDevice.rb +7 -0
  17. data/lib/Entity/Platform/PlatformOS.rb +10 -0
  18. data/lib/Entity/Platform/PlatformOSVersion.rb +7 -0
  19. data/lib/Entity/Platform/PlatformType.rb +10 -0
  20. data/lib/Entity/Project/Project.rb +27 -0
  21. data/lib/Entity/Project/ProjectBugScheme.rb +7 -0
  22. data/lib/Entity/Project/ProjectSection.rb +7 -0
  23. data/lib/Entity/Project/ProjectUser.rb +7 -0
  24. data/lib/Entity/Project/ProjectVersion.rb +7 -0
  25. data/lib/Entity/User/UserOrganization.rb +7 -0
  26. data/lib/Exception/BaseException/SDKException.rb +19 -0
  27. data/lib/Exception/SDKBadJSONResponseException.rb +15 -0
  28. data/lib/Exception/SDKDuplicateRequestException.rb +19 -0
  29. data/lib/Exception/SDKErrorResponseException.rb +13 -0
  30. data/lib/Exception/SDKIncompleteRequestException.rb +19 -0
  31. data/lib/Exception/SDKInvalidArgException.rb +15 -0
  32. data/lib/Exception/SDKMissingArgException.rb +15 -0
  33. data/lib/Exception/SDKUnexpectedResponseException.rb +15 -0
  34. data/lib/Exception/SDKUnsupportedRequestException.rb +19 -0
  35. data/lib/Handler/Attachment/AttachmentsHandler.rb +17 -0
  36. data/lib/Handler/Auth/OAuth2Handler.rb +118 -0
  37. data/lib/Handler/Bug/BugAttachmentsHandler.rb +51 -0
  38. data/lib/Handler/Bug/BugCommentsHandler.rb +20 -0
  39. data/lib/Handler/Bug/BugsHandler.rb +57 -0
  40. data/lib/Handler/Platform/PlatformBrowserVersionsHandler.rb +20 -0
  41. data/lib/Handler/Platform/PlatformBrowsersHandler.rb +23 -0
  42. data/lib/Handler/Platform/PlatformDevicesHandler.rb +10 -0
  43. data/lib/Handler/Platform/PlatformHandler.rb +22 -0
  44. data/lib/Handler/Platform/PlatformOSHandler.rb +23 -0
  45. data/lib/Handler/Platform/PlatformOSVersionsHandler.rb +20 -0
  46. data/lib/Handler/Platform/PlatformTypeDevicesHandler.rb +20 -0
  47. data/lib/Handler/Platform/PlatformTypesHandler.rb +21 -0
  48. data/lib/Handler/Project/ProjectBugReproducibilitySchemeHandler.rb +20 -0
  49. data/lib/Handler/Project/ProjectBugSeveritySchemeHandler.rb +20 -0
  50. data/lib/Handler/Project/ProjectBugStatusSchemeHandler.rb +20 -0
  51. data/lib/Handler/Project/ProjectBugTypeSchemeHandler.rb +20 -0
  52. data/lib/Handler/Project/ProjectBugsHandler.rb +67 -0
  53. data/lib/Handler/Project/ProjectSectionsHandler.rb +39 -0
  54. data/lib/Handler/Project/ProjectUsersHandler.rb +20 -0
  55. data/lib/Handler/Project/ProjectVersionsHandler.rb +39 -0
  56. data/lib/Handler/Project/ProjectsHandler.rb +46 -0
  57. data/lib/Handler/User/UserHandler.rb +14 -0
  58. data/lib/Handler/User/UserOrganizationsHandler.rb +14 -0
  59. data/lib/leantesting.rb +65 -0
  60. data/lib/loader.rb +18 -0
  61. data/tests/APIRequestTest.rb +152 -0
  62. data/tests/BaseClassesTest.rb +96 -0
  63. data/tests/ClientTest.rb +52 -0
  64. data/tests/EntitiesTest.rb +97 -0
  65. data/tests/EntityListTest.rb +51 -0
  66. data/tests/ExceptionsTest.rb +70 -0
  67. data/tests/HandlersRequestsTest.rb +215 -0
  68. data/tests/MockRequestsTest.rb +556 -0
  69. data/tests/OAuth2HandlerTest.rb +75 -0
  70. data/tests/res/upload_sample.jpg +0 -0
  71. metadata +169 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 22d5bd235c58be20d11aa9b8fc8798b81dc4b132
4
+ data.tar.gz: 3c1ba69babb368011145075410b2c110cdfeb5d5
5
+ SHA512:
6
+ metadata.gz: 71a387b4baebc3839106c12086b1873430f9df08c43a9e240afd32cc77c309fb955133b476b41812401361c608e75c50f1c309b4d8969afe4a42c55598802b41
7
+ data.tar.gz: a2136d22593969dce4bd1a288ce5f572e95da312f71ec2ea61b4c8698d58ea4adaa1c228162a1e93e13518efa954656f54167145fe93df3195dc528703b65a0f
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'json', '>=1.8'
4
+ gem 'curb', '>=0.8'
5
+
6
+ group :test do
7
+ gem 'minitest', '>=5.8', :require => 'minitest/autorun'
8
+ gem 'mocha', '>=1.1', :require => 'mocha/mini_test'
9
+ end
data/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+
2
+ Copyright (c) 2015 Lean Testing
3
+
4
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10
+ THE SOFTWARE.
@@ -0,0 +1,348 @@
1
+ # Lean Testing Ruby SDK
2
+
3
+ **Ruby client for [Lean Testing API](https://leantesting.com/en/api-docs)**
4
+
5
+ You can sign up for a Lean Testing account at [https://leantesting.com](https://leantesting.com).
6
+
7
+ ## Requirements
8
+
9
+ * Ruby 2.0 or greater
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'leantesting'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install leantesting
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ require 'leantesting'
29
+
30
+ leantesting = LeanTesting::Client.new
31
+ leantesting.attachToken('<token>')
32
+
33
+ # Listing projects
34
+ projects = leantesting.projects.all()
35
+
36
+ # Fetching project bugs
37
+ bugs = leantesting.projects.find(123).bugs.all()
38
+ ```
39
+
40
+ ----
41
+
42
+ - Get Current **Token**
43
+ ```ruby
44
+ leantesting.getCurrentToken
45
+ ```
46
+
47
+ - Attach New **Token**
48
+ ```ruby
49
+ leantesting.attachToken('<token>')
50
+ ```
51
+
52
+ - Generate **Authorization URL**
53
+ ```ruby
54
+ generatedURL = leantesting.auth.generateAuthLink(
55
+ '<client id>',
56
+ '<redirect URL>',
57
+ '<scope>',
58
+ '<random string>'
59
+ )
60
+ p generatedURL
61
+ ```
62
+
63
+ - Exchange authorization code For **access token**
64
+ ```ruby
65
+ token = leantesting.auth.exchangeAuthCode(
66
+ '<client id>',
67
+ '<client secret>',
68
+ 'authorization_code',
69
+ '<auth code>',
70
+ '<redirect URL>'
71
+ )
72
+ p token
73
+ ```
74
+
75
+ ----
76
+
77
+ - Get **User** Information
78
+ ```ruby
79
+ leantesting.user.getInformation
80
+ ```
81
+
82
+ - Get **User** Organizations
83
+ ```ruby
84
+ leantesting.user.organizations.all.toArray
85
+ ```
86
+
87
+ ----
88
+
89
+ - List All **Projects**
90
+ ```ruby
91
+ leantesting.projects.all.toArray
92
+ ```
93
+
94
+ - Create A New **Project**
95
+ ```ruby
96
+ newProject = leantesting.projects.create({
97
+ 'name' => 'Project135',
98
+ 'organization_id' => 5779
99
+ })
100
+ p newProject.data
101
+ ```
102
+
103
+ - Retrieve An Existing **Project**
104
+ ```ruby
105
+ leantesting.projects.find(3515).data
106
+ ```
107
+
108
+
109
+ - List **Project Sections**
110
+ ```ruby
111
+ leantesting.projects.find(3515).sections.all.toArray
112
+ ```
113
+
114
+ - Adding A **Project Section**
115
+ ```ruby
116
+ newSection = leantesting.projects.find(3515).sections.create({
117
+ 'name' => 'SectionName'
118
+ })
119
+ p newSection.data
120
+ ```
121
+
122
+
123
+ - List **Project Versions**
124
+ ```ruby
125
+ leantesting.projects.find(3515).versions.all.toArray
126
+ ```
127
+
128
+ - Adding A **Project Version**
129
+ ```ruby
130
+ newVersion = leantesting.projects.find(3515).versions.create({
131
+ 'number' => 'v0.3.1104'
132
+ })
133
+ p newVersion.data
134
+ ```
135
+
136
+
137
+ - List **Project Users**
138
+ ```ruby
139
+ leantesting.projects.find(3515).users.all.toArray
140
+ ```
141
+
142
+
143
+ - List **Bug Type Scheme**
144
+ ```ruby
145
+ leantesting.projects.find(3515).bugTypeScheme.all.toArray
146
+ ```
147
+
148
+ - List **Bug Status Scheme**
149
+ ```ruby
150
+ leantesting.projects.find(3515).bugStatusScheme.all.toArray
151
+ ```
152
+
153
+ - List **Bug Severity Scheme**
154
+ ```ruby
155
+ leantesting.projects.find(3515).bugSeverityScheme.all.toArray
156
+ ```
157
+
158
+ - List **Bug Reproducibility Scheme**
159
+ ```ruby
160
+ leantesting.projects.find(3515).bugReproducibilityScheme.all.toArray
161
+ ```
162
+
163
+ ----
164
+
165
+ - List All **Bugs** In A Project
166
+ ```ruby
167
+ leantesting.projects.find(3515).bugs.all.toArray
168
+ ```
169
+
170
+ - Create A New **Bug**
171
+ ```ruby
172
+ newBug = leantesting.projects.find(3515).bugs.create({
173
+ 'title' => 'Something bad happened...',
174
+ 'status_id' => 1,
175
+ 'severity_id' => 2,
176
+ 'project_version_id' => 10242
177
+ })
178
+ p newBug.data
179
+ ```
180
+
181
+ - Retrieve Existing **Bug**
182
+ ```ruby
183
+ leantesting.bugs.find(38483).data
184
+ ```
185
+
186
+ - Update A **Bug**
187
+ ```ruby
188
+ updatedBug = leantesting.bugs.update(118622, {
189
+ 'title' => 'Updated title',
190
+ 'status_id' => 1,
191
+ 'severity_id' => 2,
192
+ 'project_version_id' => 10242
193
+ })
194
+ p updatedBug.data
195
+ ```
196
+
197
+ - Delete A **Bug**
198
+ ```ruby
199
+ leantesting.bugs.delete(118622)
200
+ ```
201
+
202
+ ----
203
+
204
+ - List Bug **Comments**
205
+ ```ruby
206
+ leantesting.bugs.find(38483).comments.all.toArray
207
+ ```
208
+
209
+ ----
210
+
211
+ - List Bug **Attachments**
212
+ ```ruby
213
+ leantesting.bugs.find(38483).attachments.all.toArray
214
+ ```
215
+
216
+ - Upload An **Attachment**
217
+ ```ruby
218
+ filePath = '/place/Downloads/Images/1370240743_2294218.jpg'
219
+ newAttachment = leantesting.bugs.find(38483).attachments.upload(filePath)
220
+ p newAttachment.data
221
+ ```
222
+
223
+ - Retrieve An Existing **Attachment**
224
+ ```ruby
225
+ leantesting.attachments.find(21515).data
226
+ ```
227
+
228
+ - Delete An **Attachment**
229
+ ```ruby
230
+ leantesting.attachments.delete(75258)
231
+ ```
232
+
233
+ ----
234
+
235
+ - List **Platform Types**
236
+ ```ruby
237
+ leantesting.platform.types.all.toArray
238
+ ```
239
+
240
+ - Retrieve **Platform Type**
241
+ ```ruby
242
+ leantesting.platform.types.find(1).data
243
+ ```
244
+
245
+
246
+ - List **Platform Devices**
247
+ ```ruby
248
+ leantesting.platform.types.find(1).devices.all.toArray
249
+ ```
250
+
251
+ - Retrieve Existing **Device**
252
+ ```ruby
253
+ leantesting.platform.devices.find(11).data
254
+ ```
255
+
256
+
257
+ - List **OS**
258
+ ```ruby
259
+ leantesting.platform.os.all.toArray
260
+ ```
261
+
262
+ - Retrieve Existing **OS**
263
+ ```ruby
264
+ leantesting.platform.os.find(1).data
265
+ ```
266
+
267
+ - List **OS Versions**
268
+ ```ruby
269
+ leantesting.platform.os.find(1).versions.all.toArray
270
+ ```
271
+
272
+
273
+ - List **Browsers**
274
+ ```ruby
275
+ leantesting.platform.browsers.all.toArray
276
+ ```
277
+
278
+ - Retrieve Existing **Browser**
279
+ ```ruby
280
+ leantesting.platform.browsers.find(1).data
281
+ ```
282
+
283
+ - List **Browser Versions**
284
+ ```ruby
285
+ leantesting.platform.browsers.find(1).versions.all.toArray
286
+ ```
287
+
288
+ ----
289
+
290
+ - Using **Filters**
291
+ ```ruby
292
+ leantesting.projects.find(3515).bugs.all({'limit' => 2, 'page' => 5}).toArray
293
+ ```
294
+
295
+ - **Entity List** Functions
296
+ ```ruby
297
+ browsers = leantesting.platform.browsers.all
298
+ p browsers.total
299
+ p browsers.totalPages
300
+ p browsers.count
301
+ p browsers.toArray
302
+ ```
303
+
304
+ - **Entity List** Iterator
305
+ When used in for loops, entity lists will automatically cycle to first page, regardless of `page` filter.
306
+ After ending the loop, the entity list will **NOT** revert to first page or the initial instancing `page` filter setting in order not to cause useless API request calls.
307
+ ```ruby
308
+ comments = leantesting.bugs.find(38483).comments.all({'limit' => 1})
309
+ comments.each{ |page| p page }
310
+ ```
311
+
312
+ - **Entity List** Manual Iteration
313
+ ```ruby
314
+ comments = leantesting.bugs.find(38483).comments.all({'limit' => 1})
315
+ p comments.toArray
316
+
317
+ # Will return false if unable to move forwards
318
+ comments.next; p comments.toArray
319
+
320
+ # Will return false if already on last page
321
+ comments.last; p comments.toArray
322
+
323
+ # Will return false if unable to move backwards
324
+ comments.previous; p comments.toArray
325
+
326
+ # Will return false if already on first page
327
+ comments.first; p comments.toArray
328
+ ```
329
+
330
+ ## Security
331
+
332
+ Need to report a security vulnerability? Send us an email to support@crowdsourcedtesting.com or go directly to our security bug bounty site [https://hackerone.com/leantesting](https://hackerone.com/leantesting).
333
+
334
+ ## Development
335
+
336
+ Install dependencies:
337
+
338
+ ```bash
339
+ bundle install
340
+ ```
341
+
342
+ ## Tests
343
+
344
+ Install dependencies as mentioned above, then you can run the test suite:
345
+
346
+ ```bash
347
+ rake test
348
+ ```
@@ -0,0 +1,9 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << :test
5
+ t.test_files = Dir['tests/**/*Test.rb']
6
+ t.verbose = true
7
+ end
8
+
9
+ task default: [:test]
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'leantesting'
3
+ s.version = '1.0.0'
4
+ s.date = '2015-11-20'
5
+ s.platform = Gem::Platform::RUBY
6
+ s.summary = 'Lean Testing Ruby SDK'
7
+ s.description = 'Lean Testing Ruby SDK'
8
+ s.authors = ['Marcel Bontaș']
9
+ s.email = ['marcel.bontas@yandex.ru']
10
+ s.files = Dir['lib/**/*', 'tests/**/*'] + ['Gemfile', 'leantesting.gemspec', 'LICENSE', 'Rakefile', 'README.md']
11
+ s.homepage = 'https://leantesting.com/'
12
+ s.license = 'proprietary'
13
+ s.require_path= 'lib'
14
+
15
+ s.add_dependency 'json', '~> 1.8'
16
+ s.add_dependency 'curb', '~> 0.8'
17
+
18
+ s.add_development_dependency 'minitest', '~> 5.8'
19
+ s.add_development_dependency 'mocha', '~> 1.1'
20
+ end
@@ -0,0 +1,195 @@
1
+ #
2
+ # Represents an API Request definition.
3
+ #
4
+ # An APIRequest's parameters can be modified on demand and can be executed multiple times for the same instance.
5
+ #
6
+ class APIRequest
7
+
8
+ #
9
+ # Constructs API request definition.
10
+ #
11
+ # Arguments:
12
+ # origin Client -- Originating client reference
13
+ # endpoint String -- API endpoint
14
+ # method String -- Method for cURL call - supports GET, POST, PUT or DELETE only
15
+ # opts Hash -- (optional) Additional options to pass to request.
16
+ # Request parameters (if any) must bep assed here.
17
+ #
18
+ # Exceptions:
19
+ # SDKInvalidArgException if method is non-string.
20
+ # SDKInvalidArgException if unsupported method is provided.
21
+ # SDKInvalidArgException if endpoint is non-string.
22
+ # SDKInvalidArgException if opts param is not a hash.
23
+ #
24
+ def initialize(origin, endpoint, method, opts = nil)
25
+ @default_ops = { # Basic support for extended opts
26
+ 'base_uri' => 'https://api.leantesting.com', # assumed default for API base
27
+ 'form_data' => false, # sets content type to multipart/form-data if true
28
+ 'params' => {} # params to be pased in request
29
+ }
30
+
31
+ if !opts
32
+ opts = {}
33
+ end
34
+
35
+ if !method.is_a? String
36
+ raise SDKInvalidArgException, '`method` must be a string'
37
+ elsif !['GET', 'POST', 'PUT', 'DELETE'].include? method
38
+ raise SDKInvalidArgException, 'unsupported ' + method + ' `method`'
39
+ elsif !endpoint.is_a? String
40
+ raise SDKInvalidArgException, '`endpoint` must be a string'
41
+ elsif !opts.is_a? Hash
42
+ raise SDKInvalidArgException, '`opts` must be a hash'
43
+ end
44
+
45
+ @opts = @default_ops.clone
46
+ self.updateOpts(opts)
47
+
48
+ @origin = origin
49
+ @endpoint = endpoint
50
+ @method = method
51
+ end
52
+
53
+ #
54
+ # Updates options list inside API request definition.
55
+ #
56
+ # Arguments:
57
+ # opts Hash -- (optional) Additional options array to merge with previous option values
58
+ #
59
+ # Exceptions:
60
+ # SDKInvalidArgException if opts param is not a hash.
61
+ # SDKInvalidArgException if provided parameter list is non-hash parameter.
62
+ #
63
+ def updateOpts(opts = nil)
64
+ if !opts
65
+ opts = {}
66
+ end
67
+
68
+ if !opts.is_a? Hash
69
+ raise SDKInvalidArgException, '`opts` must be a hash'
70
+ elsif opts.has_key? 'params' && !opts['params'].is_a?(Hash)
71
+ raise SDKInvalidArgException '`opts[\'params\']` must be a hash'
72
+ end
73
+
74
+ @opts.merge!(opts)
75
+ end
76
+
77
+ #
78
+ # Executes cURL call as per current API definition state.
79
+ #
80
+ # Returns:
81
+ # String -- Returns resulting data response from server (including errors and inconsistencies)
82
+ #
83
+ def call
84
+
85
+ ch = Curl::Easy.new
86
+
87
+ callUrl = @opts['base_uri'] + @endpoint
88
+
89
+ if @origin.getCurrentToken.is_a? String
90
+ ch.headers['Authorization'] = 'Bearer ' + @origin.getCurrentToken
91
+ end
92
+
93
+ ch.url = callUrl
94
+
95
+ ch.header_in_body = false
96
+
97
+ case @method
98
+ when 'GET'
99
+ callUrl += '?' + Curl::postalize(@opts['params'])
100
+ ch.url = callUrl
101
+
102
+ ch.http_get
103
+ when 'POST'
104
+ if @opts['form_data'] == true && (@opts.has_key? 'file_path')
105
+ ch.headers['Content-Type'] = 'multipart/form-data'
106
+ ch.multipart_form_post = true
107
+
108
+ ch.http_post(Curl::PostField.file('file', @opts['file_path']))
109
+ else
110
+ jsonData = JSON.generate(@opts['params'])
111
+
112
+ ch.headers['Content-Type'] = 'application/json'
113
+ ch.headers['Content-Length'] = jsonData.length
114
+
115
+ ch.http_post(jsonData)
116
+ end
117
+ when 'PUT'
118
+ jsonData = JSON.generate(@opts['params'])
119
+
120
+ ch.headers['Content-Type'] = 'application/json'
121
+ ch.headers['Content-Length'] = jsonData.length
122
+
123
+ ch.http_put(jsonData)
124
+ when 'DELETE'
125
+ ch.http_delete
126
+ end
127
+
128
+ curlData = ch.body_str
129
+ curlStatus = ch.status.to_i()
130
+
131
+ ch.close
132
+ ch = nil
133
+
134
+ {
135
+ 'data' => curlData,
136
+ 'status' => curlStatus
137
+ }
138
+ end
139
+
140
+ #
141
+ # Does cURL data interpretation
142
+ #
143
+ # Exceptions:
144
+ # SDKErrorResponseException if the remote response is an error.
145
+ # A server response is interpreted as an error if obtained status code differs from expected status code.
146
+ # Expected status codes are `200 OK` for GET/POST/PUT, `204 No Content` for DELETE.
147
+ # SDKBadJSONResponseException if the remote response contains erronated or invalid JSON contents
148
+ #
149
+ # Returns:
150
+ # Hash -- In case of successful request, a JSON decoded object is returned.
151
+ # Boolean -- If a DELETE request is issued, returns true if call is successful (exception otherwise).
152
+ #
153
+ def exec
154
+ if @origin.debugReturn && @origin.debugReturn.has_key?('data') && @origin.debugReturn.has_key?('status')
155
+
156
+ curlData = @origin.debugReturn['data']
157
+ curlStatus = @origin.debugReturn['status']
158
+
159
+ else
160
+
161
+ callReturn = call
162
+ curlData = callReturn['data']
163
+ curlStatus = callReturn['status']
164
+
165
+ end
166
+
167
+ if @method == 'DELETE'
168
+ expectedHTTPStatus = 204
169
+ else
170
+ expectedHTTPStatus = 200
171
+ end
172
+
173
+ if curlStatus != expectedHTTPStatus
174
+ raise SDKErrorResponseException, curlStatus.to_s() + ' - ' + curlData
175
+ end
176
+
177
+ if @method == 'DELETE' # if DELETE request, expect no output
178
+ return true
179
+ end
180
+
181
+ begin
182
+ jsonData = JSON.parse(curlData) # normally, expect JSON qualified output
183
+ rescue JSON::ParserError
184
+ raise SDKBadJSONResponseException, curlData
185
+ end
186
+
187
+ if jsonData.length.zero?
188
+ raise SDKUnexpectedResponseException, 'Empty object received'
189
+ end
190
+
191
+ return jsonData
192
+
193
+ end
194
+
195
+ end