shotstack 0.2.1 → 0.2.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 (122) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/README.md +387 -23
  4. data/Rakefile +10 -0
  5. data/lib/shotstack/api/create_api.rb +158 -0
  6. data/lib/shotstack/api/edit_api.rb +20 -20
  7. data/lib/shotstack/api/ingest_api.rb +338 -0
  8. data/lib/shotstack/api/serve_api.rb +76 -8
  9. data/lib/shotstack/api_client.rb +28 -24
  10. data/lib/shotstack/api_error.rb +3 -2
  11. data/lib/shotstack/configuration.rb +55 -9
  12. data/lib/shotstack/models/asset.rb +4 -4
  13. data/lib/shotstack/models/asset_render_response.rb +23 -20
  14. data/lib/shotstack/models/asset_response.rb +23 -20
  15. data/lib/shotstack/models/asset_response_attributes.rb +38 -21
  16. data/lib/shotstack/models/asset_response_data.rb +30 -20
  17. data/lib/shotstack/models/audio_asset.rb +57 -23
  18. data/lib/shotstack/models/audio_enhancement.rb +43 -0
  19. data/lib/shotstack/models/clip.rb +29 -33
  20. data/lib/shotstack/models/crop.rb +40 -28
  21. data/lib/shotstack/models/destinations.rb +78 -244
  22. data/lib/shotstack/models/did_generated_asset.rb +273 -0
  23. data/lib/shotstack/models/did_generated_asset_options.rb +54 -0
  24. data/lib/shotstack/models/did_text_to_avatar_options.rb +313 -0
  25. data/lib/shotstack/models/dolby_enhancement.rb +239 -0
  26. data/lib/shotstack/models/dolby_enhancement_options.rb +257 -0
  27. data/lib/shotstack/models/edit.rb +22 -24
  28. data/lib/shotstack/models/eleven_labs_generated_asset.rb +273 -0
  29. data/lib/shotstack/models/eleven_labs_generated_asset_options.rb +54 -0
  30. data/lib/shotstack/models/eleven_labs_text_to_speech_options.rb +303 -0
  31. data/lib/shotstack/models/enhancements.rb +215 -0
  32. data/lib/shotstack/models/flip_transformation.rb +16 -24
  33. data/lib/shotstack/models/font.rb +18 -20
  34. data/lib/shotstack/models/generated_asset.rb +48 -0
  35. data/lib/shotstack/models/generated_asset_error_response.rb +225 -0
  36. data/lib/shotstack/models/generated_asset_error_response_data.rb +257 -0
  37. data/lib/shotstack/models/generated_asset_response.rb +222 -0
  38. data/lib/shotstack/models/generated_asset_response_attributes.rb +376 -0
  39. data/lib/shotstack/models/generated_asset_response_data.rb +256 -0
  40. data/lib/shotstack/models/google_cloud_storage_destination.rb +232 -0
  41. data/lib/shotstack/models/google_cloud_storage_destination_options.rb +243 -0
  42. data/lib/shotstack/models/google_drive_destination.rb +239 -0
  43. data/lib/shotstack/models/google_drive_destination_options.rb +233 -0
  44. data/lib/shotstack/models/hey_gen_generated_asset.rb +273 -0
  45. data/lib/shotstack/models/hey_gen_generated_asset_options.rb +54 -0
  46. data/lib/shotstack/models/hey_gen_text_to_avatar_options.rb +396 -0
  47. data/lib/shotstack/models/html_asset.rb +20 -26
  48. data/lib/shotstack/models/image_asset.rb +18 -20
  49. data/lib/shotstack/models/ingest_error_response.rb +225 -0
  50. data/lib/shotstack/models/ingest_error_response_data.rb +257 -0
  51. data/lib/shotstack/models/luma_asset.rb +18 -20
  52. data/lib/shotstack/models/merge_field.rb +20 -20
  53. data/lib/shotstack/models/mux_destination.rb +18 -22
  54. data/lib/shotstack/models/mux_destination_options.rb +50 -25
  55. data/lib/shotstack/models/offset.rb +46 -46
  56. data/lib/shotstack/models/open_ai_generated_asset.rb +273 -0
  57. data/lib/shotstack/models/open_ai_generated_asset_options.rb +54 -0
  58. data/lib/shotstack/models/open_ai_text_generator_options.rb +313 -0
  59. data/lib/shotstack/models/output.rb +40 -35
  60. data/lib/shotstack/models/outputs.rb +227 -0
  61. data/lib/shotstack/models/outputs_response.rb +218 -0
  62. data/lib/shotstack/models/poster.rb +18 -20
  63. data/lib/shotstack/models/probe_response.rb +22 -20
  64. data/lib/shotstack/models/queued_response.rb +22 -20
  65. data/lib/shotstack/models/queued_response_data.rb +20 -20
  66. data/lib/shotstack/models/queued_source_response.rb +222 -0
  67. data/lib/shotstack/models/queued_source_response_data.rb +240 -0
  68. data/lib/shotstack/models/range.rb +26 -22
  69. data/lib/shotstack/models/render_response.rb +22 -20
  70. data/lib/shotstack/models/render_response_data.rb +24 -35
  71. data/lib/shotstack/models/rendition.rb +429 -0
  72. data/lib/shotstack/models/rendition_response_attributes.rb +336 -0
  73. data/lib/shotstack/models/rotate_transformation.rb +16 -22
  74. data/lib/shotstack/models/s3_destination.rb +232 -0
  75. data/lib/shotstack/models/s3_destination_options.rb +270 -0
  76. data/lib/shotstack/models/shotstack_destination.rb +19 -25
  77. data/lib/shotstack/models/shotstack_generated_asset.rb +273 -0
  78. data/lib/shotstack/models/shotstack_generated_asset_options.rb +60 -0
  79. data/lib/shotstack/models/shotstack_image_to_video_options.rb +298 -0
  80. data/lib/shotstack/models/shotstack_text_generator_options.rb +274 -0
  81. data/lib/shotstack/models/shotstack_text_to_image_options.rb +308 -0
  82. data/lib/shotstack/models/shotstack_text_to_speech_options.rb +339 -0
  83. data/lib/shotstack/models/size.rb +39 -35
  84. data/lib/shotstack/models/skew_transformation.rb +16 -24
  85. data/lib/shotstack/models/soundtrack.rb +18 -22
  86. data/lib/shotstack/models/source.rb +244 -0
  87. data/lib/shotstack/models/source_list_response.rb +225 -0
  88. data/lib/shotstack/models/source_response.rb +222 -0
  89. data/lib/shotstack/models/source_response_attributes.rb +373 -0
  90. data/lib/shotstack/models/source_response_data.rb +256 -0
  91. data/lib/shotstack/models/speed.rb +254 -0
  92. data/lib/shotstack/models/stability_ai_generated_asset.rb +273 -0
  93. data/lib/shotstack/models/stability_ai_generated_asset_options.rb +54 -0
  94. data/lib/shotstack/models/stability_ai_text_to_image_options.rb +390 -0
  95. data/lib/shotstack/models/template.rb +18 -20
  96. data/lib/shotstack/models/template_data_response.rb +24 -22
  97. data/lib/shotstack/models/template_data_response_data.rb +25 -22
  98. data/lib/shotstack/models/template_list_response.rb +24 -22
  99. data/lib/shotstack/models/template_list_response_data.rb +20 -20
  100. data/lib/shotstack/models/template_list_response_item.rb +20 -30
  101. data/lib/shotstack/models/template_render.rb +19 -21
  102. data/lib/shotstack/models/template_response.rb +23 -21
  103. data/lib/shotstack/models/template_response_data.rb +20 -20
  104. data/lib/shotstack/models/thumbnail.rb +20 -20
  105. data/lib/shotstack/models/timeline.rb +19 -25
  106. data/lib/shotstack/models/title_asset.rb +19 -27
  107. data/lib/shotstack/models/track.rb +18 -20
  108. data/lib/shotstack/models/transcription.rb +250 -0
  109. data/lib/shotstack/models/transfer.rb +259 -0
  110. data/lib/shotstack/models/transfer_response.rb +222 -0
  111. data/lib/shotstack/models/transfer_response_attributes.rb +280 -0
  112. data/lib/shotstack/models/transfer_response_data.rb +225 -0
  113. data/lib/shotstack/models/transformation.rb +16 -20
  114. data/lib/shotstack/models/transition.rb +16 -20
  115. data/lib/shotstack/models/upload_response.rb +222 -0
  116. data/lib/shotstack/models/upload_response_attributes.rb +257 -0
  117. data/lib/shotstack/models/upload_response_data.rb +256 -0
  118. data/lib/shotstack/models/video_asset.rb +102 -22
  119. data/lib/shotstack/version.rb +3 -3
  120. data/lib/shotstack.rb +63 -2
  121. data/shotstack.gemspec +8 -8
  122. metadata +80 -24
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #Shotstack
3
+
4
+ # Official Ruby SDK for the Shotstack Cloud Video Editing API
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shotstack
17
+ # Pass additional options to control how files are stored in Google Cloud Storage.
18
+ class GoogleCloudStorageDestinationOptions
19
+ # The bucket name to send files to. The bucket must exist in the Google Cloud Storage account before files can be sent.
20
+ attr_accessor :bucket
21
+
22
+ # A prefix for the file being sent. This is typically a folder name, i.e. `videos` or `customerId/videos`.
23
+ attr_accessor :prefix
24
+
25
+ # Use your own filename instead of the default filenames generated by Shotstack. Note: omit the file extension as this will be appended depending on the output format. Also `-poster.jpg` and `-thumb.jpg` will be appended for poster and thumbnail images.
26
+ attr_accessor :filename
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'bucket' => :'bucket',
32
+ :'prefix' => :'prefix',
33
+ :'filename' => :'filename'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'bucket' => :'String',
46
+ :'prefix' => :'String',
47
+ :'filename' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::GoogleCloudStorageDestinationOptions` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::GoogleCloudStorageDestinationOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'bucket')
73
+ self.bucket = attributes[:'bucket']
74
+ else
75
+ self.bucket = nil
76
+ end
77
+
78
+ if attributes.key?(:'prefix')
79
+ self.prefix = attributes[:'prefix']
80
+ end
81
+
82
+ if attributes.key?(:'filename')
83
+ self.filename = attributes[:'filename']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ if @bucket.nil?
93
+ invalid_properties.push('invalid value for "bucket", bucket cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @bucket.nil?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ bucket == o.bucket &&
113
+ prefix == o.prefix &&
114
+ filename == o.filename
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [bucket, prefix, filename].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ attributes = attributes.transform_keys(&:to_sym)
135
+ transformed_hash = {}
136
+ openapi_types.each_pair do |key, type|
137
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
138
+ transformed_hash["#{key}"] = nil
139
+ elsif type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[attribute_map[key]].is_a?(Array)
143
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
144
+ end
145
+ elsif !attributes[attribute_map[key]].nil?
146
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
147
+ end
148
+ end
149
+ new(transformed_hash)
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def self._deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = Shotstack.const_get(type)
191
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -0,0 +1,239 @@
1
+ =begin
2
+ #Shotstack
3
+
4
+ # Official Ruby SDK for the Shotstack Cloud Video Editing API
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shotstack
17
+ # Send rendered videos and assets to the [Google Drive](https://shotstack.io/docs/guide/serving-assets/destinations/google-drive/) cloud storage service. Google Drive uses OAuth and you must authenticate and link your Google account via [dashboard](https://dashboard.shotstack.io/integrations/google-drive), not in the request.
18
+ class GoogleDriveDestination
19
+ # The destination to send assets to - set to `google-drive` for Google Drive.
20
+ attr_accessor :provider
21
+
22
+ attr_accessor :options
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'provider' => :'provider',
28
+ :'options' => :'options'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'provider' => :'String',
41
+ :'options' => :'GoogleDriveDestinationOptions'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::GoogleDriveDestination` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::GoogleDriveDestination`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'provider')
67
+ self.provider = attributes[:'provider']
68
+ else
69
+ self.provider = 'google-drive'
70
+ end
71
+
72
+ if attributes.key?(:'options')
73
+ self.options = attributes[:'options']
74
+ else
75
+ self.options = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @provider.nil?
85
+ invalid_properties.push('invalid value for "provider", provider cannot be nil.')
86
+ end
87
+
88
+ if @options.nil?
89
+ invalid_properties.push('invalid value for "options", options cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @provider.nil?
100
+ return false if @options.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ provider == o.provider &&
110
+ options == o.options
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [provider, options].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Shotstack.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -0,0 +1,233 @@
1
+ =begin
2
+ #Shotstack
3
+
4
+ # Official Ruby SDK for the Shotstack Cloud Video Editing API
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shotstack
17
+ # Pass the folder ID and options to configure how assets are stored in Google Drive.
18
+ class GoogleDriveDestinationOptions
19
+ # The Google Drive folder ID where asset will be stored. The folder ID is required and can be retrieved from the URL when logged in to Google Drive, e.g. <a href=\"#\">https://drive.google.com/drive/u/0/folders/1r-eTY6OLO8tzQRKwMyq-fIrQ_7AJEI6A</a>.
20
+ attr_accessor :folder_id
21
+
22
+ # Use your own filename instead of the default filenames generated by Shotstack. Note: omit the file extension as this will be appended depending on the output format. Also `-poster.jpg` and `-thumb.jpg` will be appended for poster and thumbnail images.
23
+ attr_accessor :filename
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'folder_id' => :'folderId',
29
+ :'filename' => :'filename'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'folder_id' => :'String',
42
+ :'filename' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::GoogleDriveDestinationOptions` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::GoogleDriveDestinationOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'folder_id')
68
+ self.folder_id = attributes[:'folder_id']
69
+ else
70
+ self.folder_id = nil
71
+ end
72
+
73
+ if attributes.key?(:'filename')
74
+ self.filename = attributes[:'filename']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
82
+ invalid_properties = Array.new
83
+ if @folder_id.nil?
84
+ invalid_properties.push('invalid value for "folder_id", folder_id cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ warn '[DEPRECATED] the `valid?` method is obsolete'
94
+ return false if @folder_id.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ folder_id == o.folder_id &&
104
+ filename == o.filename
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [folder_id, filename].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ attributes = attributes.transform_keys(&:to_sym)
125
+ transformed_hash = {}
126
+ openapi_types.each_pair do |key, type|
127
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = nil
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[attribute_map[key]].is_a?(Array)
133
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
134
+ end
135
+ elsif !attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
137
+ end
138
+ end
139
+ new(transformed_hash)
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def self._deserialize(type, value)
147
+ case type.to_sym
148
+ when :Time
149
+ Time.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ # models (e.g. Pet) or oneOf
180
+ klass = Shotstack.const_get(type)
181
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end