Class: Ittybit::Media::MediaUpdateResponse
- Inherits:
-
Object
- Object
- Ittybit::Media::MediaUpdateResponse
- Defined in:
- lib/ittybit/media/types/media_update_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #alt ⇒ String readonly
- #background ⇒ String readonly
- #created ⇒ DateTime readonly
- #duration ⇒ Float readonly
- #files ⇒ Array<Ittybit::Media::MediaUpdateResponseFilesItem> readonly
- #height ⇒ Integer readonly
- #id ⇒ String readonly
- #kind ⇒ Ittybit::Media::MediaUpdateResponseKind readonly
- #metadata ⇒ Hash{String => Object} readonly
- #object ⇒ String readonly
- #title ⇒ String readonly
- #updated ⇒ DateTime readonly
- #urls ⇒ Hash{String => Object} readonly
- #width ⇒ Integer readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Ittybit::Media::MediaUpdateResponse
Deserialize a JSON object to an instance of MediaUpdateResponse.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(id:, object:, files:, urls:, created:, updated:, kind: OMIT, title: OMIT, alt: OMIT, width: OMIT, height: OMIT, duration: OMIT, background: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Ittybit::Media::MediaUpdateResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of MediaUpdateResponse to a JSON object.
Constructor Details
#initialize(id:, object:, files:, urls:, created:, updated:, kind: OMIT, title: OMIT, alt: OMIT, width: OMIT, height: OMIT, duration: OMIT, background: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Ittybit::Media::MediaUpdateResponse
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 64 def initialize(id:, object:, files:, urls:, created:, updated:, kind: OMIT, title: OMIT, alt: OMIT, width: OMIT, height: OMIT, duration: OMIT, background: OMIT, metadata: OMIT, additional_properties: nil) @id = id @object = object @kind = kind if kind != OMIT @title = title if title != OMIT @alt = alt if alt != OMIT @width = width if width != OMIT @height = height if height != OMIT @duration = duration if duration != OMIT @files = files @urls = urls @background = background if background != OMIT @metadata = if != OMIT @created = created @updated = updated @additional_properties = additional_properties @_field_set = { "id": id, "object": object, "kind": kind, "title": title, "alt": alt, "width": width, "height": height, "duration": duration, "files": files, "urls": urls, "background": background, "metadata": , "created": created, "updated": updated }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
41 42 43 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 41 def additional_properties @additional_properties end |
#alt ⇒ String (readonly)
21 22 23 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 21 def alt @alt end |
#background ⇒ String (readonly)
33 34 35 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 33 def background @background end |
#created ⇒ DateTime (readonly)
37 38 39 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 37 def created @created end |
#duration ⇒ Float (readonly)
27 28 29 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 27 def duration @duration end |
#files ⇒ Array<Ittybit::Media::MediaUpdateResponseFilesItem> (readonly)
29 30 31 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 29 def files @files end |
#height ⇒ Integer (readonly)
25 26 27 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 25 def height @height end |
#id ⇒ String (readonly)
13 14 15 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 13 def id @id end |
#kind ⇒ Ittybit::Media::MediaUpdateResponseKind (readonly)
17 18 19 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 17 def kind @kind end |
#metadata ⇒ Hash{String => Object} (readonly)
35 36 37 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 35 def @metadata end |
#object ⇒ String (readonly)
15 16 17 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 15 def object @object end |
#title ⇒ String (readonly)
19 20 21 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 19 def title @title end |
#updated ⇒ DateTime (readonly)
39 40 41 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 39 def updated @updated end |
#urls ⇒ Hash{String => Object} (readonly)
31 32 33 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 31 def urls @urls end |
#width ⇒ Integer (readonly)
23 24 25 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 23 def width @width end |
Class Method Details
.from_json(json_object:) ⇒ Ittybit::Media::MediaUpdateResponse
Deserialize a JSON object to an instance of MediaUpdateResponse
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 105 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] object = parsed_json["object"] kind = parsed_json["kind"] title = parsed_json["title"] alt = parsed_json["alt"] width = parsed_json["width"] height = parsed_json["height"] duration = parsed_json["duration"] files = parsed_json["files"]&.map do |item| item = item.to_json Ittybit::Media::MediaUpdateResponseFilesItem.from_json(json_object: item) end urls = parsed_json["urls"] background = parsed_json["background"] = parsed_json["metadata"] created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?) updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?) new( id: id, object: object, kind: kind, title: title, alt: alt, width: width, height: height, duration: duration, files: files, urls: urls, background: background, metadata: , created: created, updated: updated, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 157 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.") obj.kind&.is_a?(Ittybit::Media::MediaUpdateResponseKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.") obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") obj.alt&.is_a?(String) != false || raise("Passed value for field obj.alt is not the expected type, validation failed.") obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.") obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.") obj.duration&.is_a?(Float) != false || raise("Passed value for field obj.duration is not the expected type, validation failed.") obj.files.is_a?(Array) != false || raise("Passed value for field obj.files is not the expected type, validation failed.") obj.urls.is_a?(Hash) != false || raise("Passed value for field obj.urls is not the expected type, validation failed.") obj.background&.is_a?(String) != false || raise("Passed value for field obj.background is not the expected type, validation failed.") obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.") obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of MediaUpdateResponse to a JSON object
147 148 149 |
# File 'lib/ittybit/media/types/media_update_response.rb', line 147 def to_json(*_args) @_field_set&.to_json end |