shotstack 0.1.0 → 0.1.5

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.
@@ -6,18 +6,19 @@
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
  class QueuedResponseData
17
- # Success response message
18
+ # Success response message or error details.
18
19
  attr_accessor :message
19
20
 
20
- # The id of the render task in UUID format
21
+ # The id of the render task in UUID format.
21
22
  attr_accessor :id
22
23
 
23
24
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -28,6 +29,11 @@ module Shotstack
28
29
  }
29
30
  end
30
31
 
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
31
37
  # Attribute type mapping.
32
38
  def self.openapi_types
33
39
  {
@@ -123,7 +129,9 @@ module Shotstack
123
129
  def build_from_hash(attributes)
124
130
  return nil unless attributes.is_a?(Hash)
125
131
  self.class.openapi_types.each_pair do |key, type|
126
- if type =~ /\AArray<(.*)>/i
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
127
135
  # check to ensure the input is an array given that the attribute
128
136
  # is documented as an array but the input is not
129
137
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -131,7 +139,7 @@ module Shotstack
131
139
  end
132
140
  elsif !attributes[self.class.attribute_map[key]].nil?
133
141
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
- end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
135
143
  end
136
144
 
137
145
  self
@@ -143,8 +151,8 @@ module Shotstack
143
151
  # @return [Object] Deserialized data
144
152
  def _deserialize(type, value)
145
153
  case type.to_sym
146
- when :DateTime
147
- DateTime.parse(value)
154
+ when :Time
155
+ Time.parse(value)
148
156
  when :Date
149
157
  Date.parse(value)
150
158
  when :String
@@ -174,7 +182,9 @@ module Shotstack
174
182
  end
175
183
  end
176
184
  else # model
177
- Shotstack.const_get(type).build_from_hash(value)
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Shotstack.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
188
  end
179
189
  end
180
190
 
@@ -200,7 +210,7 @@ module Shotstack
200
210
  is_nullable = self.class.openapi_nullable.include?(attr)
201
211
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
212
  end
203
-
213
+
204
214
  hash[param] = _to_hash(value)
205
215
  end
206
216
  hash
@@ -223,5 +233,7 @@ module Shotstack
223
233
  value
224
234
  end
225
235
  end
236
+
226
237
  end
238
+
227
239
  end
@@ -0,0 +1,260 @@
1
+ =begin
2
+ #Shotstack
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
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
+ # Specify a time range to render, i.e. to render only a portion of a video or audio file. Omit this setting to export the entire video.
18
+ class Range
19
+ # The point on the timeline, in seconds, to start the render from - i.e. start at second 3.
20
+ attr_accessor :start
21
+
22
+ # The length of the portion of the video to render - i.e. render 6 seconds of the video.
23
+ attr_accessor :length
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'start' => :'start',
29
+ :'length' => :'length'
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
+ :'start' => :'Float',
42
+ :'length' => :'Float'
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::Range` 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::Range`. 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?(:'start')
68
+ self.start = attributes[:'start']
69
+ end
70
+
71
+ if attributes.key?(:'length')
72
+ self.length = attributes[:'length']
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if !@start.nil? && @start < 0
81
+ invalid_properties.push('invalid value for "start", must be greater than or equal to 0.')
82
+ end
83
+
84
+ if !@length.nil? && @length < 0
85
+ invalid_properties.push('invalid value for "length", must be greater than or equal to 0.')
86
+ end
87
+
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ return false if !@start.nil? && @start < 0
95
+ return false if !@length.nil? && @length < 0
96
+ true
97
+ end
98
+
99
+ # Custom attribute writer method with validation
100
+ # @param [Object] start Value to be assigned
101
+ def start=(start)
102
+ if !start.nil? && start < 0
103
+ fail ArgumentError, 'invalid value for "start", must be greater than or equal to 0.'
104
+ end
105
+
106
+ @start = start
107
+ end
108
+
109
+ # Custom attribute writer method with validation
110
+ # @param [Object] length Value to be assigned
111
+ def length=(length)
112
+ if !length.nil? && length < 0
113
+ fail ArgumentError, 'invalid value for "length", must be greater than or equal to 0.'
114
+ end
115
+
116
+ @length = length
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ start == o.start &&
125
+ length == o.length
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [start, length].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
154
+ self.send("#{key}=", nil)
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = Shotstack.const_get(type)
208
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end
@@ -6,16 +6,19 @@
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
  class RenderResponse
18
+ # `true` if status available, else `false`.
17
19
  attr_accessor :success
18
20
 
21
+ # `OK` or an error message.
19
22
  attr_accessor :message
20
23
 
21
24
  attr_accessor :response
@@ -29,6 +32,11 @@ module Shotstack
29
32
  }
30
33
  end
31
34
 
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
32
40
  # Attribute type mapping.
33
41
  def self.openapi_types
34
42
  {
@@ -135,7 +143,9 @@ module Shotstack
135
143
  def build_from_hash(attributes)
136
144
  return nil unless attributes.is_a?(Hash)
137
145
  self.class.openapi_types.each_pair do |key, type|
138
- if type =~ /\AArray<(.*)>/i
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
139
149
  # check to ensure the input is an array given that the attribute
140
150
  # is documented as an array but the input is not
141
151
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -143,7 +153,7 @@ module Shotstack
143
153
  end
144
154
  elsif !attributes[self.class.attribute_map[key]].nil?
145
155
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
- end # or else data not found in attributes(hash), not an issue as the data can be optional
156
+ end
147
157
  end
148
158
 
149
159
  self
@@ -155,8 +165,8 @@ module Shotstack
155
165
  # @return [Object] Deserialized data
156
166
  def _deserialize(type, value)
157
167
  case type.to_sym
158
- when :DateTime
159
- DateTime.parse(value)
168
+ when :Time
169
+ Time.parse(value)
160
170
  when :Date
161
171
  Date.parse(value)
162
172
  when :String
@@ -186,7 +196,9 @@ module Shotstack
186
196
  end
187
197
  end
188
198
  else # model
189
- Shotstack.const_get(type).build_from_hash(value)
199
+ # models (e.g. Pet) or oneOf
200
+ klass = Shotstack.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
202
  end
191
203
  end
192
204
 
@@ -212,7 +224,7 @@ module Shotstack
212
224
  is_nullable = self.class.openapi_nullable.include?(attr)
213
225
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
226
  end
215
-
227
+
216
228
  hash[param] = _to_hash(value)
217
229
  end
218
230
  hash
@@ -235,5 +247,7 @@ module Shotstack
235
247
  value
236
248
  end
237
249
  end
250
+
238
251
  end
252
+
239
253
  end
@@ -6,32 +6,51 @@
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
  class RenderResponseData
17
- # The status of the render task
18
- attr_accessor :status
19
-
20
- # The id of the render task in UUID format
18
+ # The id of the render task in UUID format.
21
19
  attr_accessor :id
22
20
 
23
- # The owner id of the render task
21
+ # The owner id of the render task.
24
22
  attr_accessor :owner
25
23
 
24
+ # The customer subscription plan.
25
+ attr_accessor :plan
26
+
27
+ # The status of the render task. <ul> <li>`queued` - render is queued waiting to be rendered</li> <li>`fetching` - assets are being fetched</li> <li>`rendering` - the video is being rendered</li> <li>`saving` - the final video is being saved to storage</li> <li>`done` - the video is ready to be downloaded</li> <li>`failed` - there was an error rendering the video</li> </ul>
28
+ attr_accessor :status
29
+
30
+ # An error message, only displayed if an error occurred.
31
+ attr_accessor :error
32
+
33
+ # The output video length in seconds.
34
+ attr_accessor :duration
35
+
36
+ # The time taken to render the video in milliseconds.
37
+ attr_accessor :render_time
38
+
26
39
  # The URL of the final video. This will only be available if status is done.
27
40
  attr_accessor :url
28
41
 
42
+ # The URL of the poster image if requested. This will only be available if status is done.
43
+ attr_accessor :poster
44
+
45
+ # The URL of the thumbnail image if requested. This will only be available if status is done.
46
+ attr_accessor :thumbnail
47
+
29
48
  attr_accessor :data
30
49
 
31
- # The time the render task was initially queued
50
+ # The time the render task was initially queued.
32
51
  attr_accessor :created
33
52
 
34
- # The time the render status was last updated
53
+ # The time the render status was last updated.
35
54
  attr_accessor :updated
36
55
 
37
56
  class EnumAttributeValidator
@@ -59,23 +78,40 @@ module Shotstack
59
78
  # Attribute mapping from ruby-style variable name to JSON key.
60
79
  def self.attribute_map
61
80
  {
62
- :'status' => :'status',
63
81
  :'id' => :'id',
64
82
  :'owner' => :'owner',
83
+ :'plan' => :'plan',
84
+ :'status' => :'status',
85
+ :'error' => :'error',
86
+ :'duration' => :'duration',
87
+ :'render_time' => :'renderTime',
65
88
  :'url' => :'url',
89
+ :'poster' => :'poster',
90
+ :'thumbnail' => :'thumbnail',
66
91
  :'data' => :'data',
67
92
  :'created' => :'created',
68
93
  :'updated' => :'updated'
69
94
  }
70
95
  end
71
96
 
97
+ # Returns all the JSON keys this model knows about
98
+ def self.acceptable_attributes
99
+ attribute_map.values
100
+ end
101
+
72
102
  # Attribute type mapping.
73
103
  def self.openapi_types
74
104
  {
75
- :'status' => :'String',
76
105
  :'id' => :'String',
77
106
  :'owner' => :'String',
107
+ :'plan' => :'String',
108
+ :'status' => :'String',
109
+ :'error' => :'String',
110
+ :'duration' => :'Float',
111
+ :'render_time' => :'Float',
78
112
  :'url' => :'String',
113
+ :'poster' => :'String',
114
+ :'thumbnail' => :'String',
79
115
  :'data' => :'Edit',
80
116
  :'created' => :'String',
81
117
  :'updated' => :'String'
@@ -103,10 +139,6 @@ module Shotstack
103
139
  h[k.to_sym] = v
104
140
  }
105
141
 
106
- if attributes.key?(:'status')
107
- self.status = attributes[:'status']
108
- end
109
-
110
142
  if attributes.key?(:'id')
111
143
  self.id = attributes[:'id']
112
144
  end
@@ -115,10 +147,38 @@ module Shotstack
115
147
  self.owner = attributes[:'owner']
116
148
  end
117
149
 
150
+ if attributes.key?(:'plan')
151
+ self.plan = attributes[:'plan']
152
+ end
153
+
154
+ if attributes.key?(:'status')
155
+ self.status = attributes[:'status']
156
+ end
157
+
158
+ if attributes.key?(:'error')
159
+ self.error = attributes[:'error']
160
+ end
161
+
162
+ if attributes.key?(:'duration')
163
+ self.duration = attributes[:'duration']
164
+ end
165
+
166
+ if attributes.key?(:'render_time')
167
+ self.render_time = attributes[:'render_time']
168
+ end
169
+
118
170
  if attributes.key?(:'url')
119
171
  self.url = attributes[:'url']
120
172
  end
121
173
 
174
+ if attributes.key?(:'poster')
175
+ self.poster = attributes[:'poster']
176
+ end
177
+
178
+ if attributes.key?(:'thumbnail')
179
+ self.thumbnail = attributes[:'thumbnail']
180
+ end
181
+
122
182
  if attributes.key?(:'data')
123
183
  self.data = attributes[:'data']
124
184
  end
@@ -136,10 +196,6 @@ module Shotstack
136
196
  # @return Array for valid properties with the reasons
137
197
  def list_invalid_properties
138
198
  invalid_properties = Array.new
139
- if @status.nil?
140
- invalid_properties.push('invalid value for "status", status cannot be nil.')
141
- end
142
-
143
199
  if @id.nil?
144
200
  invalid_properties.push('invalid value for "id", id cannot be nil.')
145
201
  end
@@ -148,6 +204,10 @@ module Shotstack
148
204
  invalid_properties.push('invalid value for "owner", owner cannot be nil.')
149
205
  end
150
206
 
207
+ if @status.nil?
208
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
209
+ end
210
+
151
211
  if @data.nil?
152
212
  invalid_properties.push('invalid value for "data", data cannot be nil.')
153
213
  end
@@ -166,11 +226,11 @@ module Shotstack
166
226
  # Check to see if the all the properties in the model are valid
167
227
  # @return true if the model is valid
168
228
  def valid?
229
+ return false if @id.nil?
230
+ return false if @owner.nil?
169
231
  return false if @status.nil?
170
232
  status_validator = EnumAttributeValidator.new('String', ["queued", "fetching", "rendering", "saving", "done", "failed"])
171
233
  return false unless status_validator.valid?(@status)
172
- return false if @id.nil?
173
- return false if @owner.nil?
174
234
  return false if @data.nil?
175
235
  return false if @created.nil?
176
236
  return false if @updated.nil?
@@ -192,10 +252,16 @@ module Shotstack
192
252
  def ==(o)
193
253
  return true if self.equal?(o)
194
254
  self.class == o.class &&
195
- status == o.status &&
196
255
  id == o.id &&
197
256
  owner == o.owner &&
257
+ plan == o.plan &&
258
+ status == o.status &&
259
+ error == o.error &&
260
+ duration == o.duration &&
261
+ render_time == o.render_time &&
198
262
  url == o.url &&
263
+ poster == o.poster &&
264
+ thumbnail == o.thumbnail &&
199
265
  data == o.data &&
200
266
  created == o.created &&
201
267
  updated == o.updated
@@ -210,7 +276,7 @@ module Shotstack
210
276
  # Calculates hash code according to all attributes.
211
277
  # @return [Integer] Hash code
212
278
  def hash
213
- [status, id, owner, url, data, created, updated].hash
279
+ [id, owner, plan, status, error, duration, render_time, url, poster, thumbnail, data, created, updated].hash
214
280
  end
215
281
 
216
282
  # Builds the object from hash
@@ -226,7 +292,9 @@ module Shotstack
226
292
  def build_from_hash(attributes)
227
293
  return nil unless attributes.is_a?(Hash)
228
294
  self.class.openapi_types.each_pair do |key, type|
229
- if type =~ /\AArray<(.*)>/i
295
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
296
+ self.send("#{key}=", nil)
297
+ elsif type =~ /\AArray<(.*)>/i
230
298
  # check to ensure the input is an array given that the attribute
231
299
  # is documented as an array but the input is not
232
300
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -234,7 +302,7 @@ module Shotstack
234
302
  end
235
303
  elsif !attributes[self.class.attribute_map[key]].nil?
236
304
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
- end # or else data not found in attributes(hash), not an issue as the data can be optional
305
+ end
238
306
  end
239
307
 
240
308
  self
@@ -246,8 +314,8 @@ module Shotstack
246
314
  # @return [Object] Deserialized data
247
315
  def _deserialize(type, value)
248
316
  case type.to_sym
249
- when :DateTime
250
- DateTime.parse(value)
317
+ when :Time
318
+ Time.parse(value)
251
319
  when :Date
252
320
  Date.parse(value)
253
321
  when :String
@@ -277,7 +345,9 @@ module Shotstack
277
345
  end
278
346
  end
279
347
  else # model
280
- Shotstack.const_get(type).build_from_hash(value)
348
+ # models (e.g. Pet) or oneOf
349
+ klass = Shotstack.const_get(type)
350
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
281
351
  end
282
352
  end
283
353
 
@@ -303,7 +373,7 @@ module Shotstack
303
373
  is_nullable = self.class.openapi_nullable.include?(attr)
304
374
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
375
  end
306
-
376
+
307
377
  hash[param] = _to_hash(value)
308
378
  end
309
379
  hash
@@ -326,5 +396,7 @@ module Shotstack
326
396
  value
327
397
  end
328
398
  end
399
+
329
400
  end
401
+
330
402
  end