fastpixapi 1.1.1 → 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 +55 -62
- data/lib/fastpix_client/drm_configurations.rb +51 -58
- data/lib/fastpix_client/errors.rb +36 -25
- data/lib/fastpix_client/fastpixapi.rb +2 -4
- data/lib/fastpix_client/in_video_ai_features.rb +108 -168
- data/lib/fastpix_client/input_video.rb +75 -83
- data/lib/fastpix_client/live_playback.rb +82 -99
- data/lib/fastpix_client/manage_live_stream.rb +145 -261
- data/lib/fastpix_client/manage_videos.rb +252 -567
- data/lib/fastpix_client/metrics.rb +82 -126
- data/lib/fastpix_client/models/components/addtrackrequest.rb +1 -1
- data/lib/fastpix_client/models/components/createlivestreamresponsedto.rb +10 -18
- data/lib/fastpix_client/models/components/createmediarequest.rb +10 -19
- data/lib/fastpix_client/models/components/deletesigningkeyresponse.rb +6 -2
- data/lib/fastpix_client/models/components/deletesigningkeyresponsedata.rb +33 -0
- 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/pullvideoinput.rb +1 -1
- 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 +52 -125
- data/lib/fastpix_client/models/components/watermarkinput.rb +1 -1
- data/lib/fastpix_client/models/components.rb +1 -0
- 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/add_media_to_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/add_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/cancel_upload_response.rb +1 -1
- data/lib/fastpix_client/models/operations/change_media_order_in_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/complete_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_media_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_new_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_playbackid_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_signing_key_response.rb +1 -1
- data/lib/fastpix_client/models/operations/create_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_from_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_playbackid_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_signing_key_response.rb +1 -1
- data/lib/fastpix_client/models/operations/delete_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/direct_upload_video_media_request.rb +1 -1
- data/lib/fastpix_client/models/operations/direct_upload_video_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/disable_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/enable_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/generate_subtitle_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_all_playlists_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_all_streams_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_live_stream_viewer_count_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_clips_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_media_summary_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_playback_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_playlist_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_signing_key_by_id_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_specific_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_timeseries_data_response.rb +1 -1
- data/lib/fastpix_client/models/operations/get_video_view_details_response.rb +1 -1
- data/lib/fastpix_client/models/operations/getdrmconfiguration_response.rb +1 -1
- data/lib/fastpix_client/models/operations/getdrmconfigurationbyid_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_breakdown_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_by_top_content_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_comparison_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_dimensions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_errors_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_filter_values_for_dimension_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_live_clips_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_overall_values_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_playback_ids_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_signing_keys_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_uploads_response.rb +1 -1
- data/lib/fastpix_client/models/operations/list_video_views_response.rb +1 -1
- data/lib/fastpix_client/models/operations/push_media_settings.rb +10 -21
- data/lib/fastpix_client/models/operations/retrievemediainputinfo_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_a_playlist_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_domain_restrictions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_live_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_chapters_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_moderation_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_named_entities_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_summary_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_media_track_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_specific_simulcast_of_stream_response.rb +1 -1
- data/lib/fastpix_client/models/operations/update_user_agent_restrictions_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_media_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_mp4support_response.rb +1 -1
- data/lib/fastpix_client/models/operations/updated_source_access_response.rb +1 -1
- data/lib/fastpix_client/playback.rb +123 -214
- data/lib/fastpix_client/playlist.rb +151 -297
- 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 +4 -4
- data/lib/fastpix_client/signing_keys.rb +79 -123
- data/lib/fastpix_client/simulcast_stream.rb +101 -145
- data/lib/fastpix_client/start_live_stream.rb +54 -36
- 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 -55
- data/lib/fastpix_client/utils/utils.rb +19 -37
- data/lib/fastpix_client/views.rb +71 -95
- data/lib/fastpixapi.rb +10 -10
- data/lib/openssl_patch.rb +24 -24
- metadata +20 -4
|
@@ -53,23 +53,17 @@ module FastpixClient
|
|
|
53
53
|
def self.match_content_type(content_type, pattern)
|
|
54
54
|
return true if content_type == pattern || ['*', '*/*'].include?(pattern)
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
pieces.each do |piece|
|
|
58
|
-
return true if pattern == piece.strip
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
false
|
|
56
|
+
content_type.split(';').any? { |piece| pattern == piece.strip }
|
|
62
57
|
end
|
|
63
58
|
|
|
64
59
|
sig { params(status_code: Integer, status_codes: T::Array[String]).returns(T::Boolean) }
|
|
65
60
|
def self.match_status_code(status_code, status_codes)
|
|
66
61
|
return true if status_codes.include? 'default'
|
|
62
|
+
|
|
67
63
|
status_code = status_code.to_s
|
|
68
|
-
status_codes.
|
|
69
|
-
|
|
70
|
-
return true if code.downcase.end_with?('xx') && status_code[0] == code[0]
|
|
64
|
+
status_codes.any? do |code|
|
|
65
|
+
code == status_code || (code.downcase.end_with?('xx') && status_code[0] == code[0])
|
|
71
66
|
end
|
|
72
|
-
false
|
|
73
67
|
end
|
|
74
68
|
|
|
75
69
|
sig { params(optional: T::Boolean).returns(T.proc.params(s: String).returns(T.nilable(DateTime))) }
|
|
@@ -130,15 +124,7 @@ module FastpixClient
|
|
|
130
124
|
if field.length == 2
|
|
131
125
|
if field[0].nil?
|
|
132
126
|
# Handle multiple values for the same field name (arrays)
|
|
133
|
-
|
|
134
|
-
# Convert to array if not already
|
|
135
|
-
unless payload[field_name].is_a?(Array)
|
|
136
|
-
payload[field_name] = [payload[field_name]]
|
|
137
|
-
end
|
|
138
|
-
payload[field_name] << field[1]
|
|
139
|
-
else
|
|
140
|
-
payload[field_name] = field[1]
|
|
141
|
-
end
|
|
127
|
+
_add_form_payload_value(payload, field_name, field[1])
|
|
142
128
|
else
|
|
143
129
|
# Handle file uploads
|
|
144
130
|
file_part = Faraday::Multipart::FilePart.new(
|
|
@@ -146,34 +132,30 @@ module FastpixClient
|
|
|
146
132
|
'application/octet-stream',
|
|
147
133
|
field[0]
|
|
148
134
|
)
|
|
149
|
-
|
|
135
|
+
|
|
150
136
|
# Handle multiple files for the same field name (arrays)
|
|
151
|
-
|
|
152
|
-
unless payload[field_name].is_a?(Array)
|
|
153
|
-
payload[field_name] = [payload[field_name]]
|
|
154
|
-
end
|
|
155
|
-
payload[field_name] << file_part
|
|
156
|
-
else
|
|
157
|
-
payload[field_name] = file_part
|
|
158
|
-
end
|
|
137
|
+
_add_form_payload_value(payload, field_name, file_part)
|
|
159
138
|
end
|
|
160
139
|
elsif field.length == 3
|
|
161
140
|
param_part = Faraday::Multipart::ParamPart.new(field[1].to_json, field[2])
|
|
162
|
-
|
|
141
|
+
|
|
163
142
|
# Handle multiple values for the same field name (arrays)
|
|
164
|
-
|
|
165
|
-
unless payload[field_name].is_a?(Array)
|
|
166
|
-
payload[field_name] = [payload[field_name]]
|
|
167
|
-
end
|
|
168
|
-
payload[field_name] << param_part
|
|
169
|
-
else
|
|
170
|
-
payload[field_name] = param_part
|
|
171
|
-
end
|
|
143
|
+
_add_form_payload_value(payload, field_name, param_part)
|
|
172
144
|
end
|
|
173
145
|
end
|
|
174
146
|
payload
|
|
175
147
|
end
|
|
176
148
|
|
|
149
|
+
# Stores a form value, converting to an array when the field name repeats.
|
|
150
|
+
def self._add_form_payload_value(payload, field_name, value)
|
|
151
|
+
if payload.key?(field_name)
|
|
152
|
+
payload[field_name] = [payload[field_name]] unless payload[field_name].is_a?(Array)
|
|
153
|
+
payload[field_name] << value
|
|
154
|
+
else
|
|
155
|
+
payload[field_name] = value
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
177
159
|
sig { params(param_name: Symbol, value: Object, param_type: String, gbls: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]])).returns(Object) }
|
|
178
160
|
def self._populate_from_globals(param_name, value, param_type, gbls)
|
|
179
161
|
if value.nil? && !gbls.nil?
|
data/lib/fastpix_client/views.rb
CHANGED
|
@@ -14,6 +14,42 @@ module FastpixClient
|
|
|
14
14
|
extend T::Sig
|
|
15
15
|
class Views
|
|
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 views
|
|
19
55
|
|
|
@@ -51,7 +87,7 @@ module FastpixClient
|
|
|
51
87
|
#
|
|
52
88
|
# 2. Specify the timespan for which you want to retrieve the video views using the `timespan[]` parameter.
|
|
53
89
|
#
|
|
54
|
-
# 3. Filter the views based on dimensions such as browser, device, video title, viewer ID, etc., using the `filterby[]` parameter. Get the dimensions by calling <a href="https://
|
|
90
|
+
# 3. Filter the views based on dimensions such as browser, device, video title, viewer ID, etc., using the `filterby[]` parameter. Get the dimensions by calling <a href="https://fastpix.com/docs/video-data-api/dimensions/list-dimensions">list the dimensions</a> endpoint.
|
|
55
91
|
#
|
|
56
92
|
# 4. Paginate the results using the `limit` and `offset` parameters.
|
|
57
93
|
#
|
|
@@ -59,7 +95,7 @@ module FastpixClient
|
|
|
59
95
|
#
|
|
60
96
|
# 6. You receive a response containing the list of video views matching the specified criteria.
|
|
61
97
|
#
|
|
62
|
-
# Each view in the response includes a unique `viewId`. You can use this `viewId` with the <a href="https://
|
|
98
|
+
# Each view in the response includes a unique `viewId`. You can use this `viewId` with the <a href="https://fastpix.com/docs/video-data-api/views/get-video-view-details">Get Video View Details</a> endpoint to retrieve more detailed information about that specific view.
|
|
63
99
|
#
|
|
64
100
|
#
|
|
65
101
|
# #### Example
|
|
@@ -67,15 +103,15 @@ module FastpixClient
|
|
|
67
103
|
# If you manage a video streaming service and want to analyze content performance across devices and browsers. By calling the List Video Views endpoint with filters such as `browser_name` and `device_type`, you can identify which platforms are most popular with your audience. This information helps optimize content for widely used platforms and troubleshoot playback issues on less common devices.
|
|
68
104
|
#
|
|
69
105
|
#
|
|
70
|
-
# Related guide: <a href="https://
|
|
106
|
+
# Related guide: <a href="https://fastpix.com/docs/concepts/audience-metrics">Audience metrics</a>, <a href="https://fastpix.com/docs/working-with-video-data/explore-the-dashboard#1-views-dashboard">Views dashboard</a>
|
|
71
107
|
url, params = @sdk_configuration.get_server_details
|
|
72
108
|
base_url = Utils.template_url(url, params)
|
|
73
109
|
url = "#{base_url}/data/viewlist"
|
|
74
110
|
headers = {}
|
|
75
111
|
headers = T.cast(headers, T::Hash[String, String])
|
|
76
112
|
query_params = Utils.get_query_params(Models::Operations::ListVideoViewsRequest, request, nil)
|
|
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
|
|
|
@@ -114,32 +150,12 @@ module FastpixClient
|
|
|
114
150
|
rescue StandardError => e
|
|
115
151
|
error = e
|
|
116
152
|
ensure
|
|
117
|
-
|
|
118
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
119
|
-
error: error,
|
|
120
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
121
|
-
hook_ctx: hook_ctx
|
|
122
|
-
),
|
|
123
|
-
response: http_response
|
|
124
|
-
)
|
|
125
|
-
else
|
|
126
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
127
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
128
|
-
hook_ctx: hook_ctx
|
|
129
|
-
),
|
|
130
|
-
response: http_response
|
|
131
|
-
)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
if http_response.nil?
|
|
135
|
-
raise error if !error.nil?
|
|
136
|
-
raise 'no response'
|
|
137
|
-
end
|
|
153
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
138
154
|
end
|
|
139
155
|
|
|
140
|
-
content_type = http_response.headers.fetch(
|
|
156
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
141
157
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
142
|
-
if Utils.match_content_type(content_type,
|
|
158
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
143
159
|
http_response = @sdk_configuration.hooks.after_success(
|
|
144
160
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
145
161
|
hook_ctx: hook_ctx
|
|
@@ -157,14 +173,14 @@ module FastpixClient
|
|
|
157
173
|
|
|
158
174
|
return response
|
|
159
175
|
else
|
|
160
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
176
|
+
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
|
|
161
177
|
end
|
|
162
178
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
163
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
179
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
164
180
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
165
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
181
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
166
182
|
else
|
|
167
|
-
if Utils.match_content_type(content_type,
|
|
183
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
168
184
|
http_response = @sdk_configuration.hooks.after_success(
|
|
169
185
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
170
186
|
hook_ctx: hook_ctx
|
|
@@ -182,7 +198,7 @@ module FastpixClient
|
|
|
182
198
|
|
|
183
199
|
return response
|
|
184
200
|
else
|
|
185
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
201
|
+
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
|
|
186
202
|
end
|
|
187
203
|
end
|
|
188
204
|
end
|
|
@@ -201,7 +217,7 @@ module FastpixClient
|
|
|
201
217
|
# If a developer receives a report of a poor viewing experience for a specific user. By using this endpoint with the users `viewId`, the developer can retrieve metrics like buffering duration, playback errors, and session length. This data allows the developer to pinpoint issues (such as poor connectivity or a browser-specific problem) and take steps to improve the user experience.
|
|
202
218
|
#
|
|
203
219
|
#
|
|
204
|
-
# Related guide: <a href="https://
|
|
220
|
+
# Related guide: <a href="https://fastpix.com/docs/concepts/what-video-data-do-we-capture#/">What Video Data do we capture?</a>
|
|
205
221
|
request = Models::Operations::GetVideoViewDetailsRequest.new(
|
|
206
222
|
view_id: view_id
|
|
207
223
|
)
|
|
@@ -215,8 +231,8 @@ module FastpixClient
|
|
|
215
231
|
)
|
|
216
232
|
headers = {}
|
|
217
233
|
headers = T.cast(headers, T::Hash[String, String])
|
|
218
|
-
headers['Accept'] =
|
|
219
|
-
headers[
|
|
234
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
235
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
220
236
|
|
|
221
237
|
security = @sdk_configuration.security_source&.call
|
|
222
238
|
|
|
@@ -254,32 +270,12 @@ module FastpixClient
|
|
|
254
270
|
rescue StandardError => e
|
|
255
271
|
error = e
|
|
256
272
|
ensure
|
|
257
|
-
|
|
258
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
259
|
-
error: error,
|
|
260
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
261
|
-
hook_ctx: hook_ctx
|
|
262
|
-
),
|
|
263
|
-
response: http_response
|
|
264
|
-
)
|
|
265
|
-
else
|
|
266
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
267
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
268
|
-
hook_ctx: hook_ctx
|
|
269
|
-
),
|
|
270
|
-
response: http_response
|
|
271
|
-
)
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
if http_response.nil?
|
|
275
|
-
raise error if !error.nil?
|
|
276
|
-
raise 'no response'
|
|
277
|
-
end
|
|
273
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
278
274
|
end
|
|
279
275
|
|
|
280
|
-
content_type = http_response.headers.fetch(
|
|
276
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
281
277
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
282
|
-
if Utils.match_content_type(content_type,
|
|
278
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
283
279
|
http_response = @sdk_configuration.hooks.after_success(
|
|
284
280
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
285
281
|
hook_ctx: hook_ctx
|
|
@@ -297,14 +293,14 @@ module FastpixClient
|
|
|
297
293
|
|
|
298
294
|
return response
|
|
299
295
|
else
|
|
300
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
296
|
+
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
|
|
301
297
|
end
|
|
302
298
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
303
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
299
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
304
300
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
305
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
301
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
306
302
|
else
|
|
307
|
-
if Utils.match_content_type(content_type,
|
|
303
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
308
304
|
http_response = @sdk_configuration.hooks.after_success(
|
|
309
305
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
310
306
|
hook_ctx: hook_ctx
|
|
@@ -322,7 +318,7 @@ module FastpixClient
|
|
|
322
318
|
|
|
323
319
|
return response
|
|
324
320
|
else
|
|
325
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
321
|
+
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
|
|
326
322
|
end
|
|
327
323
|
end
|
|
328
324
|
end
|
|
@@ -346,7 +342,7 @@ module FastpixClient
|
|
|
346
342
|
# 5. You receive a response containing the list of top video views matching the specified criteria.
|
|
347
343
|
#
|
|
348
344
|
#
|
|
349
|
-
# Related guide: <a href="https://
|
|
345
|
+
# Related guide: <a href="https://fastpix.com/docs/working-with-video-data/identify-top-performing-content">Get top-performing content</a>
|
|
350
346
|
#
|
|
351
347
|
request = Models::Operations::ListByTopContentRequest.new(
|
|
352
348
|
timespan: timespan,
|
|
@@ -359,8 +355,8 @@ module FastpixClient
|
|
|
359
355
|
headers = {}
|
|
360
356
|
headers = T.cast(headers, T::Hash[String, String])
|
|
361
357
|
query_params = Utils.get_query_params(Models::Operations::ListByTopContentRequest, request, nil)
|
|
362
|
-
headers['Accept'] =
|
|
363
|
-
headers[
|
|
358
|
+
headers['Accept'] = CONTENT_TYPE_JSON
|
|
359
|
+
headers[USER_AGENT_HEADER] = @sdk_configuration.user_agent
|
|
364
360
|
|
|
365
361
|
security = @sdk_configuration.security_source&.call
|
|
366
362
|
|
|
@@ -399,32 +395,12 @@ module FastpixClient
|
|
|
399
395
|
rescue StandardError => e
|
|
400
396
|
error = e
|
|
401
397
|
ensure
|
|
402
|
-
|
|
403
|
-
http_response = @sdk_configuration.hooks.after_error(
|
|
404
|
-
error: error,
|
|
405
|
-
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
406
|
-
hook_ctx: hook_ctx
|
|
407
|
-
),
|
|
408
|
-
response: http_response
|
|
409
|
-
)
|
|
410
|
-
else
|
|
411
|
-
http_response = @sdk_configuration.hooks.after_success(
|
|
412
|
-
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
413
|
-
hook_ctx: hook_ctx
|
|
414
|
-
),
|
|
415
|
-
response: http_response
|
|
416
|
-
)
|
|
417
|
-
end
|
|
418
|
-
|
|
419
|
-
if http_response.nil?
|
|
420
|
-
raise error if !error.nil?
|
|
421
|
-
raise 'no response'
|
|
422
|
-
end
|
|
398
|
+
http_response = apply_after_request_hooks(http_response, error, hook_ctx)
|
|
423
399
|
end
|
|
424
400
|
|
|
425
|
-
content_type = http_response.headers.fetch(
|
|
401
|
+
content_type = http_response.headers.fetch(CONTENT_TYPE_HEADER, DEFAULT_CONTENT_TYPE)
|
|
426
402
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
427
|
-
if Utils.match_content_type(content_type,
|
|
403
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
428
404
|
http_response = @sdk_configuration.hooks.after_success(
|
|
429
405
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
430
406
|
hook_ctx: hook_ctx
|
|
@@ -442,14 +418,14 @@ module FastpixClient
|
|
|
442
418
|
|
|
443
419
|
return response
|
|
444
420
|
else
|
|
445
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
421
|
+
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
|
|
446
422
|
end
|
|
447
423
|
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
448
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
424
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
449
425
|
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
450
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
426
|
+
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), API_ERROR_OCCURRED
|
|
451
427
|
else
|
|
452
|
-
if Utils.match_content_type(content_type,
|
|
428
|
+
if Utils.match_content_type(content_type, CONTENT_TYPE_JSON)
|
|
453
429
|
http_response = @sdk_configuration.hooks.after_success(
|
|
454
430
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
455
431
|
hook_ctx: hook_ctx
|
|
@@ -467,7 +443,7 @@ module FastpixClient
|
|
|
467
443
|
|
|
468
444
|
return response
|
|
469
445
|
else
|
|
470
|
-
raise ::FastpixClient::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response),
|
|
446
|
+
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
|
|
471
447
|
end
|
|
472
448
|
end
|
|
473
449
|
end
|
data/lib/fastpixapi.rb
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
# typed: true
|
|
4
4
|
# frozen_string_literal: true
|
|
5
5
|
|
|
6
|
+
require_relative 'fastpix_client/utils/utils'
|
|
7
|
+
require_relative 'fastpix_client/utils/request_bodies'
|
|
8
|
+
require_relative 'fastpix_client/utils/query_params'
|
|
9
|
+
require_relative 'fastpix_client/utils/forms'
|
|
10
|
+
require_relative 'fastpix_client/utils/headers'
|
|
11
|
+
require_relative 'fastpix_client/utils/url'
|
|
12
|
+
require_relative 'fastpix_client/utils/security'
|
|
13
|
+
require_relative 'crystalline'
|
|
14
|
+
require_relative 'fastpix_client/sdkconfiguration'
|
|
15
|
+
|
|
6
16
|
module FastpixClient
|
|
7
17
|
autoload :Fastpixapi, 'fastpix_client/fastpixapi'
|
|
8
18
|
autoload :InputVideo, 'fastpix_client/input_video'
|
|
@@ -27,13 +37,3 @@ module FastpixClient
|
|
|
27
37
|
autoload :Callbacks, 'fastpix_client/models/callbacks'
|
|
28
38
|
end
|
|
29
39
|
end
|
|
30
|
-
|
|
31
|
-
require_relative 'fastpix_client/utils/utils'
|
|
32
|
-
require_relative 'fastpix_client/utils/request_bodies'
|
|
33
|
-
require_relative 'fastpix_client/utils/query_params'
|
|
34
|
-
require_relative 'fastpix_client/utils/forms'
|
|
35
|
-
require_relative 'fastpix_client/utils/headers'
|
|
36
|
-
require_relative 'fastpix_client/utils/url'
|
|
37
|
-
require_relative 'fastpix_client/utils/security'
|
|
38
|
-
require_relative 'crystalline'
|
|
39
|
-
require_relative 'fastpix_client/sdkconfiguration'
|
data/lib/openssl_patch.rb
CHANGED
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
# This file should be required before any SSL connections are made
|
|
3
3
|
|
|
4
4
|
require 'openssl'
|
|
5
|
+
require 'net/http'
|
|
5
6
|
|
|
6
|
-
# Find certificate file
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
# Find certificate file (guarded so re-loading this file does not warn about a
|
|
8
|
+
# redefined constant).
|
|
9
|
+
unless defined?(CERT_FILE)
|
|
10
|
+
CERT_FILE = if File.exist?('/opt/homebrew/etc/openssl@3/cert.pem')
|
|
11
|
+
'/opt/homebrew/etc/openssl@3/cert.pem'
|
|
12
|
+
elsif File.exist?('/usr/local/etc/openssl@3/cert.pem')
|
|
13
|
+
'/usr/local/etc/openssl@3/cert.pem'
|
|
14
|
+
elsif File.exist?('/etc/ssl/certs/ca-certificates.crt')
|
|
15
|
+
'/etc/ssl/certs/ca-certificates.crt'
|
|
16
|
+
elsif File.exist?('/etc/ssl/cert.pem')
|
|
17
|
+
'/etc/ssl/cert.pem'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
18
20
|
|
|
19
21
|
if CERT_FILE && File.exist?(CERT_FILE)
|
|
20
22
|
# Patch OpenSSL::X509::Store to always include our certificate file
|
|
21
23
|
module OpenSSL
|
|
22
24
|
module X509
|
|
23
25
|
class Store
|
|
24
|
-
alias_method :original_set_default_paths, :set_default_paths
|
|
25
|
-
|
|
26
|
+
alias_method :original_set_default_paths, :set_default_paths unless method_defined?(:original_set_default_paths)
|
|
27
|
+
|
|
26
28
|
def set_default_paths
|
|
27
29
|
original_set_default_paths
|
|
28
30
|
add_file(CERT_FILE) if CERT_FILE && File.exist?(CERT_FILE)
|
|
@@ -37,19 +39,19 @@ if CERT_FILE && File.exist?(CERT_FILE)
|
|
|
37
39
|
ENV['CURL_CA_BUNDLE'] = CERT_FILE
|
|
38
40
|
ENV['RUBY_OPENSSL_CA_CERT_FILE'] = CERT_FILE
|
|
39
41
|
|
|
40
|
-
# Also patch the default certificate file constant
|
|
41
|
-
|
|
42
|
+
# Also patch the default certificate file constant when it is mutable. On
|
|
43
|
+
# newer Ruby versions this constant is frozen, so skip it there (the
|
|
44
|
+
# SSL_CERT_FILE env var above already covers that case) to avoid FrozenError.
|
|
45
|
+
if defined?(OpenSSL::X509::DEFAULT_CERT_FILE) && !OpenSSL::X509::DEFAULT_CERT_FILE.frozen?
|
|
42
46
|
OpenSSL::X509::DEFAULT_CERT_FILE.replace(CERT_FILE)
|
|
43
47
|
end
|
|
44
48
|
|
|
45
|
-
# Patch Net::HTTP to use our certificate store
|
|
46
|
-
|
|
47
|
-
require 'net/http' unless defined?(Net::HTTP)
|
|
48
|
-
|
|
49
|
+
# Patch Net::HTTP to use our certificate store (skipped if Net::HTTP is unavailable)
|
|
50
|
+
if defined?(Net::HTTP)
|
|
49
51
|
module Net
|
|
50
52
|
class HTTP
|
|
51
|
-
alias_method :original_connect, :connect
|
|
52
|
-
|
|
53
|
+
alias_method :original_connect, :connect unless method_defined?(:original_connect)
|
|
54
|
+
|
|
53
55
|
def connect
|
|
54
56
|
original_connect
|
|
55
57
|
# Ensure SSL context uses our certificate file (skip if context is frozen, e.g. Bundler)
|
|
@@ -62,8 +64,6 @@ if CERT_FILE && File.exist?(CERT_FILE)
|
|
|
62
64
|
end
|
|
63
65
|
end
|
|
64
66
|
end
|
|
65
|
-
rescue LoadError
|
|
66
|
-
# Net::HTTP not available, skip
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
puts "[OpenSSL Patch] Configured SSL certificate: #{CERT_FILE}" if ENV['DEBUG']
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastpixapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- FastPix
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -100,6 +100,20 @@ dependencies:
|
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
102
|
version: '1.0'
|
|
103
|
+
- !ruby/object:Gem::Dependency
|
|
104
|
+
name: json_schemer
|
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '2.3'
|
|
110
|
+
type: :development
|
|
111
|
+
prerelease: false
|
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '2.3'
|
|
103
117
|
- !ruby/object:Gem::Dependency
|
|
104
118
|
name: minitest
|
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -222,7 +236,7 @@ description: A robust, type-safe Ruby SDK for seamless integration with the Fast
|
|
|
222
236
|
API platform for media uploads, live streaming, playlists, analytics, and signing
|
|
223
237
|
keys.
|
|
224
238
|
email:
|
|
225
|
-
- devs@fastpix.
|
|
239
|
+
- devs@fastpix.com
|
|
226
240
|
executables: []
|
|
227
241
|
extensions: []
|
|
228
242
|
extra_rdoc_files: []
|
|
@@ -344,6 +358,7 @@ files:
|
|
|
344
358
|
- lib/fastpix_client/models/components/default_error.rbi
|
|
345
359
|
- lib/fastpix_client/models/components/deletesigningkeyresponse.rb
|
|
346
360
|
- lib/fastpix_client/models/components/deletesigningkeyresponse.rbi
|
|
361
|
+
- lib/fastpix_client/models/components/deletesigningkeyresponsedata.rb
|
|
347
362
|
- lib/fastpix_client/models/components/directupload.rb
|
|
348
363
|
- lib/fastpix_client/models/components/directupload.rbi
|
|
349
364
|
- lib/fastpix_client/models/components/directupload_status.rb
|
|
@@ -707,6 +722,7 @@ files:
|
|
|
707
722
|
- lib/fastpix_client/models/errors.rb
|
|
708
723
|
- lib/fastpix_client/models/errors/apierror.rb
|
|
709
724
|
- lib/fastpix_client/models/errors/apierror.rbi
|
|
725
|
+
- lib/fastpix_client/models/errors/empty_response_error.rb
|
|
710
726
|
- lib/fastpix_client/models/operations.rb
|
|
711
727
|
- lib/fastpix_client/models/operations/add_media_to_playlist_request.rb
|
|
712
728
|
- lib/fastpix_client/models/operations/add_media_to_playlist_request.rbi
|
|
@@ -1211,7 +1227,7 @@ files:
|
|
|
1211
1227
|
- lib/openssl_patch.rb
|
|
1212
1228
|
- test/sdk_examples_test.rb
|
|
1213
1229
|
- test/test_helper.rb
|
|
1214
|
-
homepage: https://
|
|
1230
|
+
homepage: https://fastpix.com/docs
|
|
1215
1231
|
licenses:
|
|
1216
1232
|
- Apache-2.0
|
|
1217
1233
|
metadata: {}
|