shotstack 0.1.4 → 0.1.8

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shotstack.rb +12 -2
  3. data/lib/shotstack/api/edit_api.rb +155 -0
  4. data/lib/shotstack/api/endpoints_api.rb +10 -8
  5. data/lib/shotstack/api/serve_api.rb +224 -0
  6. data/lib/shotstack/api_client.rb +50 -46
  7. data/lib/shotstack/api_error.rb +2 -2
  8. data/lib/shotstack/configuration.rb +50 -9
  9. data/lib/shotstack/models/asset_render_response.rb +222 -0
  10. data/lib/shotstack/models/asset_response.rb +219 -0
  11. data/lib/shotstack/models/asset_response_attributes.rb +334 -0
  12. data/lib/shotstack/models/asset_response_data.rb +229 -0
  13. data/lib/shotstack/models/audio_asset.rb +68 -12
  14. data/lib/shotstack/models/clip.rb +23 -11
  15. data/lib/shotstack/models/crop.rb +346 -0
  16. data/lib/shotstack/models/destinations.rb +17 -0
  17. data/lib/shotstack/models/edit.rb +72 -14
  18. data/lib/shotstack/models/font.rb +21 -9
  19. data/lib/shotstack/models/html_asset.rb +26 -14
  20. data/lib/shotstack/models/image_asset.rb +34 -13
  21. data/lib/shotstack/models/luma_asset.rb +24 -12
  22. data/lib/shotstack/models/offset.rb +20 -8
  23. data/lib/shotstack/models/output.rb +111 -26
  24. data/lib/shotstack/models/poster.rb +20 -8
  25. data/lib/shotstack/models/queued_response.rb +21 -8
  26. data/lib/shotstack/models/queued_response_data.rb +21 -8
  27. data/lib/shotstack/models/range.rb +260 -0
  28. data/lib/shotstack/models/render_response.rb +21 -8
  29. data/lib/shotstack/models/render_response_data.rb +25 -12
  30. data/lib/shotstack/models/shotstack_destination.rb +240 -0
  31. data/lib/shotstack/models/size.rb +278 -0
  32. data/lib/shotstack/models/soundtrack.rb +20 -8
  33. data/lib/shotstack/models/thumbnail.rb +21 -9
  34. data/lib/shotstack/models/timeline.rb +37 -13
  35. data/lib/shotstack/models/title_asset.rb +20 -8
  36. data/lib/shotstack/models/track.rb +20 -8
  37. data/lib/shotstack/models/transition.rb +26 -14
  38. data/lib/shotstack/models/video_asset.rb +33 -12
  39. data/lib/shotstack/version.rb +3 -3
  40. data/shotstack.gemspec +4 -5
  41. metadata +22 -27
@@ -0,0 +1,229 @@
1
+ =begin
2
+ #Shotstack
3
+
4
+ #Shotstack is a video, image and audio editing service that allows for the automated generation of videos, images and audio using JSON and a RESTful API. You arrange and configure an edit and POST it to the API which will render your media and provide a file location when complete. For more details visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation. There are two main API's, one for editing and generating assets (Edit API) and one for managing hosted assets (Serve API). The Edit API base URL is: <b>https://api.shotstack.io/{version}</b> The Serve API base URL is: <b>https://api.shotstack.io/serve/{version}</b>
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Shotstack
17
+ # The type of resource (an asset) and attributes of the asset.
18
+ class AssetResponseData
19
+ # The type of resource, in this case it is an assets.
20
+ attr_accessor :type
21
+
22
+ attr_accessor :attributes
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'type' => :'type',
28
+ :'attributes' => :'attributes'
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
+ :'type' => :'String',
41
+ :'attributes' => :'AssetResponseAttributes'
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::AssetResponseData` 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::AssetResponseData`. 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?(:'type')
67
+ self.type = attributes[:'type']
68
+ end
69
+
70
+ if attributes.key?(:'attributes')
71
+ self.attributes = attributes[:'attributes']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ type == o.type &&
94
+ attributes == o.attributes
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [type, attributes].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.openapi_types.each_pair do |key, type|
122
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
123
+ self.send("#{key}=", nil)
124
+ elsif type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :Time
145
+ Time.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ # models (e.g. Pet) or oneOf
176
+ klass = Shotstack.const_get(type)
177
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -1,16 +1,17 @@
1
1
  =begin
2
2
  #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
4
+ #Shotstack is a video, image and audio editing service that allows for the automated generation of videos, images and audio using JSON and a RESTful API. You arrange and configure an edit and POST it to the API which will render your media and provide a file location when complete. For more details visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation. There are two main API's, one for editing and generating assets (Edit API) and one for managing hosted assets (Serve API). The Edit API base URL is: <b>https://api.shotstack.io/{version}</b> The Serve API base URL is: <b>https://api.shotstack.io/serve/{version}</b>
5
5
 
6
6
  The version of the OpenAPI document: v1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
  require_relative 'asset'
15
16
 
16
17
  module Shotstack
@@ -28,23 +29,55 @@ module Shotstack
28
29
  # Set the volume for the audio clip between 0 and 1 where 0 is muted and 1 is full volume (defaults to 1).
29
30
  attr_accessor :volume
30
31
 
32
+ # The effect to apply to the audio asset <ul> <li>`fadeIn` - fade volume in only</li> <li>`fadeOut` - fade volume out only</li> <li>`fadeInFadeOut` - fade volume in and out</li> </ul>
33
+ attr_accessor :effect
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
31
57
  # Attribute mapping from ruby-style variable name to JSON key.
32
58
  def self.attribute_map
33
59
  {
34
60
  :'type' => :'type',
35
61
  :'src' => :'src',
36
62
  :'trim' => :'trim',
37
- :'volume' => :'volume'
63
+ :'volume' => :'volume',
64
+ :'effect' => :'effect'
38
65
  }
39
66
  end
40
67
 
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
41
73
  # Attribute type mapping.
42
74
  def self.openapi_types
43
75
  {
44
76
  :'type' => :'String',
45
77
  :'src' => :'String',
46
78
  :'trim' => :'Float',
47
- :'volume' => :'Float'
79
+ :'volume' => :'Float',
80
+ :'effect' => :'String'
48
81
  }
49
82
  end
50
83
 
@@ -88,6 +121,10 @@ module Shotstack
88
121
  else
89
122
  self.volume = 1
90
123
  end
124
+
125
+ if attributes.key?(:'effect')
126
+ self.effect = attributes[:'effect']
127
+ end
91
128
  end
92
129
 
93
130
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -110,9 +147,21 @@ module Shotstack
110
147
  def valid?
111
148
  return false if @type.nil?
112
149
  return false if @src.nil?
150
+ effect_validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
151
+ return false unless effect_validator.valid?(@effect)
113
152
  true
114
153
  end
115
154
 
155
+ # Custom attribute writer method checking allowed values (enum).
156
+ # @param [Object] effect Object to be assigned
157
+ def effect=(effect)
158
+ validator = EnumAttributeValidator.new('String', ["fadeIn", "fadeOut", "fadeInFadeOut"])
159
+ unless validator.valid?(effect)
160
+ fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}."
161
+ end
162
+ @effect = effect
163
+ end
164
+
116
165
  # Checks equality by comparing each attribute.
117
166
  # @param [Object] Object to be compared
118
167
  def ==(o)
@@ -121,7 +170,8 @@ module Shotstack
121
170
  type == o.type &&
122
171
  src == o.src &&
123
172
  trim == o.trim &&
124
- volume == o.volume
173
+ volume == o.volume &&
174
+ effect == o.effect
125
175
  end
126
176
 
127
177
  # @see the `==` method
@@ -133,7 +183,7 @@ module Shotstack
133
183
  # Calculates hash code according to all attributes.
134
184
  # @return [Integer] Hash code
135
185
  def hash
136
- [type, src, trim, volume].hash
186
+ [type, src, trim, volume, effect].hash
137
187
  end
138
188
 
139
189
  # Builds the object from hash
@@ -149,7 +199,9 @@ module Shotstack
149
199
  def build_from_hash(attributes)
150
200
  return nil unless attributes.is_a?(Hash)
151
201
  self.class.openapi_types.each_pair do |key, type|
152
- if type =~ /\AArray<(.*)>/i
202
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
203
+ self.send("#{key}=", nil)
204
+ elsif type =~ /\AArray<(.*)>/i
153
205
  # check to ensure the input is an array given that the attribute
154
206
  # is documented as an array but the input is not
155
207
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -157,7 +209,7 @@ module Shotstack
157
209
  end
158
210
  elsif !attributes[self.class.attribute_map[key]].nil?
159
211
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
- end # or else data not found in attributes(hash), not an issue as the data can be optional
212
+ end
161
213
  end
162
214
 
163
215
  self
@@ -169,8 +221,8 @@ module Shotstack
169
221
  # @return [Object] Deserialized data
170
222
  def _deserialize(type, value)
171
223
  case type.to_sym
172
- when :DateTime
173
- DateTime.parse(value)
224
+ when :Time
225
+ Time.parse(value)
174
226
  when :Date
175
227
  Date.parse(value)
176
228
  when :String
@@ -200,7 +252,9 @@ module Shotstack
200
252
  end
201
253
  end
202
254
  else # model
203
- Shotstack.const_get(type).build_from_hash(value)
255
+ # models (e.g. Pet) or oneOf
256
+ klass = Shotstack.const_get(type)
257
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
258
  end
205
259
  end
206
260
 
@@ -226,7 +280,7 @@ module Shotstack
226
280
  is_nullable = self.class.openapi_nullable.include?(attr)
227
281
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
282
  end
229
-
283
+
230
284
  hash[param] = _to_hash(value)
231
285
  end
232
286
  hash
@@ -249,5 +303,7 @@ module Shotstack
249
303
  value
250
304
  end
251
305
  end
306
+
252
307
  end
308
+
253
309
  end
@@ -1,16 +1,17 @@
1
1
  =begin
2
2
  #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
4
+ #Shotstack is a video, image and audio editing service that allows for the automated generation of videos, images and audio using JSON and a RESTful API. You arrange and configure an edit and POST it to the API which will render your media and provide a file location when complete. For more details visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation. There are two main API's, one for editing and generating assets (Edit API) and one for managing hosted assets (Serve API). The Edit API base URL is: <b>https://api.shotstack.io/{version}</b> The Serve API base URL is: <b>https://api.shotstack.io/serve/{version}</b>
5
5
 
6
6
  The version of the OpenAPI document: v1
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.1
9
+ OpenAPI Generator version: 5.0.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Shotstack
16
17
  # A clip is a container for a specific type of asset, i.e. a title, image, video, audio or html. You use a Clip to define when an asset will display on the timeline, how long it will play for and transitions, filters and effects to apply to it.
@@ -40,7 +41,7 @@ module Shotstack
40
41
  # A motion effect to apply to the Clip. <ul> <li>`zoomIn` - slow zoom in</li> <li>`zoomOut` - slow zoom out</li> <li>`slideLeft` - slow slide (pan) left</li> <li>`slideRight` - slow slide (pan) right</li> <li>`slideUp` - slow slide (pan) up</li> <li>`slideDown` - slow slide (pan) down</li> </ul>
41
42
  attr_accessor :effect
42
43
 
43
- # A filter effect to apply to the Clip. <ul> <li>`blur` - blurs the image or video</li> <li>`boost` - boost contrast and saturation</li> <li>`contrast` - increase contrast</li> <li>`darken` - darken the scene</li> <li>`greyscale` - remove colour</li> <li>`lighten` - lighten the scene</li> <li>`muted` - reduce saturation and contrast</li> <li>`invert` - invert colors</li> </ul>
44
+ # A filter effect to apply to the Clip. <ul> <li>`boost` - boost contrast and saturation</li> <li>`contrast` - increase contrast</li> <li>`darken` - darken the scene</li> <li>`greyscale` - remove colour</li> <li>`lighten` - lighten the scene</li> <li>`muted` - reduce saturation and contrast</li> <li>`invert` - invert colors</li> </ul>
44
45
  attr_accessor :filter
45
46
 
46
47
  # Sets the opacity of the Clip where 1 is opaque and 0 is transparent.
@@ -85,6 +86,11 @@ module Shotstack
85
86
  }
86
87
  end
87
88
 
89
+ # Returns all the JSON keys this model knows about
90
+ def self.acceptable_attributes
91
+ attribute_map.values
92
+ end
93
+
88
94
  # Attribute type mapping.
89
95
  def self.openapi_types
90
96
  {
@@ -205,7 +211,7 @@ module Shotstack
205
211
  return false unless position_validator.valid?(@position)
206
212
  effect_validator = EnumAttributeValidator.new('String', ["zoomIn", "zoomOut", "slideLeft", "slideRight", "slideUp", "slideDown"])
207
213
  return false unless effect_validator.valid?(@effect)
208
- filter_validator = EnumAttributeValidator.new('String', ["blur", "boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
214
+ filter_validator = EnumAttributeValidator.new('String', ["boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
209
215
  return false unless filter_validator.valid?(@filter)
210
216
  true
211
217
  end
@@ -243,7 +249,7 @@ module Shotstack
243
249
  # Custom attribute writer method checking allowed values (enum).
244
250
  # @param [Object] filter Object to be assigned
245
251
  def filter=(filter)
246
- validator = EnumAttributeValidator.new('String', ["blur", "boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
252
+ validator = EnumAttributeValidator.new('String', ["boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"])
247
253
  unless validator.valid?(filter)
248
254
  fail ArgumentError, "invalid value for \"filter\", must be one of #{validator.allowable_values}."
249
255
  end
@@ -293,7 +299,9 @@ module Shotstack
293
299
  def build_from_hash(attributes)
294
300
  return nil unless attributes.is_a?(Hash)
295
301
  self.class.openapi_types.each_pair do |key, type|
296
- if type =~ /\AArray<(.*)>/i
302
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
303
+ self.send("#{key}=", nil)
304
+ elsif type =~ /\AArray<(.*)>/i
297
305
  # check to ensure the input is an array given that the attribute
298
306
  # is documented as an array but the input is not
299
307
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -301,7 +309,7 @@ module Shotstack
301
309
  end
302
310
  elsif !attributes[self.class.attribute_map[key]].nil?
303
311
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
304
- end # or else data not found in attributes(hash), not an issue as the data can be optional
312
+ end
305
313
  end
306
314
 
307
315
  self
@@ -313,8 +321,8 @@ module Shotstack
313
321
  # @return [Object] Deserialized data
314
322
  def _deserialize(type, value)
315
323
  case type.to_sym
316
- when :DateTime
317
- DateTime.parse(value)
324
+ when :Time
325
+ Time.parse(value)
318
326
  when :Date
319
327
  Date.parse(value)
320
328
  when :String
@@ -344,7 +352,9 @@ module Shotstack
344
352
  end
345
353
  end
346
354
  else # model
347
- Shotstack.const_get(type).build_from_hash(value)
355
+ # models (e.g. Pet) or oneOf
356
+ klass = Shotstack.const_get(type)
357
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
348
358
  end
349
359
  end
350
360
 
@@ -370,7 +380,7 @@ module Shotstack
370
380
  is_nullable = self.class.openapi_nullable.include?(attr)
371
381
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
372
382
  end
373
-
383
+
374
384
  hash[param] = _to_hash(value)
375
385
  end
376
386
  hash
@@ -393,5 +403,7 @@ module Shotstack
393
403
  value
394
404
  end
395
405
  end
406
+
396
407
  end
408
+
397
409
  end