ittybit 0.7.4
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 +7 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/ittybit/automations/client.rb +412 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger.rb +75 -0
- data/lib/ittybit/automations/types/automations_update_request_trigger_conditions_item.rb +69 -0
- data/lib/ittybit/files/client.rb +437 -0
- data/lib/ittybit/files/types/files_delete_response.rb +89 -0
- data/lib/ittybit/files/types/files_delete_response_data.rb +60 -0
- data/lib/ittybit/media/client.rb +367 -0
- data/lib/ittybit/signatures/client.rb +132 -0
- data/lib/ittybit/signatures/types/signatures_create_request_method.rb +13 -0
- data/lib/ittybit/tasks/client.rb +379 -0
- data/lib/ittybit/tasks/types/tasks_create_request_kind.rb +22 -0
- data/lib/ittybit/tasks/types/tasks_list_request_kind.rb +26 -0
- data/lib/ittybit/tasks/types/tasks_list_request_status.rb +16 -0
- data/lib/ittybit/types/api_response_base.rb +5 -0
- data/lib/ittybit/types/automation.rb +141 -0
- data/lib/ittybit/types/automation_list_response.rb +90 -0
- data/lib/ittybit/types/automation_response.rb +87 -0
- data/lib/ittybit/types/automation_status.rb +10 -0
- data/lib/ittybit/types/automation_trigger.rb +72 -0
- data/lib/ittybit/types/automation_trigger_conditions_item.rb +65 -0
- data/lib/ittybit/types/confirmation_response.rb +87 -0
- data/lib/ittybit/types/confirmation_response_data.rb +55 -0
- data/lib/ittybit/types/error.rb +57 -0
- data/lib/ittybit/types/error_response.rb +74 -0
- data/lib/ittybit/types/file.rb +319 -0
- data/lib/ittybit/types/file_kind.rb +10 -0
- data/lib/ittybit/types/file_list_response.rb +90 -0
- data/lib/ittybit/types/file_object.rb +10 -0
- data/lib/ittybit/types/file_response.rb +87 -0
- data/lib/ittybit/types/file_status.rb +11 -0
- data/lib/ittybit/types/links.rb +67 -0
- data/lib/ittybit/types/links_list.rb +103 -0
- data/lib/ittybit/types/media.rb +195 -0
- data/lib/ittybit/types/media_kind.rb +10 -0
- data/lib/ittybit/types/media_list_response.rb +90 -0
- data/lib/ittybit/types/media_response.rb +87 -0
- data/lib/ittybit/types/media_source.rb +261 -0
- data/lib/ittybit/types/media_source_kind.rb +10 -0
- data/lib/ittybit/types/media_source_object.rb +10 -0
- data/lib/ittybit/types/media_source_status.rb +11 -0
- data/lib/ittybit/types/media_urls.rb +70 -0
- data/lib/ittybit/types/meta.rb +5 -0
- data/lib/ittybit/types/meta_list.rb +103 -0
- data/lib/ittybit/types/signature.rb +110 -0
- data/lib/ittybit/types/signature_response.rb +87 -0
- data/lib/ittybit/types/task.rb +204 -0
- data/lib/ittybit/types/task_kind.rb +5 -0
- data/lib/ittybit/types/task_list_response.rb +90 -0
- data/lib/ittybit/types/task_response.rb +87 -0
- data/lib/ittybit/types/task_results.rb +74 -0
- data/lib/ittybit/types/task_status.rb +15 -0
- data/lib/ittybit/types/task_summary.rb +138 -0
- data/lib/ittybit/types/task_summary_kind.rb +25 -0
- data/lib/ittybit/types/task_summary_status.rb +15 -0
- data/lib/ittybit/types/workflow_task_step.rb +112 -0
- data/lib/ittybit/types/workflow_task_step_kind.rb +25 -0
- data/lib/ittybit.rb +86 -0
- data/lib/requests.rb +177 -0
- data/lib/types_export.rb +53 -0
- metadata +185 -0
@@ -0,0 +1,261 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "media_source_object"
|
4
|
+
require_relative "media_source_kind"
|
5
|
+
require "date"
|
6
|
+
require_relative "media_source_status"
|
7
|
+
require "ostruct"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Ittybit
|
11
|
+
class MediaSource
|
12
|
+
# @return [String] Unique identifier for the file.
|
13
|
+
attr_reader :id
|
14
|
+
# @return [Ittybit::MediaSourceObject] Object type
|
15
|
+
attr_reader :object
|
16
|
+
# @return [Ittybit::MediaSourceKind] The general type of media.
|
17
|
+
attr_reader :kind
|
18
|
+
# @return [String] MIME type.
|
19
|
+
attr_reader :type
|
20
|
+
# @return [String] Codec of the file.
|
21
|
+
attr_reader :codec
|
22
|
+
# @return [String] Container of the file.
|
23
|
+
attr_reader :container
|
24
|
+
# @return [Integer] Width in pixels (for image/video).
|
25
|
+
attr_reader :width
|
26
|
+
# @return [Integer] Height in pixels (for image/video).
|
27
|
+
attr_reader :height
|
28
|
+
# @return [String] Orientation of the file.
|
29
|
+
attr_reader :orientation
|
30
|
+
# @return [Float] Rotation value for image files with embedded EXIF data.
|
31
|
+
attr_reader :rotation
|
32
|
+
# @return [Boolean] Indicates if the file has alpha channel.
|
33
|
+
attr_reader :transparency
|
34
|
+
# @return [Integer] Number of frames in the file.
|
35
|
+
attr_reader :frames
|
36
|
+
# @return [Float] Duration in seconds (for audio/video).
|
37
|
+
attr_reader :duration
|
38
|
+
# @return [Float] Frames per second (for video).
|
39
|
+
attr_reader :fps
|
40
|
+
# @return [Integer] File size in bytes.
|
41
|
+
attr_reader :filesize
|
42
|
+
# @return [Integer] Bitrate for audio/video files.
|
43
|
+
attr_reader :bitrate
|
44
|
+
# @return [String] Optional reference value. If set, the file URL will be included in the parent
|
45
|
+
# media `urls` object.
|
46
|
+
attr_reader :ref
|
47
|
+
# @return [String] The folder path where the file is stored.
|
48
|
+
attr_reader :folder
|
49
|
+
# @return [String] The name of the file.
|
50
|
+
attr_reader :filename
|
51
|
+
# @return [String] Publicly accessible URL for the file.
|
52
|
+
attr_reader :url
|
53
|
+
# @return [Hash{String => Object}] User-defined key-value metadata.
|
54
|
+
attr_reader :metadata
|
55
|
+
# @return [Boolean] Indicates this is the original file rather than a variant.
|
56
|
+
attr_reader :original
|
57
|
+
# @return [DateTime] Timestamp when the file record was created.
|
58
|
+
attr_reader :created
|
59
|
+
# @return [DateTime] Timestamp when the file record was last updated.
|
60
|
+
attr_reader :updated
|
61
|
+
# @return [Ittybit::MediaSourceStatus] Processing status of the file.
|
62
|
+
attr_reader :status
|
63
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
64
|
+
attr_reader :additional_properties
|
65
|
+
# @return [Object]
|
66
|
+
attr_reader :_field_set
|
67
|
+
protected :_field_set
|
68
|
+
|
69
|
+
OMIT = Object.new
|
70
|
+
|
71
|
+
# @param id [String] Unique identifier for the file.
|
72
|
+
# @param object [Ittybit::MediaSourceObject] Object type
|
73
|
+
# @param kind [Ittybit::MediaSourceKind] The general type of media.
|
74
|
+
# @param type [String] MIME type.
|
75
|
+
# @param codec [String] Codec of the file.
|
76
|
+
# @param container [String] Container of the file.
|
77
|
+
# @param width [Integer] Width in pixels (for image/video).
|
78
|
+
# @param height [Integer] Height in pixels (for image/video).
|
79
|
+
# @param orientation [String] Orientation of the file.
|
80
|
+
# @param rotation [Float] Rotation value for image files with embedded EXIF data.
|
81
|
+
# @param transparency [Boolean] Indicates if the file has alpha channel.
|
82
|
+
# @param frames [Integer] Number of frames in the file.
|
83
|
+
# @param duration [Float] Duration in seconds (for audio/video).
|
84
|
+
# @param fps [Float] Frames per second (for video).
|
85
|
+
# @param filesize [Integer] File size in bytes.
|
86
|
+
# @param bitrate [Integer] Bitrate for audio/video files.
|
87
|
+
# @param ref [String] Optional reference value. If set, the file URL will be included in the parent
|
88
|
+
# media `urls` object.
|
89
|
+
# @param folder [String] The folder path where the file is stored.
|
90
|
+
# @param filename [String] The name of the file.
|
91
|
+
# @param url [String] Publicly accessible URL for the file.
|
92
|
+
# @param metadata [Hash{String => Object}] User-defined key-value metadata.
|
93
|
+
# @param original [Boolean] Indicates this is the original file rather than a variant.
|
94
|
+
# @param created [DateTime] Timestamp when the file record was created.
|
95
|
+
# @param updated [DateTime] Timestamp when the file record was last updated.
|
96
|
+
# @param status [Ittybit::MediaSourceStatus] Processing status of the file.
|
97
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
98
|
+
# @return [Ittybit::MediaSource]
|
99
|
+
def initialize(id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT,
|
100
|
+
orientation: OMIT, rotation: OMIT, transparency: OMIT, frames: OMIT, duration: OMIT, fps: OMIT, bitrate: OMIT, ref: OMIT, folder: OMIT, filename: OMIT, metadata: OMIT, original: OMIT, additional_properties: nil)
|
101
|
+
@id = id
|
102
|
+
@object = object
|
103
|
+
@kind = kind
|
104
|
+
@type = type
|
105
|
+
@codec = codec if codec != OMIT
|
106
|
+
@container = container if container != OMIT
|
107
|
+
@width = width if width != OMIT
|
108
|
+
@height = height if height != OMIT
|
109
|
+
@orientation = orientation if orientation != OMIT
|
110
|
+
@rotation = rotation if rotation != OMIT
|
111
|
+
@transparency = transparency if transparency != OMIT
|
112
|
+
@frames = frames if frames != OMIT
|
113
|
+
@duration = duration if duration != OMIT
|
114
|
+
@fps = fps if fps != OMIT
|
115
|
+
@filesize = filesize
|
116
|
+
@bitrate = bitrate if bitrate != OMIT
|
117
|
+
@ref = ref if ref != OMIT
|
118
|
+
@folder = folder if folder != OMIT
|
119
|
+
@filename = filename if filename != OMIT
|
120
|
+
@url = url
|
121
|
+
@metadata = metadata if metadata != OMIT
|
122
|
+
@original = original if original != OMIT
|
123
|
+
@created = created
|
124
|
+
@updated = updated
|
125
|
+
@status = status
|
126
|
+
@additional_properties = additional_properties
|
127
|
+
@_field_set = {
|
128
|
+
"id": id,
|
129
|
+
"object": object,
|
130
|
+
"kind": kind,
|
131
|
+
"type": type,
|
132
|
+
"codec": codec,
|
133
|
+
"container": container,
|
134
|
+
"width": width,
|
135
|
+
"height": height,
|
136
|
+
"orientation": orientation,
|
137
|
+
"rotation": rotation,
|
138
|
+
"transparency": transparency,
|
139
|
+
"frames": frames,
|
140
|
+
"duration": duration,
|
141
|
+
"fps": fps,
|
142
|
+
"filesize": filesize,
|
143
|
+
"bitrate": bitrate,
|
144
|
+
"ref": ref,
|
145
|
+
"folder": folder,
|
146
|
+
"filename": filename,
|
147
|
+
"url": url,
|
148
|
+
"metadata": metadata,
|
149
|
+
"original": original,
|
150
|
+
"created": created,
|
151
|
+
"updated": updated,
|
152
|
+
"status": status
|
153
|
+
}.reject do |_k, v|
|
154
|
+
v == OMIT
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Deserialize a JSON object to an instance of MediaSource
|
159
|
+
#
|
160
|
+
# @param json_object [String]
|
161
|
+
# @return [Ittybit::MediaSource]
|
162
|
+
def self.from_json(json_object:)
|
163
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
164
|
+
parsed_json = JSON.parse(json_object)
|
165
|
+
id = parsed_json["id"]
|
166
|
+
object = parsed_json["object"]
|
167
|
+
kind = parsed_json["kind"]
|
168
|
+
type = parsed_json["type"]
|
169
|
+
codec = parsed_json["codec"]
|
170
|
+
container = parsed_json["container"]
|
171
|
+
width = parsed_json["width"]
|
172
|
+
height = parsed_json["height"]
|
173
|
+
orientation = parsed_json["orientation"]
|
174
|
+
rotation = parsed_json["rotation"]
|
175
|
+
transparency = parsed_json["transparency"]
|
176
|
+
frames = parsed_json["frames"]
|
177
|
+
duration = parsed_json["duration"]
|
178
|
+
fps = parsed_json["fps"]
|
179
|
+
filesize = parsed_json["filesize"]
|
180
|
+
bitrate = parsed_json["bitrate"]
|
181
|
+
ref = parsed_json["ref"]
|
182
|
+
folder = parsed_json["folder"]
|
183
|
+
filename = parsed_json["filename"]
|
184
|
+
url = parsed_json["url"]
|
185
|
+
metadata = parsed_json["metadata"]
|
186
|
+
original = parsed_json["original"]
|
187
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
188
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
189
|
+
status = parsed_json["status"]
|
190
|
+
new(
|
191
|
+
id: id,
|
192
|
+
object: object,
|
193
|
+
kind: kind,
|
194
|
+
type: type,
|
195
|
+
codec: codec,
|
196
|
+
container: container,
|
197
|
+
width: width,
|
198
|
+
height: height,
|
199
|
+
orientation: orientation,
|
200
|
+
rotation: rotation,
|
201
|
+
transparency: transparency,
|
202
|
+
frames: frames,
|
203
|
+
duration: duration,
|
204
|
+
fps: fps,
|
205
|
+
filesize: filesize,
|
206
|
+
bitrate: bitrate,
|
207
|
+
ref: ref,
|
208
|
+
folder: folder,
|
209
|
+
filename: filename,
|
210
|
+
url: url,
|
211
|
+
metadata: metadata,
|
212
|
+
original: original,
|
213
|
+
created: created,
|
214
|
+
updated: updated,
|
215
|
+
status: status,
|
216
|
+
additional_properties: struct
|
217
|
+
)
|
218
|
+
end
|
219
|
+
|
220
|
+
# Serialize an instance of MediaSource to a JSON object
|
221
|
+
#
|
222
|
+
# @return [String]
|
223
|
+
def to_json(*_args)
|
224
|
+
@_field_set&.to_json
|
225
|
+
end
|
226
|
+
|
227
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
228
|
+
# hash and check each fields type against the current object's property
|
229
|
+
# definitions.
|
230
|
+
#
|
231
|
+
# @param obj [Object]
|
232
|
+
# @return [Void]
|
233
|
+
def self.validate_raw(obj:)
|
234
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
235
|
+
obj.object.is_a?(Ittybit::MediaSourceObject) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
|
236
|
+
obj.kind.is_a?(Ittybit::MediaSourceKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
|
237
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
238
|
+
obj.codec&.is_a?(String) != false || raise("Passed value for field obj.codec is not the expected type, validation failed.")
|
239
|
+
obj.container&.is_a?(String) != false || raise("Passed value for field obj.container is not the expected type, validation failed.")
|
240
|
+
obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.")
|
241
|
+
obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.")
|
242
|
+
obj.orientation&.is_a?(String) != false || raise("Passed value for field obj.orientation is not the expected type, validation failed.")
|
243
|
+
obj.rotation&.is_a?(Float) != false || raise("Passed value for field obj.rotation is not the expected type, validation failed.")
|
244
|
+
obj.transparency&.is_a?(Boolean) != false || raise("Passed value for field obj.transparency is not the expected type, validation failed.")
|
245
|
+
obj.frames&.is_a?(Integer) != false || raise("Passed value for field obj.frames is not the expected type, validation failed.")
|
246
|
+
obj.duration&.is_a?(Float) != false || raise("Passed value for field obj.duration is not the expected type, validation failed.")
|
247
|
+
obj.fps&.is_a?(Float) != false || raise("Passed value for field obj.fps is not the expected type, validation failed.")
|
248
|
+
obj.filesize.is_a?(Integer) != false || raise("Passed value for field obj.filesize is not the expected type, validation failed.")
|
249
|
+
obj.bitrate&.is_a?(Integer) != false || raise("Passed value for field obj.bitrate is not the expected type, validation failed.")
|
250
|
+
obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
|
251
|
+
obj.folder&.is_a?(String) != false || raise("Passed value for field obj.folder is not the expected type, validation failed.")
|
252
|
+
obj.filename&.is_a?(String) != false || raise("Passed value for field obj.filename is not the expected type, validation failed.")
|
253
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
254
|
+
obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
|
255
|
+
obj.original&.is_a?(Boolean) != false || raise("Passed value for field obj.original is not the expected type, validation failed.")
|
256
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
257
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
258
|
+
obj.status.is_a?(Ittybit::MediaSourceStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
# URLs for the media item.
|
8
|
+
class MediaUrls
|
9
|
+
# @return [String] URL of the original source file.
|
10
|
+
attr_reader :original
|
11
|
+
# @return [String] Example URL for a file with the ref value "example_ref". Any key with a-z, 0-9,
|
12
|
+
# _, or - is possible, but keys must start with a letter.
|
13
|
+
attr_reader :example_ref
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param original [String] URL of the original source file.
|
23
|
+
# @param example_ref [String] Example URL for a file with the ref value "example_ref". Any key with a-z, 0-9,
|
24
|
+
# _, or - is possible, but keys must start with a letter.
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Ittybit::MediaUrls]
|
27
|
+
def initialize(original: OMIT, example_ref: OMIT, additional_properties: nil)
|
28
|
+
@original = original if original != OMIT
|
29
|
+
@example_ref = example_ref if example_ref != OMIT
|
30
|
+
@additional_properties = additional_properties
|
31
|
+
@_field_set = { "original": original, "example_ref": example_ref }.reject do |_k, v|
|
32
|
+
v == OMIT
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of MediaUrls
|
37
|
+
#
|
38
|
+
# @param json_object [String]
|
39
|
+
# @return [Ittybit::MediaUrls]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
original = parsed_json["original"]
|
44
|
+
example_ref = parsed_json["example_ref"]
|
45
|
+
new(
|
46
|
+
original: original,
|
47
|
+
example_ref: example_ref,
|
48
|
+
additional_properties: struct
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Serialize an instance of MediaUrls to a JSON object
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
def to_json(*_args)
|
56
|
+
@_field_set&.to_json
|
57
|
+
end
|
58
|
+
|
59
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
60
|
+
# hash and check each fields type against the current object's property
|
61
|
+
# definitions.
|
62
|
+
#
|
63
|
+
# @param obj [Object]
|
64
|
+
# @return [Void]
|
65
|
+
def self.validate_raw(obj:)
|
66
|
+
obj.original&.is_a?(String) != false || raise("Passed value for field obj.original is not the expected type, validation failed.")
|
67
|
+
obj.example_ref&.is_a?(String) != false || raise("Passed value for field obj.example_ref is not the expected type, validation failed.")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class MetaList
|
8
|
+
# @return [String] Request ID
|
9
|
+
attr_reader :request_id
|
10
|
+
# @return [String] Type of the primary data value in the response
|
11
|
+
attr_reader :type
|
12
|
+
# @return [Integer] Number of items per page.
|
13
|
+
attr_reader :limit
|
14
|
+
# @return [Integer] Total number of items matching the query.
|
15
|
+
attr_reader :total
|
16
|
+
# @return [Integer] Current page number.
|
17
|
+
attr_reader :page
|
18
|
+
# @return [Integer] Total number of pages.
|
19
|
+
attr_reader :pages
|
20
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
attr_reader :additional_properties
|
22
|
+
# @return [Object]
|
23
|
+
attr_reader :_field_set
|
24
|
+
protected :_field_set
|
25
|
+
|
26
|
+
OMIT = Object.new
|
27
|
+
|
28
|
+
# @param request_id [String] Request ID
|
29
|
+
# @param type [String] Type of the primary data value in the response
|
30
|
+
# @param limit [Integer] Number of items per page.
|
31
|
+
# @param total [Integer] Total number of items matching the query.
|
32
|
+
# @param page [Integer] Current page number.
|
33
|
+
# @param pages [Integer] Total number of pages.
|
34
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
35
|
+
# @return [Ittybit::MetaList]
|
36
|
+
def initialize(request_id: OMIT, type: OMIT, limit: OMIT, total: OMIT, page: OMIT, pages: OMIT,
|
37
|
+
additional_properties: nil)
|
38
|
+
@request_id = request_id if request_id != OMIT
|
39
|
+
@type = type if type != OMIT
|
40
|
+
@limit = limit if limit != OMIT
|
41
|
+
@total = total if total != OMIT
|
42
|
+
@page = page if page != OMIT
|
43
|
+
@pages = pages if pages != OMIT
|
44
|
+
@additional_properties = additional_properties
|
45
|
+
@_field_set = {
|
46
|
+
"request_id": request_id,
|
47
|
+
"type": type,
|
48
|
+
"limit": limit,
|
49
|
+
"total": total,
|
50
|
+
"page": page,
|
51
|
+
"pages": pages
|
52
|
+
}.reject do |_k, v|
|
53
|
+
v == OMIT
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Deserialize a JSON object to an instance of MetaList
|
58
|
+
#
|
59
|
+
# @param json_object [String]
|
60
|
+
# @return [Ittybit::MetaList]
|
61
|
+
def self.from_json(json_object:)
|
62
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
63
|
+
parsed_json = JSON.parse(json_object)
|
64
|
+
request_id = parsed_json["request_id"]
|
65
|
+
type = parsed_json["type"]
|
66
|
+
limit = parsed_json["limit"]
|
67
|
+
total = parsed_json["total"]
|
68
|
+
page = parsed_json["page"]
|
69
|
+
pages = parsed_json["pages"]
|
70
|
+
new(
|
71
|
+
request_id: request_id,
|
72
|
+
type: type,
|
73
|
+
limit: limit,
|
74
|
+
total: total,
|
75
|
+
page: page,
|
76
|
+
pages: pages,
|
77
|
+
additional_properties: struct
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Serialize an instance of MetaList to a JSON object
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
def to_json(*_args)
|
85
|
+
@_field_set&.to_json
|
86
|
+
end
|
87
|
+
|
88
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
89
|
+
# hash and check each fields type against the current object's property
|
90
|
+
# definitions.
|
91
|
+
#
|
92
|
+
# @param obj [Object]
|
93
|
+
# @return [Void]
|
94
|
+
def self.validate_raw(obj:)
|
95
|
+
obj.request_id&.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
|
96
|
+
obj.type&.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
97
|
+
obj.limit&.is_a?(Integer) != false || raise("Passed value for field obj.limit is not the expected type, validation failed.")
|
98
|
+
obj.total&.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
99
|
+
obj.page&.is_a?(Integer) != false || raise("Passed value for field obj.page is not the expected type, validation failed.")
|
100
|
+
obj.pages&.is_a?(Integer) != false || raise("Passed value for field obj.pages is not the expected type, validation failed.")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Ittybit
|
7
|
+
class Signature
|
8
|
+
# @return [String] Domain of the signed URL
|
9
|
+
attr_reader :domain
|
10
|
+
# @return [String] Filename of the signed file
|
11
|
+
attr_reader :filename
|
12
|
+
# @return [String] Folder of the signed file
|
13
|
+
attr_reader :folder
|
14
|
+
# @return [Integer] Expiry timestamp of the signed URL
|
15
|
+
attr_reader :expiry
|
16
|
+
# @return [String] HTTP method for the signed URL
|
17
|
+
attr_reader :method
|
18
|
+
# @return [String] Generated signature for the signed URL
|
19
|
+
attr_reader :signature
|
20
|
+
# @return [String] Generated signed URL
|
21
|
+
attr_reader :url
|
22
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
attr_reader :additional_properties
|
24
|
+
# @return [Object]
|
25
|
+
attr_reader :_field_set
|
26
|
+
protected :_field_set
|
27
|
+
|
28
|
+
OMIT = Object.new
|
29
|
+
|
30
|
+
# @param domain [String] Domain of the signed URL
|
31
|
+
# @param filename [String] Filename of the signed file
|
32
|
+
# @param folder [String] Folder of the signed file
|
33
|
+
# @param expiry [Integer] Expiry timestamp of the signed URL
|
34
|
+
# @param method [String] HTTP method for the signed URL
|
35
|
+
# @param signature [String] Generated signature for the signed URL
|
36
|
+
# @param url [String] Generated signed URL
|
37
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
38
|
+
# @return [Ittybit::Signature]
|
39
|
+
def initialize(domain:, filename:, expiry:, method:, signature:, url:, folder: OMIT, additional_properties: nil)
|
40
|
+
@domain = domain
|
41
|
+
@filename = filename
|
42
|
+
@folder = folder if folder != OMIT
|
43
|
+
@expiry = expiry
|
44
|
+
@method = method
|
45
|
+
@signature = signature
|
46
|
+
@url = url
|
47
|
+
@additional_properties = additional_properties
|
48
|
+
@_field_set = {
|
49
|
+
"domain": domain,
|
50
|
+
"filename": filename,
|
51
|
+
"folder": folder,
|
52
|
+
"expiry": expiry,
|
53
|
+
"method": method,
|
54
|
+
"signature": signature,
|
55
|
+
"url": url
|
56
|
+
}.reject do |_k, v|
|
57
|
+
v == OMIT
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Deserialize a JSON object to an instance of Signature
|
62
|
+
#
|
63
|
+
# @param json_object [String]
|
64
|
+
# @return [Ittybit::Signature]
|
65
|
+
def self.from_json(json_object:)
|
66
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
67
|
+
parsed_json = JSON.parse(json_object)
|
68
|
+
domain = parsed_json["domain"]
|
69
|
+
filename = parsed_json["filename"]
|
70
|
+
folder = parsed_json["folder"]
|
71
|
+
expiry = parsed_json["expiry"]
|
72
|
+
method = parsed_json["method"]
|
73
|
+
signature = parsed_json["signature"]
|
74
|
+
url = parsed_json["url"]
|
75
|
+
new(
|
76
|
+
domain: domain,
|
77
|
+
filename: filename,
|
78
|
+
folder: folder,
|
79
|
+
expiry: expiry,
|
80
|
+
method: method,
|
81
|
+
signature: signature,
|
82
|
+
url: url,
|
83
|
+
additional_properties: struct
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Serialize an instance of Signature to a JSON object
|
88
|
+
#
|
89
|
+
# @return [String]
|
90
|
+
def to_json(*_args)
|
91
|
+
@_field_set&.to_json
|
92
|
+
end
|
93
|
+
|
94
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
95
|
+
# hash and check each fields type against the current object's property
|
96
|
+
# definitions.
|
97
|
+
#
|
98
|
+
# @param obj [Object]
|
99
|
+
# @return [Void]
|
100
|
+
def self.validate_raw(obj:)
|
101
|
+
obj.domain.is_a?(String) != false || raise("Passed value for field obj.domain is not the expected type, validation failed.")
|
102
|
+
obj.filename.is_a?(String) != false || raise("Passed value for field obj.filename is not the expected type, validation failed.")
|
103
|
+
obj.folder&.is_a?(String) != false || raise("Passed value for field obj.folder is not the expected type, validation failed.")
|
104
|
+
obj.expiry.is_a?(Integer) != false || raise("Passed value for field obj.expiry is not the expected type, validation failed.")
|
105
|
+
obj.method.is_a?(String) != false || raise("Passed value for field obj.method is not the expected type, validation failed.")
|
106
|
+
obj.signature.is_a?(String) != false || raise("Passed value for field obj.signature is not the expected type, validation failed.")
|
107
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "meta"
|
4
|
+
require_relative "signature"
|
5
|
+
require_relative "links"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Ittybit
|
10
|
+
class SignatureResponse
|
11
|
+
# @return [Ittybit::META]
|
12
|
+
attr_reader :meta
|
13
|
+
# @return [Ittybit::Signature]
|
14
|
+
attr_reader :data
|
15
|
+
# @return [Ittybit::Links]
|
16
|
+
attr_reader :links
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
22
|
+
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param meta [Ittybit::META]
|
26
|
+
# @param data [Ittybit::Signature]
|
27
|
+
# @param links [Ittybit::Links]
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [Ittybit::SignatureResponse]
|
30
|
+
def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
|
31
|
+
@meta = meta if meta != OMIT
|
32
|
+
@data = data if data != OMIT
|
33
|
+
@links = links if links != OMIT
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
@_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
|
36
|
+
v == OMIT
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Deserialize a JSON object to an instance of SignatureResponse
|
41
|
+
#
|
42
|
+
# @param json_object [String]
|
43
|
+
# @return [Ittybit::SignatureResponse]
|
44
|
+
def self.from_json(json_object:)
|
45
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
46
|
+
parsed_json = JSON.parse(json_object)
|
47
|
+
meta = parsed_json["meta"]
|
48
|
+
if parsed_json["data"].nil?
|
49
|
+
data = nil
|
50
|
+
else
|
51
|
+
data = parsed_json["data"].to_json
|
52
|
+
data = Ittybit::Signature.from_json(json_object: data)
|
53
|
+
end
|
54
|
+
if parsed_json["links"].nil?
|
55
|
+
links = nil
|
56
|
+
else
|
57
|
+
links = parsed_json["links"].to_json
|
58
|
+
links = Ittybit::Links.from_json(json_object: links)
|
59
|
+
end
|
60
|
+
new(
|
61
|
+
meta: meta,
|
62
|
+
data: data,
|
63
|
+
links: links,
|
64
|
+
additional_properties: struct
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of SignatureResponse to a JSON object
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_json(*_args)
|
72
|
+
@_field_set&.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
76
|
+
# hash and check each fields type against the current object's property
|
77
|
+
# definitions.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
|
83
|
+
obj.data.nil? || Ittybit::Signature.validate_raw(obj: obj.data)
|
84
|
+
obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|