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.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/README.md +387 -23
- data/Rakefile +10 -0
- data/lib/shotstack/api/create_api.rb +158 -0
- data/lib/shotstack/api/edit_api.rb +20 -20
- data/lib/shotstack/api/ingest_api.rb +338 -0
- data/lib/shotstack/api/serve_api.rb +76 -8
- data/lib/shotstack/api_client.rb +28 -24
- data/lib/shotstack/api_error.rb +3 -2
- data/lib/shotstack/configuration.rb +55 -9
- data/lib/shotstack/models/asset.rb +4 -4
- data/lib/shotstack/models/asset_render_response.rb +23 -20
- data/lib/shotstack/models/asset_response.rb +23 -20
- data/lib/shotstack/models/asset_response_attributes.rb +38 -21
- data/lib/shotstack/models/asset_response_data.rb +30 -20
- data/lib/shotstack/models/audio_asset.rb +57 -23
- data/lib/shotstack/models/audio_enhancement.rb +43 -0
- data/lib/shotstack/models/clip.rb +29 -33
- data/lib/shotstack/models/crop.rb +40 -28
- data/lib/shotstack/models/destinations.rb +78 -244
- data/lib/shotstack/models/did_generated_asset.rb +273 -0
- data/lib/shotstack/models/did_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/did_text_to_avatar_options.rb +313 -0
- data/lib/shotstack/models/dolby_enhancement.rb +239 -0
- data/lib/shotstack/models/dolby_enhancement_options.rb +257 -0
- data/lib/shotstack/models/edit.rb +22 -24
- data/lib/shotstack/models/eleven_labs_generated_asset.rb +273 -0
- data/lib/shotstack/models/eleven_labs_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/eleven_labs_text_to_speech_options.rb +303 -0
- data/lib/shotstack/models/enhancements.rb +215 -0
- data/lib/shotstack/models/flip_transformation.rb +16 -24
- data/lib/shotstack/models/font.rb +18 -20
- data/lib/shotstack/models/generated_asset.rb +48 -0
- data/lib/shotstack/models/generated_asset_error_response.rb +225 -0
- data/lib/shotstack/models/generated_asset_error_response_data.rb +257 -0
- data/lib/shotstack/models/generated_asset_response.rb +222 -0
- data/lib/shotstack/models/generated_asset_response_attributes.rb +376 -0
- data/lib/shotstack/models/generated_asset_response_data.rb +256 -0
- data/lib/shotstack/models/google_cloud_storage_destination.rb +232 -0
- data/lib/shotstack/models/google_cloud_storage_destination_options.rb +243 -0
- data/lib/shotstack/models/google_drive_destination.rb +239 -0
- data/lib/shotstack/models/google_drive_destination_options.rb +233 -0
- data/lib/shotstack/models/hey_gen_generated_asset.rb +273 -0
- data/lib/shotstack/models/hey_gen_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/hey_gen_text_to_avatar_options.rb +396 -0
- data/lib/shotstack/models/html_asset.rb +20 -26
- data/lib/shotstack/models/image_asset.rb +18 -20
- data/lib/shotstack/models/ingest_error_response.rb +225 -0
- data/lib/shotstack/models/ingest_error_response_data.rb +257 -0
- data/lib/shotstack/models/luma_asset.rb +18 -20
- data/lib/shotstack/models/merge_field.rb +20 -20
- data/lib/shotstack/models/mux_destination.rb +18 -22
- data/lib/shotstack/models/mux_destination_options.rb +50 -25
- data/lib/shotstack/models/offset.rb +46 -46
- data/lib/shotstack/models/open_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/open_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/open_ai_text_generator_options.rb +313 -0
- data/lib/shotstack/models/output.rb +40 -35
- data/lib/shotstack/models/outputs.rb +227 -0
- data/lib/shotstack/models/outputs_response.rb +218 -0
- data/lib/shotstack/models/poster.rb +18 -20
- data/lib/shotstack/models/probe_response.rb +22 -20
- data/lib/shotstack/models/queued_response.rb +22 -20
- data/lib/shotstack/models/queued_response_data.rb +20 -20
- data/lib/shotstack/models/queued_source_response.rb +222 -0
- data/lib/shotstack/models/queued_source_response_data.rb +240 -0
- data/lib/shotstack/models/range.rb +26 -22
- data/lib/shotstack/models/render_response.rb +22 -20
- data/lib/shotstack/models/render_response_data.rb +24 -35
- data/lib/shotstack/models/rendition.rb +429 -0
- data/lib/shotstack/models/rendition_response_attributes.rb +336 -0
- data/lib/shotstack/models/rotate_transformation.rb +16 -22
- data/lib/shotstack/models/s3_destination.rb +232 -0
- data/lib/shotstack/models/s3_destination_options.rb +270 -0
- data/lib/shotstack/models/shotstack_destination.rb +19 -25
- data/lib/shotstack/models/shotstack_generated_asset.rb +273 -0
- data/lib/shotstack/models/shotstack_generated_asset_options.rb +60 -0
- data/lib/shotstack/models/shotstack_image_to_video_options.rb +298 -0
- data/lib/shotstack/models/shotstack_text_generator_options.rb +274 -0
- data/lib/shotstack/models/shotstack_text_to_image_options.rb +308 -0
- data/lib/shotstack/models/shotstack_text_to_speech_options.rb +339 -0
- data/lib/shotstack/models/size.rb +39 -35
- data/lib/shotstack/models/skew_transformation.rb +16 -24
- data/lib/shotstack/models/soundtrack.rb +18 -22
- data/lib/shotstack/models/source.rb +244 -0
- data/lib/shotstack/models/source_list_response.rb +225 -0
- data/lib/shotstack/models/source_response.rb +222 -0
- data/lib/shotstack/models/source_response_attributes.rb +373 -0
- data/lib/shotstack/models/source_response_data.rb +256 -0
- data/lib/shotstack/models/speed.rb +254 -0
- data/lib/shotstack/models/stability_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/stability_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/stability_ai_text_to_image_options.rb +390 -0
- data/lib/shotstack/models/template.rb +18 -20
- data/lib/shotstack/models/template_data_response.rb +24 -22
- data/lib/shotstack/models/template_data_response_data.rb +25 -22
- data/lib/shotstack/models/template_list_response.rb +24 -22
- data/lib/shotstack/models/template_list_response_data.rb +20 -20
- data/lib/shotstack/models/template_list_response_item.rb +20 -30
- data/lib/shotstack/models/template_render.rb +19 -21
- data/lib/shotstack/models/template_response.rb +23 -21
- data/lib/shotstack/models/template_response_data.rb +20 -20
- data/lib/shotstack/models/thumbnail.rb +20 -20
- data/lib/shotstack/models/timeline.rb +19 -25
- data/lib/shotstack/models/title_asset.rb +19 -27
- data/lib/shotstack/models/track.rb +18 -20
- data/lib/shotstack/models/transcription.rb +250 -0
- data/lib/shotstack/models/transfer.rb +259 -0
- data/lib/shotstack/models/transfer_response.rb +222 -0
- data/lib/shotstack/models/transfer_response_attributes.rb +280 -0
- data/lib/shotstack/models/transfer_response_data.rb +225 -0
- data/lib/shotstack/models/transformation.rb +16 -20
- data/lib/shotstack/models/transition.rb +16 -20
- data/lib/shotstack/models/upload_response.rb +222 -0
- data/lib/shotstack/models/upload_response_attributes.rb +257 -0
- data/lib/shotstack/models/upload_response_data.rb +256 -0
- data/lib/shotstack/models/video_asset.rb +102 -22
- data/lib/shotstack/version.rb +3 -3
- data/lib/shotstack.rb +63 -2
- data/shotstack.gemspec +8 -8
- metadata +80 -24
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,9 +14,9 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Shotstack
|
17
|
-
# Send
|
17
|
+
# Send videos to the [Mux](https://shotstack.io/docs/guide/serving-assets/destinations/mux/) video hosting and streaming service. Mux credentials are required and added via the [dashboard](https://dashboard.shotstack.io/integrations/mux), not in the request.
|
18
18
|
class MuxDestination
|
19
|
-
# The destination to send
|
19
|
+
# The destination to send video to - set to `mux` for Mux.
|
20
20
|
attr_accessor :provider
|
21
21
|
|
22
22
|
attr_accessor :options
|
@@ -77,6 +77,7 @@ module Shotstack
|
|
77
77
|
# Show invalid properties with the reasons. Usually used together with valid?
|
78
78
|
# @return Array for valid properties with the reasons
|
79
79
|
def list_invalid_properties
|
80
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
80
81
|
invalid_properties = Array.new
|
81
82
|
if @provider.nil?
|
82
83
|
invalid_properties.push('invalid value for "provider", provider cannot be nil.')
|
@@ -88,6 +89,7 @@ module Shotstack
|
|
88
89
|
# Check to see if the all the properties in the model are valid
|
89
90
|
# @return true if the model is valid
|
90
91
|
def valid?
|
92
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
93
|
return false if @provider.nil?
|
92
94
|
true
|
93
95
|
end
|
@@ -117,36 +119,30 @@ module Shotstack
|
|
117
119
|
# @param [Hash] attributes Model attributes in the form of hash
|
118
120
|
# @return [Object] Returns the model itself
|
119
121
|
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
122
|
return nil unless attributes.is_a?(Hash)
|
128
|
-
|
129
|
-
|
130
|
-
|
123
|
+
attributes = attributes.transform_keys(&:to_sym)
|
124
|
+
transformed_hash = {}
|
125
|
+
openapi_types.each_pair do |key, type|
|
126
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
127
|
+
transformed_hash["#{key}"] = nil
|
131
128
|
elsif type =~ /\AArray<(.*)>/i
|
132
129
|
# check to ensure the input is an array given that the attribute
|
133
130
|
# is documented as an array but the input is not
|
134
|
-
if attributes[
|
135
|
-
|
131
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
132
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
136
133
|
end
|
137
|
-
elsif !attributes[
|
138
|
-
|
134
|
+
elsif !attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
139
136
|
end
|
140
137
|
end
|
141
|
-
|
142
|
-
self
|
138
|
+
new(transformed_hash)
|
143
139
|
end
|
144
140
|
|
145
141
|
# Deserializes the data based on type
|
146
142
|
# @param string type Data type
|
147
143
|
# @param string value Value to be deserialized
|
148
144
|
# @return [Object] Deserialized data
|
149
|
-
def _deserialize(type, value)
|
145
|
+
def self._deserialize(type, value)
|
150
146
|
case type.to_sym
|
151
147
|
when :Time
|
152
148
|
Time.parse(value)
|
@@ -181,7 +177,7 @@ module Shotstack
|
|
181
177
|
else # model
|
182
178
|
# models (e.g. Pet) or oneOf
|
183
179
|
klass = Shotstack.const_get(type)
|
184
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
180
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
185
181
|
end
|
186
182
|
end
|
187
183
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,11 +14,14 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Shotstack
|
17
|
-
# Pass additional options to control how Mux processes video. Currently supports
|
17
|
+
# Pass additional options to control how Mux processes video. Currently supports playback_policy and passthrough options.
|
18
18
|
class MuxDestinationOptions
|
19
19
|
# Sets the Mux `playback_policy` option. Value is an array of strings - use `public`, `signed`, or both.
|
20
20
|
attr_accessor :playback_policy
|
21
21
|
|
22
|
+
# Sets the Mux `passthrough` option. Max 255 characters.
|
23
|
+
attr_accessor :passthrough
|
24
|
+
|
22
25
|
class EnumAttributeValidator
|
23
26
|
attr_reader :datatype
|
24
27
|
attr_reader :allowable_values
|
@@ -44,7 +47,8 @@ module Shotstack
|
|
44
47
|
# Attribute mapping from ruby-style variable name to JSON key.
|
45
48
|
def self.attribute_map
|
46
49
|
{
|
47
|
-
:'playback_policy' => :'playbackPolicy'
|
50
|
+
:'playback_policy' => :'playbackPolicy',
|
51
|
+
:'passthrough' => :'passthrough'
|
48
52
|
}
|
49
53
|
end
|
50
54
|
|
@@ -56,7 +60,8 @@ module Shotstack
|
|
56
60
|
# Attribute type mapping.
|
57
61
|
def self.openapi_types
|
58
62
|
{
|
59
|
-
:'playback_policy' => :'Array<String>'
|
63
|
+
:'playback_policy' => :'Array<String>',
|
64
|
+
:'passthrough' => :'String'
|
60
65
|
}
|
61
66
|
end
|
62
67
|
|
@@ -86,27 +91,53 @@ module Shotstack
|
|
86
91
|
self.playback_policy = value
|
87
92
|
end
|
88
93
|
end
|
94
|
+
|
95
|
+
if attributes.key?(:'passthrough')
|
96
|
+
self.passthrough = attributes[:'passthrough']
|
97
|
+
end
|
89
98
|
end
|
90
99
|
|
91
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
92
101
|
# @return Array for valid properties with the reasons
|
93
102
|
def list_invalid_properties
|
103
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
94
104
|
invalid_properties = Array.new
|
105
|
+
if !@passthrough.nil? && @passthrough.to_s.length > 255
|
106
|
+
invalid_properties.push('invalid value for "passthrough", the character length must be smaller than or equal to 255.')
|
107
|
+
end
|
108
|
+
|
95
109
|
invalid_properties
|
96
110
|
end
|
97
111
|
|
98
112
|
# Check to see if the all the properties in the model are valid
|
99
113
|
# @return true if the model is valid
|
100
114
|
def valid?
|
115
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
116
|
+
return false if !@passthrough.nil? && @passthrough.to_s.length > 255
|
101
117
|
true
|
102
118
|
end
|
103
119
|
|
120
|
+
# Custom attribute writer method with validation
|
121
|
+
# @param [Object] passthrough Value to be assigned
|
122
|
+
def passthrough=(passthrough)
|
123
|
+
if passthrough.nil?
|
124
|
+
fail ArgumentError, 'passthrough cannot be nil'
|
125
|
+
end
|
126
|
+
|
127
|
+
if passthrough.to_s.length > 255
|
128
|
+
fail ArgumentError, 'invalid value for "passthrough", the character length must be smaller than or equal to 255.'
|
129
|
+
end
|
130
|
+
|
131
|
+
@passthrough = passthrough
|
132
|
+
end
|
133
|
+
|
104
134
|
# Checks equality by comparing each attribute.
|
105
135
|
# @param [Object] Object to be compared
|
106
136
|
def ==(o)
|
107
137
|
return true if self.equal?(o)
|
108
138
|
self.class == o.class &&
|
109
|
-
playback_policy == o.playback_policy
|
139
|
+
playback_policy == o.playback_policy &&
|
140
|
+
passthrough == o.passthrough
|
110
141
|
end
|
111
142
|
|
112
143
|
# @see the `==` method
|
@@ -118,43 +149,37 @@ module Shotstack
|
|
118
149
|
# Calculates hash code according to all attributes.
|
119
150
|
# @return [Integer] Hash code
|
120
151
|
def hash
|
121
|
-
[playback_policy].hash
|
152
|
+
[playback_policy, passthrough].hash
|
122
153
|
end
|
123
154
|
|
124
155
|
# Builds the object from hash
|
125
156
|
# @param [Hash] attributes Model attributes in the form of hash
|
126
157
|
# @return [Object] Returns the model itself
|
127
158
|
def self.build_from_hash(attributes)
|
128
|
-
new.build_from_hash(attributes)
|
129
|
-
end
|
130
|
-
|
131
|
-
# Builds the object from hash
|
132
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
-
# @return [Object] Returns the model itself
|
134
|
-
def build_from_hash(attributes)
|
135
159
|
return nil unless attributes.is_a?(Hash)
|
136
|
-
|
137
|
-
|
138
|
-
|
160
|
+
attributes = attributes.transform_keys(&:to_sym)
|
161
|
+
transformed_hash = {}
|
162
|
+
openapi_types.each_pair do |key, type|
|
163
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
164
|
+
transformed_hash["#{key}"] = nil
|
139
165
|
elsif type =~ /\AArray<(.*)>/i
|
140
166
|
# check to ensure the input is an array given that the attribute
|
141
167
|
# is documented as an array but the input is not
|
142
|
-
if attributes[
|
143
|
-
|
168
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
169
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
144
170
|
end
|
145
|
-
elsif !attributes[
|
146
|
-
|
171
|
+
elsif !attributes[attribute_map[key]].nil?
|
172
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
147
173
|
end
|
148
174
|
end
|
149
|
-
|
150
|
-
self
|
175
|
+
new(transformed_hash)
|
151
176
|
end
|
152
177
|
|
153
178
|
# Deserializes the data based on type
|
154
179
|
# @param string type Data type
|
155
180
|
# @param string value Value to be deserialized
|
156
181
|
# @return [Object] Deserialized data
|
157
|
-
def _deserialize(type, value)
|
182
|
+
def self._deserialize(type, value)
|
158
183
|
case type.to_sym
|
159
184
|
when :Time
|
160
185
|
Time.parse(value)
|
@@ -189,7 +214,7 @@ module Shotstack
|
|
189
214
|
else # model
|
190
215
|
# models (e.g. Pet) or oneOf
|
191
216
|
klass = Shotstack.const_get(type)
|
192
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
217
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
193
218
|
end
|
194
219
|
end
|
195
220
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
2
|
#Shotstack
|
3
3
|
|
4
|
-
#
|
4
|
+
# Official Ruby SDK for the Shotstack Cloud Video Editing API
|
5
5
|
|
6
6
|
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
|
9
|
+
Generator version: 7.4.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -16,10 +16,10 @@ require 'time'
|
|
16
16
|
module Shotstack
|
17
17
|
# Offsets the position of an asset horizontally or vertically by a relative distance.
|
18
18
|
class Offset
|
19
|
-
# Offset an asset on the horizontal axis (left or right), range varies from -
|
19
|
+
# Offset an asset on the horizontal axis (left or right), range varies from -10 to 10. Positive numbers move the asset right, negative left. For all assets except titles the distance moved is relative to the width of the viewport - i.e. an X offset of 0.5 will move the asset half the screen width to the right.
|
20
20
|
attr_accessor :x
|
21
21
|
|
22
|
-
# Offset an asset on the vertical axis (up or down), range varies from -
|
22
|
+
# Offset an asset on the vertical axis (up or down), range varies from -10 to 10. Positive numbers move the asset up, negative down. For all assets except titles the distance moved is relative to the height of the viewport - i.e. an Y offset of 0.5 will move the asset up half the screen height.
|
23
23
|
attr_accessor :y
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -66,35 +66,32 @@ module Shotstack
|
|
66
66
|
|
67
67
|
if attributes.key?(:'x')
|
68
68
|
self.x = attributes[:'x']
|
69
|
-
else
|
70
|
-
self.x = 0
|
71
69
|
end
|
72
70
|
|
73
71
|
if attributes.key?(:'y')
|
74
72
|
self.y = attributes[:'y']
|
75
|
-
else
|
76
|
-
self.y = 0
|
77
73
|
end
|
78
74
|
end
|
79
75
|
|
80
76
|
# Show invalid properties with the reasons. Usually used together with valid?
|
81
77
|
# @return Array for valid properties with the reasons
|
82
78
|
def list_invalid_properties
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
83
80
|
invalid_properties = Array.new
|
84
|
-
if !@x.nil? && @x >
|
85
|
-
invalid_properties.push('invalid value for "x", must be smaller than or equal to
|
81
|
+
if !@x.nil? && @x > 10
|
82
|
+
invalid_properties.push('invalid value for "x", must be smaller than or equal to 10.')
|
86
83
|
end
|
87
84
|
|
88
|
-
if !@x.nil? && @x < -
|
89
|
-
invalid_properties.push('invalid value for "x", must be greater than or equal to -
|
85
|
+
if !@x.nil? && @x < -10
|
86
|
+
invalid_properties.push('invalid value for "x", must be greater than or equal to -10.')
|
90
87
|
end
|
91
88
|
|
92
|
-
if !@y.nil? && @y >
|
93
|
-
invalid_properties.push('invalid value for "y", must be smaller than or equal to
|
89
|
+
if !@y.nil? && @y > 10
|
90
|
+
invalid_properties.push('invalid value for "y", must be smaller than or equal to 10.')
|
94
91
|
end
|
95
92
|
|
96
|
-
if !@y.nil? && @y < -
|
97
|
-
invalid_properties.push('invalid value for "y", must be greater than or equal to -
|
93
|
+
if !@y.nil? && @y < -10
|
94
|
+
invalid_properties.push('invalid value for "y", must be greater than or equal to -10.')
|
98
95
|
end
|
99
96
|
|
100
97
|
invalid_properties
|
@@ -103,22 +100,27 @@ module Shotstack
|
|
103
100
|
# Check to see if the all the properties in the model are valid
|
104
101
|
# @return true if the model is valid
|
105
102
|
def valid?
|
106
|
-
|
107
|
-
return false if !@x.nil? && @x
|
108
|
-
return false if !@
|
109
|
-
return false if !@y.nil? && @y
|
103
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
104
|
+
return false if !@x.nil? && @x > 10
|
105
|
+
return false if !@x.nil? && @x < -10
|
106
|
+
return false if !@y.nil? && @y > 10
|
107
|
+
return false if !@y.nil? && @y < -10
|
110
108
|
true
|
111
109
|
end
|
112
110
|
|
113
111
|
# Custom attribute writer method with validation
|
114
112
|
# @param [Object] x Value to be assigned
|
115
113
|
def x=(x)
|
116
|
-
if
|
117
|
-
fail ArgumentError, '
|
114
|
+
if x.nil?
|
115
|
+
fail ArgumentError, 'x cannot be nil'
|
116
|
+
end
|
117
|
+
|
118
|
+
if x > 10
|
119
|
+
fail ArgumentError, 'invalid value for "x", must be smaller than or equal to 10.'
|
118
120
|
end
|
119
121
|
|
120
|
-
if
|
121
|
-
fail ArgumentError, 'invalid value for "x", must be greater than or equal to -
|
122
|
+
if x < -10
|
123
|
+
fail ArgumentError, 'invalid value for "x", must be greater than or equal to -10.'
|
122
124
|
end
|
123
125
|
|
124
126
|
@x = x
|
@@ -127,12 +129,16 @@ module Shotstack
|
|
127
129
|
# Custom attribute writer method with validation
|
128
130
|
# @param [Object] y Value to be assigned
|
129
131
|
def y=(y)
|
130
|
-
if
|
131
|
-
fail ArgumentError, '
|
132
|
+
if y.nil?
|
133
|
+
fail ArgumentError, 'y cannot be nil'
|
134
|
+
end
|
135
|
+
|
136
|
+
if y > 10
|
137
|
+
fail ArgumentError, 'invalid value for "y", must be smaller than or equal to 10.'
|
132
138
|
end
|
133
139
|
|
134
|
-
if
|
135
|
-
fail ArgumentError, 'invalid value for "y", must be greater than or equal to -
|
140
|
+
if y < -10
|
141
|
+
fail ArgumentError, 'invalid value for "y", must be greater than or equal to -10.'
|
136
142
|
end
|
137
143
|
|
138
144
|
@y = y
|
@@ -163,36 +169,30 @@ module Shotstack
|
|
163
169
|
# @param [Hash] attributes Model attributes in the form of hash
|
164
170
|
# @return [Object] Returns the model itself
|
165
171
|
def self.build_from_hash(attributes)
|
166
|
-
new.build_from_hash(attributes)
|
167
|
-
end
|
168
|
-
|
169
|
-
# Builds the object from hash
|
170
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
171
|
-
# @return [Object] Returns the model itself
|
172
|
-
def build_from_hash(attributes)
|
173
172
|
return nil unless attributes.is_a?(Hash)
|
174
|
-
|
175
|
-
|
176
|
-
|
173
|
+
attributes = attributes.transform_keys(&:to_sym)
|
174
|
+
transformed_hash = {}
|
175
|
+
openapi_types.each_pair do |key, type|
|
176
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
177
|
+
transformed_hash["#{key}"] = nil
|
177
178
|
elsif type =~ /\AArray<(.*)>/i
|
178
179
|
# check to ensure the input is an array given that the attribute
|
179
180
|
# is documented as an array but the input is not
|
180
|
-
if attributes[
|
181
|
-
|
181
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
182
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
182
183
|
end
|
183
|
-
elsif !attributes[
|
184
|
-
|
184
|
+
elsif !attributes[attribute_map[key]].nil?
|
185
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
185
186
|
end
|
186
187
|
end
|
187
|
-
|
188
|
-
self
|
188
|
+
new(transformed_hash)
|
189
189
|
end
|
190
190
|
|
191
191
|
# Deserializes the data based on type
|
192
192
|
# @param string type Data type
|
193
193
|
# @param string value Value to be deserialized
|
194
194
|
# @return [Object] Deserialized data
|
195
|
-
def _deserialize(type, value)
|
195
|
+
def self._deserialize(type, value)
|
196
196
|
case type.to_sym
|
197
197
|
when :Time
|
198
198
|
Time.parse(value)
|
@@ -227,7 +227,7 @@ module Shotstack
|
|
227
227
|
else # model
|
228
228
|
# models (e.g. Pet) or oneOf
|
229
229
|
klass = Shotstack.const_get(type)
|
230
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
230
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|