fastpixapi 1.1.2 → 1.1.3
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.
- checksums.yaml +4 -4
- data/lib/crystalline/metadata_fields.rb +56 -48
- data/lib/crystalline/types.rb +3 -3
- data/lib/crystalline.rb +4 -5
- data/lib/fastpix_client/dimensions.rb +51 -58
- data/lib/fastpix_client/drm_configurations.rb +49 -56
- data/lib/fastpix_client/errors.rb +35 -24
- data/lib/fastpix_client/fastpixapi.rb +2 -4
- data/lib/fastpix_client/in_video_ai_features.rb +100 -160
- data/lib/fastpix_client/input_video.rb +66 -74
- data/lib/fastpix_client/live_playback.rb +82 -99
- data/lib/fastpix_client/manage_live_stream.rb +136 -252
- data/lib/fastpix_client/manage_videos.rb +228 -543
- data/lib/fastpix_client/metrics.rb +76 -120
- data/lib/fastpix_client/models/components/createlivestreamresponsedto.rb +10 -18
- data/lib/fastpix_client/models/components/createmediarequest.rb +9 -18
- data/lib/fastpix_client/models/components/getallmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/getcreatelivestreamresponsedto.rb +9 -20
- data/lib/fastpix_client/models/components/getmediaresponse.rb +13 -29
- data/lib/fastpix_client/models/components/live_media_clips.rb +9 -21
- data/lib/fastpix_client/models/components/media.rb +11 -26
- data/lib/fastpix_client/models/components/patchresponsedata.rb +9 -18
- data/lib/fastpix_client/models/components/sourceaccessmedia.rb +11 -26
- data/lib/fastpix_client/models/components/update_media.rb +11 -26
- data/lib/fastpix_client/models/components/views.rb +51 -124
- data/lib/fastpix_client/models/errors/empty_response_error.rb +15 -0
- data/lib/fastpix_client/models/errors.rb +1 -0
- data/lib/fastpix_client/models/operations/push_media_settings.rb +9 -20
- data/lib/fastpix_client/playback.rb +122 -213
- data/lib/fastpix_client/playlist.rb +150 -296
- data/lib/fastpix_client/sdk_hooks/registration.rb +2 -2
- data/lib/fastpix_client/sdk_hooks/types.rb +4 -0
- data/lib/fastpix_client/sdkconfiguration.rb +3 -3
- data/lib/fastpix_client/signing_keys.rb +76 -120
- data/lib/fastpix_client/simulcast_stream.rb +97 -141
- data/lib/fastpix_client/start_live_stream.rb +51 -33
- data/lib/fastpix_client/utils/forms.rb +97 -101
- data/lib/fastpix_client/utils/headers.rb +44 -34
- data/lib/fastpix_client/utils/query_params.rb +39 -29
- data/lib/fastpix_client/utils/request_bodies.rb +4 -8
- data/lib/fastpix_client/utils/security.rb +30 -18
- data/lib/fastpix_client/utils/url.rb +83 -60
- data/lib/fastpix_client/utils/utils.rb +19 -37
- data/lib/fastpix_client/views.rb +66 -90
- data/lib/fastpixapi.rb +10 -10
- data/lib/openssl_patch.rb +24 -24
- metadata +3 -2
|
@@ -107,6 +107,7 @@ module FastpixClient
|
|
|
107
107
|
|
|
108
108
|
sig { overridable.params(config: SDKConfiguration).returns(SDKConfiguration) }
|
|
109
109
|
def sdk_init(config:)
|
|
110
|
+
_ = config
|
|
110
111
|
Kernel.raise NotImplementedError.new
|
|
111
112
|
end
|
|
112
113
|
end
|
|
@@ -123,6 +124,7 @@ module FastpixClient
|
|
|
123
124
|
).returns(Faraday::Request)
|
|
124
125
|
end
|
|
125
126
|
def before_request(hook_ctx:, request:)
|
|
127
|
+
_ = [hook_ctx, request]
|
|
126
128
|
Kernel.raise NotImplementedError.new
|
|
127
129
|
end
|
|
128
130
|
end
|
|
@@ -139,6 +141,7 @@ module FastpixClient
|
|
|
139
141
|
).returns(Faraday::Response)
|
|
140
142
|
end
|
|
141
143
|
def after_success(hook_ctx:, response:)
|
|
144
|
+
_ = [hook_ctx, response]
|
|
142
145
|
Kernel.raise NotImplementedError.new
|
|
143
146
|
end
|
|
144
147
|
end
|
|
@@ -156,6 +159,7 @@ module FastpixClient
|
|
|
156
159
|
).returns(T.nilable(Faraday::Response))
|
|
157
160
|
end
|
|
158
161
|
def after_error(error:, hook_ctx:, response:)
|
|
162
|
+
_ = [error, hook_ctx, response]
|
|
159
163
|
Kernel.raise NotImplementedError.new
|
|
160
164
|
end
|
|
161
165
|
end
|
|
@@ -83,7 +83,7 @@ module FastpixClient
|
|
|
83
83
|
@server_url = server_url
|
|
84
84
|
@timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
85
85
|
@server_idx = server_idx.nil? ? 0 : server_idx
|
|
86
|
-
raise
|
|
86
|
+
raise ArgumentError, "Invalid server index #{server_idx}" if @server_idx.negative? || @server_idx >= SERVERS.length
|
|
87
87
|
if !security_source.nil?
|
|
88
88
|
@security_source = security_source
|
|
89
89
|
elsif !security.nil?
|
|
@@ -91,9 +91,9 @@ module FastpixClient
|
|
|
91
91
|
end
|
|
92
92
|
@language = 'ruby'
|
|
93
93
|
@openapi_doc_version = '1.0.0'
|
|
94
|
-
@sdk_version = '1.1.
|
|
94
|
+
@sdk_version = '1.1.3'
|
|
95
95
|
@gen_version = '2.801.0'
|
|
96
|
-
@user_agent = 'fastpixapi-ruby 1.1.
|
|
96
|
+
@user_agent = 'fastpixapi-ruby 1.1.3'
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
sig { returns([String, T::Hash[Symbol, String]]) }
|
|
@@ -14,6 +14,42 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class SigningKeys
|
|
16
16
|
extend T::Sig
|
|
17
|
+
|
|
18
|
+
API_ERROR_OCCURRED = 'API error occurred'
|
|
19
|
+
CONTENT_TYPE_HEADER = 'Content-Type'
|
|
20
|
+
CONTENT_TYPE_JSON = 'application/json'
|
|
21
|
+
DEFAULT_CONTENT_TYPE = 'application/octet-stream'
|
|
22
|
+
UNKNOWN_CONTENT_TYPE_ERROR = 'Unknown content type received'
|
|
23
|
+
USER_AGENT_HEADER = 'user-agent'
|
|
24
|
+
|
|
25
|
+
# Applies the SDK after-request hooks and ensures a usable response is present.
|
|
26
|
+
sig { params(http_response: T.nilable(Faraday::Response), error: T.nilable(StandardError), hook_ctx: SDKHooks::HookContext).returns(Faraday::Response) }
|
|
27
|
+
def apply_after_request_hooks(http_response, error, hook_ctx)
|
|
28
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
29
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
30
|
+
error: error,
|
|
31
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
32
|
+
hook_ctx: hook_ctx
|
|
33
|
+
),
|
|
34
|
+
response: http_response
|
|
35
|
+
)
|
|
36
|
+
else
|
|
37
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
38
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
39
|
+
hook_ctx: hook_ctx
|
|
40
|
+
),
|
|
41
|
+
response: http_response
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if http_response.nil?
|
|
46
|
+
raise error unless error.nil?
|
|
47
|
+
raise ::FastpixClient::Models::Errors::EmptyResponseError, 'no response'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
http_response
|
|
51
|
+
end
|
|
52
|
+
private :apply_after_request_hooks
|
|
17
53
|
|
|
18
54
|
# Operations involving signing keys
|
|
19
55
|
|
|
@@ -74,8 +110,8 @@ module FastpixClient
|
|
|
74
110
|
url = "#{base_url}/iam/signing-keys"
|
|
75
111
|
headers = {}
|
|
76
112
|
headers = T.cast(headers, T::Hash[String, String])
|
|
77
|
-
headers['Accept'] =
|
|
78
|
-
headers[
|
|
113
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
114
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
79
115
|
|
|
80
116
|
security = @sdk_configuration.security_source&.call
|
|
81
117
|
|
|
@@ -113,32 +149,12 @@ module FastpixClient
|
|
|
113
149
|
rescue StandardError => e
|
|
114
150
|
error = e
|
|
115
151
|
ensure
|
|
116
|
-
|
|
117
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
118
|
-
error: error,
|
|
119
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
120
|
-
hook_ctx: hook_ctx
|
|
121
|
-
),
|
|
122
|
-
response: http_response
|
|
123
|
-
)
|
|
124
|
-
else
|
|
125
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
126
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
127
|
-
hook_ctx: hook_ctx
|
|
128
|
-
),
|
|
129
|
-
response: http_response
|
|
130
|
-
)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
if http_response.nil?
|
|
134
|
-
raise error if !error.nil?
|
|
135
|
-
raise 'no response'
|
|
136
|
-
end
|
|
152
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
137
153
|
end
|
|
138
154
|
|
|
139
|
-
content_type = http_response.headers.fetch(
|
|
155
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
140
156
|
if Utils.match_status_code(http_response.status, ['201'])
|
|
141
|
-
if Utils.match_content_type(content_type,
|
|
157
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
142
158
|
http_response = @sdk_configuration.hooks.after_success(
|
|
143
159
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
144
160
|
hook_ctx: hook_ctx
|
|
@@ -156,14 +172,14 @@ module FastpixClient
|
|
|
156
172
|
|
|
157
173
|
return response
|
|
158
174
|
else
|
|
159
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
175
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
160
176
|
end
|
|
161
177
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
162
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
178
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
163
179
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
164
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
180
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
165
181
|
else
|
|
166
|
-
if Utils.match_content_type(content_type,
|
|
182
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
167
183
|
http_response = @sdk_configuration.hooks.after_success(
|
|
168
184
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
169
185
|
hook_ctx: hook_ctx
|
|
@@ -181,7 +197,7 @@ module FastpixClient
|
|
|
181
197
|
|
|
182
198
|
return response
|
|
183
199
|
else
|
|
184
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
200
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
185
201
|
end
|
|
186
202
|
end
|
|
187
203
|
end
|
|
@@ -221,8 +237,8 @@ module FastpixClient
|
|
|
221
237
|
headers = {}
|
|
222
238
|
headers = T.cast(headers, T::Hash[String, String])
|
|
223
239
|
query_params = Utils.get_query_params(Models::Operations::ListSigningKeysRequest, request, nil)
|
|
224
|
-
headers['Accept'] =
|
|
225
|
-
headers[
|
|
240
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
241
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
226
242
|
|
|
227
243
|
security = @sdk_configuration.security_source&.call
|
|
228
244
|
|
|
@@ -261,32 +277,12 @@ module FastpixClient
|
|
|
261
277
|
rescue StandardError => e
|
|
262
278
|
error = e
|
|
263
279
|
ensure
|
|
264
|
-
|
|
265
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
266
|
-
error: error,
|
|
267
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
268
|
-
hook_ctx: hook_ctx
|
|
269
|
-
),
|
|
270
|
-
response: http_response
|
|
271
|
-
)
|
|
272
|
-
else
|
|
273
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
274
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
275
|
-
hook_ctx: hook_ctx
|
|
276
|
-
),
|
|
277
|
-
response: http_response
|
|
278
|
-
)
|
|
279
|
-
end
|
|
280
|
-
|
|
281
|
-
if http_response.nil?
|
|
282
|
-
raise error if !error.nil?
|
|
283
|
-
raise 'no response'
|
|
284
|
-
end
|
|
280
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
285
281
|
end
|
|
286
282
|
|
|
287
|
-
content_type = http_response.headers.fetch(
|
|
283
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
288
284
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
289
|
-
if Utils.match_content_type(content_type,
|
|
285
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
290
286
|
http_response = @sdk_configuration.hooks.after_success(
|
|
291
287
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
292
288
|
hook_ctx: hook_ctx
|
|
@@ -304,14 +300,14 @@ module FastpixClient
|
|
|
304
300
|
|
|
305
301
|
return response
|
|
306
302
|
else
|
|
307
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
303
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
308
304
|
end
|
|
309
305
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
310
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
306
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
311
307
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
312
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
308
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
313
309
|
else
|
|
314
|
-
if Utils.match_content_type(content_type,
|
|
310
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
315
311
|
http_response = @sdk_configuration.hooks.after_success(
|
|
316
312
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
317
313
|
hook_ctx: hook_ctx
|
|
@@ -329,7 +325,7 @@ module FastpixClient
|
|
|
329
325
|
|
|
330
326
|
return response
|
|
331
327
|
else
|
|
332
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
328
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
333
329
|
end
|
|
334
330
|
end
|
|
335
331
|
end
|
|
@@ -370,8 +366,8 @@ module FastpixClient
|
|
|
370
366
|
)
|
|
371
367
|
headers = {}
|
|
372
368
|
headers = T.cast(headers, T::Hash[String, String])
|
|
373
|
-
headers['Accept'] =
|
|
374
|
-
headers[
|
|
369
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
370
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
375
371
|
|
|
376
372
|
security = @sdk_configuration.security_source&.call
|
|
377
373
|
|
|
@@ -409,32 +405,12 @@ module FastpixClient
|
|
|
409
405
|
rescue StandardError => e
|
|
410
406
|
error = e
|
|
411
407
|
ensure
|
|
412
|
-
|
|
413
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
414
|
-
error: error,
|
|
415
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
416
|
-
hook_ctx: hook_ctx
|
|
417
|
-
),
|
|
418
|
-
response: http_response
|
|
419
|
-
)
|
|
420
|
-
else
|
|
421
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
422
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
423
|
-
hook_ctx: hook_ctx
|
|
424
|
-
),
|
|
425
|
-
response: http_response
|
|
426
|
-
)
|
|
427
|
-
end
|
|
428
|
-
|
|
429
|
-
if http_response.nil?
|
|
430
|
-
raise error if !error.nil?
|
|
431
|
-
raise 'no response'
|
|
432
|
-
end
|
|
408
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
433
409
|
end
|
|
434
410
|
|
|
435
|
-
content_type = http_response.headers.fetch(
|
|
411
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
436
412
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
437
|
-
if Utils.match_content_type(content_type,
|
|
413
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
438
414
|
http_response = @sdk_configuration.hooks.after_success(
|
|
439
415
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
440
416
|
hook_ctx: hook_ctx
|
|
@@ -452,14 +428,14 @@ module FastpixClient
|
|
|
452
428
|
|
|
453
429
|
return response
|
|
454
430
|
else
|
|
455
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
431
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
456
432
|
end
|
|
457
433
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
458
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
434
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
459
435
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
460
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
436
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
461
437
|
else
|
|
462
|
-
if Utils.match_content_type(content_type,
|
|
438
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
463
439
|
http_response = @sdk_configuration.hooks.after_success(
|
|
464
440
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
465
441
|
hook_ctx: hook_ctx
|
|
@@ -477,7 +453,7 @@ module FastpixClient
|
|
|
477
453
|
|
|
478
454
|
return response
|
|
479
455
|
else
|
|
480
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
456
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
481
457
|
end
|
|
482
458
|
end
|
|
483
459
|
end
|
|
@@ -546,8 +522,8 @@ module FastpixClient
|
|
|
546
522
|
)
|
|
547
523
|
headers = {}
|
|
548
524
|
headers = T.cast(headers, T::Hash[String, String])
|
|
549
|
-
headers['Accept'] =
|
|
550
|
-
headers[
|
|
525
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
526
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
551
527
|
|
|
552
528
|
security = @sdk_configuration.security_source&.call
|
|
553
529
|
|
|
@@ -585,32 +561,12 @@ module FastpixClient
|
|
|
585
561
|
rescue StandardError => e
|
|
586
562
|
error = e
|
|
587
563
|
ensure
|
|
588
|
-
|
|
589
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
590
|
-
error: error,
|
|
591
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
592
|
-
hook_ctx: hook_ctx
|
|
593
|
-
),
|
|
594
|
-
response: http_response
|
|
595
|
-
)
|
|
596
|
-
else
|
|
597
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
598
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
599
|
-
hook_ctx: hook_ctx
|
|
600
|
-
),
|
|
601
|
-
response: http_response
|
|
602
|
-
)
|
|
603
|
-
end
|
|
604
|
-
|
|
605
|
-
if http_response.nil?
|
|
606
|
-
raise error if !error.nil?
|
|
607
|
-
raise 'no response'
|
|
608
|
-
end
|
|
564
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
609
565
|
end
|
|
610
566
|
|
|
611
|
-
content_type = http_response.headers.fetch(
|
|
567
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
612
568
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
613
|
-
if Utils.match_content_type(content_type,
|
|
569
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
614
570
|
http_response = @sdk_configuration.hooks.after_success(
|
|
615
571
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
616
572
|
hook_ctx: hook_ctx
|
|
@@ -628,14 +584,14 @@ module FastpixClient
|
|
|
628
584
|
|
|
629
585
|
return response
|
|
630
586
|
else
|
|
631
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
587
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
632
588
|
end
|
|
633
589
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
634
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
590
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
635
591
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
636
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
592
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
637
593
|
else
|
|
638
|
-
if Utils.match_content_type(content_type,
|
|
594
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
639
595
|
http_response = @sdk_configuration.hooks.after_success(
|
|
640
596
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
641
597
|
hook_ctx: hook_ctx
|
|
@@ -653,7 +609,7 @@ module FastpixClient
|
|
|
653
609
|
|
|
654
610
|
return response
|
|
655
611
|
else
|
|
656
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
612
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), UNKNOWN_CONTENT_TYPE_ERROR
|
|
657
613
|
end
|
|
658
614
|
end
|
|
659
615
|
end
|