ittybit 0.7.5.2 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ittybit/automations/client.rb +14 -6
  3. data/lib/ittybit/files/client.rb +67 -77
  4. data/lib/ittybit/media/client.rb +78 -34
  5. data/lib/ittybit/signatures/client.rb +20 -24
  6. data/lib/ittybit/signatures/types/signatures_create_request_method.rb +0 -3
  7. data/lib/ittybit/types/automation.rb +17 -27
  8. data/lib/ittybit/types/automation_list_response.rb +15 -2
  9. data/lib/ittybit/types/automation_response.rb +15 -2
  10. data/lib/ittybit/types/automation_status.rb +0 -1
  11. data/lib/ittybit/types/automation_trigger.rb +11 -16
  12. data/lib/ittybit/types/{confirmation_response_data.rb → confirmation.rb} +11 -9
  13. data/lib/ittybit/types/confirmation_response.rb +20 -7
  14. data/lib/ittybit/types/file.rb +64 -68
  15. data/lib/ittybit/types/file_kind.rb +0 -1
  16. data/lib/ittybit/types/file_list_response.rb +15 -2
  17. data/lib/ittybit/types/file_object.rb +0 -1
  18. data/lib/ittybit/types/file_response.rb +15 -2
  19. data/lib/ittybit/types/file_status.rb +0 -1
  20. data/lib/ittybit/types/links.rb +4 -4
  21. data/lib/ittybit/types/links_list.rb +17 -32
  22. data/lib/ittybit/types/media.rb +34 -56
  23. data/lib/ittybit/types/media_kind.rb +0 -1
  24. data/lib/ittybit/types/media_list_response.rb +15 -2
  25. data/lib/ittybit/types/media_response.rb +15 -2
  26. data/lib/ittybit/types/media_source.rb +52 -53
  27. data/lib/ittybit/types/media_source_kind.rb +0 -1
  28. data/lib/ittybit/types/media_source_object.rb +0 -1
  29. data/lib/ittybit/types/media_source_orientation.rb +9 -0
  30. data/lib/ittybit/types/media_source_status.rb +0 -1
  31. data/lib/ittybit/types/meta_list.rb +40 -15
  32. data/lib/ittybit/types/meta_list_type.rb +8 -0
  33. data/lib/ittybit/types/signature.rb +14 -14
  34. data/lib/ittybit/types/signature_response.rb +15 -2
  35. data/lib/ittybit/types/task.rb +30 -50
  36. data/lib/ittybit/types/task_list_response.rb +15 -2
  37. data/lib/ittybit/types/task_response.rb +15 -2
  38. data/lib/ittybit/types/task_status.rb +0 -1
  39. data/lib/ittybit/types/task_summary.rb +20 -20
  40. data/lib/ittybit/types/task_summary_kind.rb +9 -13
  41. data/lib/ittybit/types/task_summary_status.rb +0 -1
  42. data/lib/ittybit/types/workflow_task_step.rb +61 -29
  43. data/lib/ittybit/types/workflow_task_step_kind.rb +9 -13
  44. data/lib/requests.rb +2 -2
  45. data/lib/types_export.rb +3 -6
  46. metadata +5 -8
  47. data/lib/ittybit/files/types/files_delete_response.rb +0 -89
  48. data/lib/ittybit/files/types/files_delete_response_data.rb +0 -60
  49. data/lib/ittybit/types/automation_trigger_conditions_item.rb +0 -65
  50. data/lib/ittybit/types/error_response.rb +0 -74
  51. data/lib/ittybit/types/media_urls.rb +0 -70
@@ -9,71 +9,69 @@ require "json"
9
9
 
10
10
  module Ittybit
11
11
  class File
12
- # @return [String] Unique identifier for the file.
12
+ # @return [String]
13
13
  attr_reader :id
14
- # @return [String] Identifier for the parent media object.
14
+ # @return [String]
15
15
  attr_reader :media_id
16
- # @return [Ittybit::FileObject] Object type
16
+ # @return [Ittybit::FileObject]
17
17
  attr_reader :object
18
- # @return [Ittybit::FileKind] The general type of media.
18
+ # @return [Ittybit::FileKind]
19
19
  attr_reader :kind
20
- # @return [String] MIME type.
20
+ # @return [String]
21
21
  attr_reader :type
22
- # @return [String] Codec of the file.
22
+ # @return [String]
23
23
  attr_reader :codec
24
- # @return [String] Container of the file.
24
+ # @return [String]
25
25
  attr_reader :container
26
- # @return [Integer] Width in pixels (for image/video).
26
+ # @return [Integer]
27
27
  attr_reader :width
28
- # @return [Integer] Height in pixels (for image/video).
28
+ # @return [Integer]
29
29
  attr_reader :height
30
- # @return [String] Orientation of the file.
30
+ # @return [String]
31
31
  attr_reader :orientation
32
- # @return [Float] Rotation value for image files with embedded EXIF data.
32
+ # @return [Float]
33
33
  attr_reader :rotation
34
- # @return [Boolean] Indicates if the file has alpha channel.
34
+ # @return [Boolean]
35
35
  attr_reader :transparency
36
- # @return [Boolean] Indicates if the file is animated (image only).
36
+ # @return [Boolean]
37
37
  attr_reader :animated
38
- # @return [Integer] Number of frames in the file.
38
+ # @return [Integer]
39
39
  attr_reader :frames
40
- # @return [Float] Duration in seconds (for audio/video).
40
+ # @return [Float]
41
41
  attr_reader :duration
42
- # @return [Float] Frames per second (for video).
42
+ # @return [Float]
43
43
  attr_reader :fps
44
- # @return [Integer] File size in bytes.
44
+ # @return [Integer]
45
45
  attr_reader :filesize
46
- # @return [Integer] Bitrate for audio/video files.
46
+ # @return [Integer]
47
47
  attr_reader :bitrate
48
- # @return [String] Language code (e.g., en, es, fr).
48
+ # @return [String]
49
49
  attr_reader :language
50
- # @return [String] Label to be used by players (tracks only).
50
+ # @return [String]
51
51
  attr_reader :label
52
- # @return [String] Optional reference value. If set, the file URL will be included in the parent
53
- # media `urls` object.
52
+ # @return [String]
54
53
  attr_reader :ref
55
- # @return [String] The folder path where the file is stored.
54
+ # @return [String]
56
55
  attr_reader :folder
57
- # @return [String] The name of the file.
56
+ # @return [String]
58
57
  attr_reader :filename
59
- # @return [String] Publicly accessible URL for the file.
58
+ # @return [String]
60
59
  attr_reader :url
61
- # @return [String] Base64 encoded placeholder image for the file.
60
+ # @return [String]
62
61
  attr_reader :placeholder
63
- # @return [String] Dominant background color hex code.
62
+ # @return [String]
64
63
  attr_reader :background
65
- # @return [Hash{String => Object}] User-defined key-value metadata.
64
+ # @return [Hash{String => Object}]
66
65
  attr_reader :metadata
67
- # @return [Boolean] Indicates this is the original file rather than a variant.
66
+ # @return [Boolean]
68
67
  attr_reader :original
69
- # @return [String] ID of the entity (e.g., task, automation, or upload request) that created this
70
- # file.
68
+ # @return [String]
71
69
  attr_reader :created_by
72
- # @return [DateTime] Timestamp when the file record was created.
70
+ # @return [DateTime]
73
71
  attr_reader :created
74
- # @return [DateTime] Timestamp when the file record was last updated.
72
+ # @return [DateTime]
75
73
  attr_reader :updated
76
- # @return [Ittybit::FileStatus] Processing status of the file.
74
+ # @return [Ittybit::FileStatus]
77
75
  attr_reader :status
78
76
  # @return [OpenStruct] Additional properties unmapped to the current class definition
79
77
  attr_reader :additional_properties
@@ -83,40 +81,38 @@ module Ittybit
83
81
 
84
82
  OMIT = Object.new
85
83
 
86
- # @param id [String] Unique identifier for the file.
87
- # @param media_id [String] Identifier for the parent media object.
88
- # @param object [Ittybit::FileObject] Object type
89
- # @param kind [Ittybit::FileKind] The general type of media.
90
- # @param type [String] MIME type.
91
- # @param codec [String] Codec of the file.
92
- # @param container [String] Container of the file.
93
- # @param width [Integer] Width in pixels (for image/video).
94
- # @param height [Integer] Height in pixels (for image/video).
95
- # @param orientation [String] Orientation of the file.
96
- # @param rotation [Float] Rotation value for image files with embedded EXIF data.
97
- # @param transparency [Boolean] Indicates if the file has alpha channel.
98
- # @param animated [Boolean] Indicates if the file is animated (image only).
99
- # @param frames [Integer] Number of frames in the file.
100
- # @param duration [Float] Duration in seconds (for audio/video).
101
- # @param fps [Float] Frames per second (for video).
102
- # @param filesize [Integer] File size in bytes.
103
- # @param bitrate [Integer] Bitrate for audio/video files.
104
- # @param language [String] Language code (e.g., en, es, fr).
105
- # @param label [String] Label to be used by players (tracks only).
106
- # @param ref [String] Optional reference value. If set, the file URL will be included in the parent
107
- # media `urls` object.
108
- # @param folder [String] The folder path where the file is stored.
109
- # @param filename [String] The name of the file.
110
- # @param url [String] Publicly accessible URL for the file.
111
- # @param placeholder [String] Base64 encoded placeholder image for the file.
112
- # @param background [String] Dominant background color hex code.
113
- # @param metadata [Hash{String => Object}] User-defined key-value metadata.
114
- # @param original [Boolean] Indicates this is the original file rather than a variant.
115
- # @param created_by [String] ID of the entity (e.g., task, automation, or upload request) that created this
116
- # file.
117
- # @param created [DateTime] Timestamp when the file record was created.
118
- # @param updated [DateTime] Timestamp when the file record was last updated.
119
- # @param status [Ittybit::FileStatus] Processing status of the file.
84
+ # @param id [String]
85
+ # @param media_id [String]
86
+ # @param object [Ittybit::FileObject]
87
+ # @param kind [Ittybit::FileKind]
88
+ # @param type [String]
89
+ # @param codec [String]
90
+ # @param container [String]
91
+ # @param width [Integer]
92
+ # @param height [Integer]
93
+ # @param orientation [String]
94
+ # @param rotation [Float]
95
+ # @param transparency [Boolean]
96
+ # @param animated [Boolean]
97
+ # @param frames [Integer]
98
+ # @param duration [Float]
99
+ # @param fps [Float]
100
+ # @param filesize [Integer]
101
+ # @param bitrate [Integer]
102
+ # @param language [String]
103
+ # @param label [String]
104
+ # @param ref [String]
105
+ # @param folder [String]
106
+ # @param filename [String]
107
+ # @param url [String]
108
+ # @param placeholder [String]
109
+ # @param background [String]
110
+ # @param metadata [Hash{String => Object}]
111
+ # @param original [Boolean]
112
+ # @param created_by [String]
113
+ # @param created [DateTime]
114
+ # @param updated [DateTime]
115
+ # @param status [Ittybit::FileStatus]
120
116
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
121
117
  # @return [Ittybit::File]
122
118
  def initialize(id:, media_id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT,
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ittybit
4
- # The general type of media.
5
4
  class FileKind
6
5
  VIDEO = "video"
7
6
  IMAGE = "image"
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "meta_list"
4
4
  require_relative "file"
5
+ require_relative "error"
5
6
  require_relative "links_list"
6
7
  require "ostruct"
7
8
  require "json"
@@ -12,6 +13,8 @@ module Ittybit
12
13
  attr_reader :meta
13
14
  # @return [Array<Ittybit::File>]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::LinksList]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,15 +27,17 @@ module Ittybit
24
27
 
25
28
  # @param meta [Ittybit::MetaList]
26
29
  # @param data [Array<Ittybit::File>]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::LinksList]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::FileListResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -54,6 +59,12 @@ module Ittybit
54
59
  item = item.to_json
55
60
  Ittybit::File.from_json(json_object: item)
56
61
  end
62
+ if parsed_json["error"].nil?
63
+ error = nil
64
+ else
65
+ error = parsed_json["error"].to_json
66
+ error = Ittybit::Error.from_json(json_object: error)
67
+ end
57
68
  if parsed_json["links"].nil?
58
69
  links = nil
59
70
  else
@@ -63,6 +74,7 @@ module Ittybit
63
74
  new(
64
75
  meta: meta,
65
76
  data: data,
77
+ error: error,
66
78
  links: links,
67
79
  additional_properties: struct
68
80
  )
@@ -84,6 +96,7 @@ module Ittybit
84
96
  def self.validate_raw(obj:)
85
97
  obj.meta.nil? || Ittybit::MetaList.validate_raw(obj: obj.meta)
86
98
  obj.data&.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
99
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
87
100
  obj.links.nil? || Ittybit::LinksList.validate_raw(obj: obj.links)
88
101
  end
89
102
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ittybit
4
- # Object type
5
4
  class FileObject
6
5
  SOURCE = "source"
7
6
  TRACK = "track"
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "meta"
4
4
  require_relative "file"
5
+ require_relative "error"
5
6
  require_relative "links"
6
7
  require "ostruct"
7
8
  require "json"
@@ -12,6 +13,8 @@ module Ittybit
12
13
  attr_reader :meta
13
14
  # @return [Ittybit::File]
14
15
  attr_reader :data
16
+ # @return [Ittybit::Error]
17
+ attr_reader :error
15
18
  # @return [Ittybit::Links]
16
19
  attr_reader :links
17
20
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,15 +27,17 @@ module Ittybit
24
27
 
25
28
  # @param meta [Ittybit::META]
26
29
  # @param data [Ittybit::File]
30
+ # @param error [Ittybit::Error]
27
31
  # @param links [Ittybit::Links]
28
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
33
  # @return [Ittybit::FileResponse]
30
- def initialize(meta: OMIT, data: OMIT, links: OMIT, additional_properties: nil)
34
+ def initialize(meta: OMIT, data: OMIT, error: OMIT, links: OMIT, additional_properties: nil)
31
35
  @meta = meta if meta != OMIT
32
36
  @data = data if data != OMIT
37
+ @error = error if error != OMIT
33
38
  @links = links if links != OMIT
34
39
  @additional_properties = additional_properties
35
- @_field_set = { "meta": meta, "data": data, "links": links }.reject do |_k, v|
40
+ @_field_set = { "meta": meta, "data": data, "error": error, "links": links }.reject do |_k, v|
36
41
  v == OMIT
37
42
  end
38
43
  end
@@ -51,6 +56,12 @@ module Ittybit
51
56
  data = parsed_json["data"].to_json
52
57
  data = Ittybit::File.from_json(json_object: data)
53
58
  end
59
+ if parsed_json["error"].nil?
60
+ error = nil
61
+ else
62
+ error = parsed_json["error"].to_json
63
+ error = Ittybit::Error.from_json(json_object: error)
64
+ end
54
65
  if parsed_json["links"].nil?
55
66
  links = nil
56
67
  else
@@ -60,6 +71,7 @@ module Ittybit
60
71
  new(
61
72
  meta: meta,
62
73
  data: data,
74
+ error: error,
63
75
  links: links,
64
76
  additional_properties: struct
65
77
  )
@@ -81,6 +93,7 @@ module Ittybit
81
93
  def self.validate_raw(obj:)
82
94
  obj.meta&.is_a?(Object) != false || raise("Passed value for field obj.meta is not the expected type, validation failed.")
83
95
  obj.data.nil? || Ittybit::File.validate_raw(obj: obj.data)
96
+ obj.error.nil? || Ittybit::Error.validate_raw(obj: obj.error)
84
97
  obj.links.nil? || Ittybit::Links.validate_raw(obj: obj.links)
85
98
  end
86
99
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ittybit
4
- # Processing status of the file.
5
4
  class FileStatus
6
5
  WAITING = "waiting"
7
6
  PROCESSING = "processing"
@@ -5,9 +5,9 @@ require "json"
5
5
 
6
6
  module Ittybit
7
7
  class Links
8
- # @return [String] The absolute URL of the current request, potentially including query parameters.
8
+ # @return [String]
9
9
  attr_reader :self_
10
- # @return [String] URL for the parent resource.
10
+ # @return [String]
11
11
  attr_reader :parent
12
12
  # @return [OpenStruct] Additional properties unmapped to the current class definition
13
13
  attr_reader :additional_properties
@@ -17,8 +17,8 @@ module Ittybit
17
17
 
18
18
  OMIT = Object.new
19
19
 
20
- # @param self_ [String] The absolute URL of the current request, potentially including query parameters.
21
- # @param parent [String] URL for the parent resource.
20
+ # @param self_ [String]
21
+ # @param parent [String]
22
22
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
23
  # @return [Ittybit::Links]
24
24
  def initialize(self_: OMIT, parent: OMIT, additional_properties: nil)
@@ -5,17 +5,15 @@ require "json"
5
5
 
6
6
  module Ittybit
7
7
  class LinksList
8
- # @return [String] The absolute URL of the current request, potentially including query parameters.
8
+ # @return [String]
9
9
  attr_reader :self_
10
- # @return [String] URL for the next page of results.
10
+ # @return [String]
11
+ attr_reader :first
12
+ # @return [String]
11
13
  attr_reader :next_
12
- # @return [String] URL for the previous page of results.
14
+ # @return [String]
13
15
  attr_reader :prev
14
- # @return [String] URL for the parent resource.
15
- attr_reader :parent
16
- # @return [String] URL for the first page of results.
17
- attr_reader :first
18
- # @return [String] URL for the last page of results.
16
+ # @return [String]
19
17
  attr_reader :last
20
18
  # @return [OpenStruct] Additional properties unmapped to the current class definition
21
19
  attr_reader :additional_properties
@@ -25,31 +23,21 @@ module Ittybit
25
23
 
26
24
  OMIT = Object.new
27
25
 
28
- # @param self_ [String] The absolute URL of the current request, potentially including query parameters.
29
- # @param next_ [String] URL for the next page of results.
30
- # @param prev [String] URL for the previous page of results.
31
- # @param parent [String] URL for the parent resource.
32
- # @param first [String] URL for the first page of results.
33
- # @param last [String] URL for the last page of results.
26
+ # @param self_ [String]
27
+ # @param first [String]
28
+ # @param next_ [String]
29
+ # @param prev [String]
30
+ # @param last [String]
34
31
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
35
32
  # @return [Ittybit::LinksList]
36
- def initialize(self_: OMIT, next_: OMIT, prev: OMIT, parent: OMIT, first: OMIT, last: OMIT,
37
- additional_properties: nil)
33
+ def initialize(self_: OMIT, first: OMIT, next_: OMIT, prev: OMIT, last: OMIT, additional_properties: nil)
38
34
  @self_ = self_ if self_ != OMIT
35
+ @first = first if first != OMIT
39
36
  @next_ = next_ if next_ != OMIT
40
37
  @prev = prev if prev != OMIT
41
- @parent = parent if parent != OMIT
42
- @first = first if first != OMIT
43
38
  @last = last if last != OMIT
44
39
  @additional_properties = additional_properties
45
- @_field_set = {
46
- "self": self_,
47
- "next": next_,
48
- "prev": prev,
49
- "parent": parent,
50
- "first": first,
51
- "last": last
52
- }.reject do |_k, v|
40
+ @_field_set = { "self": self_, "first": first, "next": next_, "prev": prev, "last": last }.reject do |_k, v|
53
41
  v == OMIT
54
42
  end
55
43
  end
@@ -62,17 +50,15 @@ module Ittybit
62
50
  struct = JSON.parse(json_object, object_class: OpenStruct)
63
51
  parsed_json = JSON.parse(json_object)
64
52
  self_ = parsed_json["self"]
53
+ first = parsed_json["first"]
65
54
  next_ = parsed_json["next"]
66
55
  prev = parsed_json["prev"]
67
- parent = parsed_json["parent"]
68
- first = parsed_json["first"]
69
56
  last = parsed_json["last"]
70
57
  new(
71
58
  self_: self_,
59
+ first: first,
72
60
  next_: next_,
73
61
  prev: prev,
74
- parent: parent,
75
- first: first,
76
62
  last: last,
77
63
  additional_properties: struct
78
64
  )
@@ -93,10 +79,9 @@ module Ittybit
93
79
  # @return [Void]
94
80
  def self.validate_raw(obj:)
95
81
  obj.self_&.is_a?(String) != false || raise("Passed value for field obj.self_ is not the expected type, validation failed.")
82
+ obj.first&.is_a?(String) != false || raise("Passed value for field obj.first is not the expected type, validation failed.")
96
83
  obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
97
84
  obj.prev&.is_a?(String) != false || raise("Passed value for field obj.prev is not the expected type, validation failed.")
98
- obj.parent&.is_a?(String) != false || raise("Passed value for field obj.parent is not the expected type, validation failed.")
99
- obj.first&.is_a?(String) != false || raise("Passed value for field obj.first is not the expected type, validation failed.")
100
85
  obj.last&.is_a?(String) != false || raise("Passed value for field obj.last is not the expected type, validation failed.")
101
86
  end
102
87
  end
@@ -2,44 +2,39 @@
2
2
 
3
3
  require_relative "media_kind"
4
4
  require_relative "media_source"
5
- require_relative "media_urls"
6
5
  require "date"
7
6
  require "ostruct"
8
7
  require "json"
9
8
 
10
9
  module Ittybit
11
10
  class Media
12
- # @return [String] Unique identifier for the media item.
11
+ # @return [String]
13
12
  attr_reader :id
14
- # @return [String] Object type, always 'media'.
13
+ # @return [String]
15
14
  attr_reader :object
16
- # @return [Ittybit::MediaKind] The primary kind of the media, derived from the original file.
15
+ # @return [Ittybit::MediaKind]
17
16
  attr_reader :kind
18
- # @return [String] Title of the media item.
17
+ # @return [String]
19
18
  attr_reader :title
20
- # @return [String] Alternative text for the media item.
19
+ # @return [String]
21
20
  attr_reader :alt
22
- # @return [Integer] Width of the primary source in pixels.
21
+ # @return [Integer]
23
22
  attr_reader :width
24
- # @return [Integer] Height of the primary source in pixels.
23
+ # @return [Integer]
25
24
  attr_reader :height
26
- # @return [Float] Duration of the primary source in seconds.
25
+ # @return [Float]
27
26
  attr_reader :duration
28
- # @return [Array<Ittybit::MediaSource>] Array of source files associated with this media item.
27
+ # @return [Array<Ittybit::MediaSource>]
29
28
  attr_reader :files
30
- # @return [Ittybit::MediaUrls] URLs for the media item.
29
+ # @return [Hash{String => Object}]
31
30
  attr_reader :urls
32
- # @return [String] URL of the poster image (video kinds only).
33
- attr_reader :poster
34
- # @return [String] Base64 encoded placeholder image (video/image only).
35
- attr_reader :placeholder
36
- # @return [String] Dominant background color hex code (video/image only).
31
+ # @return [String]
37
32
  attr_reader :background
38
- # @return [Hash{String => Object}] User-defined key-value metadata for the media item.
33
+ # @return [Hash{String => Object}]
39
34
  attr_reader :metadata
40
- # @return [DateTime] Timestamp when the media record was created.
35
+ # @return [DateTime]
41
36
  attr_reader :created
42
- # @return [DateTime] Timestamp when the media item was last updated.
37
+ # @return [DateTime]
43
38
  attr_reader :updated
44
39
  # @return [OpenStruct] Additional properties unmapped to the current class definition
45
40
  attr_reader :additional_properties
@@ -49,29 +44,27 @@ module Ittybit
49
44
 
50
45
  OMIT = Object.new
51
46
 
52
- # @param id [String] Unique identifier for the media item.
53
- # @param object [String] Object type, always 'media'.
54
- # @param kind [Ittybit::MediaKind] The primary kind of the media, derived from the original file.
55
- # @param title [String] Title of the media item.
56
- # @param alt [String] Alternative text for the media item.
57
- # @param width [Integer] Width of the primary source in pixels.
58
- # @param height [Integer] Height of the primary source in pixels.
59
- # @param duration [Float] Duration of the primary source in seconds.
60
- # @param files [Array<Ittybit::MediaSource>] Array of source files associated with this media item.
61
- # @param urls [Ittybit::MediaUrls] URLs for the media item.
62
- # @param poster [String] URL of the poster image (video kinds only).
63
- # @param placeholder [String] Base64 encoded placeholder image (video/image only).
64
- # @param background [String] Dominant background color hex code (video/image only).
65
- # @param metadata [Hash{String => Object}] User-defined key-value metadata for the media item.
66
- # @param created [DateTime] Timestamp when the media record was created.
67
- # @param updated [DateTime] Timestamp when the media item was last updated.
47
+ # @param id [String]
48
+ # @param object [String]
49
+ # @param kind [Ittybit::MediaKind]
50
+ # @param title [String]
51
+ # @param alt [String]
52
+ # @param width [Integer]
53
+ # @param height [Integer]
54
+ # @param duration [Float]
55
+ # @param files [Array<Ittybit::MediaSource>]
56
+ # @param urls [Hash{String => Object}]
57
+ # @param background [String]
58
+ # @param metadata [Hash{String => Object}]
59
+ # @param created [DateTime]
60
+ # @param updated [DateTime]
68
61
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
69
62
  # @return [Ittybit::Media]
70
- def initialize(id:, object:, kind:, files:, urls:, created:, updated:, title: OMIT, alt: OMIT, width: OMIT,
71
- height: OMIT, duration: OMIT, poster: OMIT, placeholder: OMIT, background: OMIT, metadata: OMIT, additional_properties: nil)
63
+ def initialize(id:, object:, files:, urls:, created:, updated:, kind: OMIT, title: OMIT, alt: OMIT, width: OMIT,
64
+ height: OMIT, duration: OMIT, background: OMIT, metadata: OMIT, additional_properties: nil)
72
65
  @id = id
73
66
  @object = object
74
- @kind = kind
67
+ @kind = kind if kind != OMIT
75
68
  @title = title if title != OMIT
76
69
  @alt = alt if alt != OMIT
77
70
  @width = width if width != OMIT
@@ -79,8 +72,6 @@ module Ittybit
79
72
  @duration = duration if duration != OMIT
80
73
  @files = files
81
74
  @urls = urls
82
- @poster = poster if poster != OMIT
83
- @placeholder = placeholder if placeholder != OMIT
84
75
  @background = background if background != OMIT
85
76
  @metadata = metadata if metadata != OMIT
86
77
  @created = created
@@ -97,8 +88,6 @@ module Ittybit
97
88
  "duration": duration,
98
89
  "files": files,
99
90
  "urls": urls,
100
- "poster": poster,
101
- "placeholder": placeholder,
102
91
  "background": background,
103
92
  "metadata": metadata,
104
93
  "created": created,
@@ -127,14 +116,7 @@ module Ittybit
127
116
  item = item.to_json
128
117
  Ittybit::MediaSource.from_json(json_object: item)
129
118
  end
130
- if parsed_json["urls"].nil?
131
- urls = nil
132
- else
133
- urls = parsed_json["urls"].to_json
134
- urls = Ittybit::MediaUrls.from_json(json_object: urls)
135
- end
136
- poster = parsed_json["poster"]
137
- placeholder = parsed_json["placeholder"]
119
+ urls = parsed_json["urls"]
138
120
  background = parsed_json["background"]
139
121
  metadata = parsed_json["metadata"]
140
122
  created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
@@ -150,8 +132,6 @@ module Ittybit
150
132
  duration: duration,
151
133
  files: files,
152
134
  urls: urls,
153
- poster: poster,
154
- placeholder: placeholder,
155
135
  background: background,
156
136
  metadata: metadata,
157
137
  created: created,
@@ -176,16 +156,14 @@ module Ittybit
176
156
  def self.validate_raw(obj:)
177
157
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
178
158
  obj.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
179
- obj.kind.is_a?(Ittybit::MediaKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
159
+ obj.kind&.is_a?(Ittybit::MediaKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
180
160
  obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
181
161
  obj.alt&.is_a?(String) != false || raise("Passed value for field obj.alt is not the expected type, validation failed.")
182
162
  obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.")
183
163
  obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.")
184
164
  obj.duration&.is_a?(Float) != false || raise("Passed value for field obj.duration is not the expected type, validation failed.")
185
165
  obj.files.is_a?(Array) != false || raise("Passed value for field obj.files is not the expected type, validation failed.")
186
- Ittybit::MediaUrls.validate_raw(obj: obj.urls)
187
- obj.poster&.is_a?(String) != false || raise("Passed value for field obj.poster is not the expected type, validation failed.")
188
- obj.placeholder&.is_a?(String) != false || raise("Passed value for field obj.placeholder is not the expected type, validation failed.")
166
+ obj.urls.is_a?(Hash) != false || raise("Passed value for field obj.urls is not the expected type, validation failed.")
189
167
  obj.background&.is_a?(String) != false || raise("Passed value for field obj.background is not the expected type, validation failed.")
190
168
  obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
191
169
  obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ittybit
4
- # The primary kind of the media, derived from the original file.
5
4
  class MediaKind
6
5
  VIDEO = "video"
7
6
  IMAGE = "image"