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
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Shotstack
3
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.io/docs/guide/) 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>
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
- OpenAPI Generator version: 5.4.0
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 rendered videos to the [Mux](https://www.mux.com/) video hosting and streaming service. Add the `mux` destination provider to send the output video to Mux. Mux credentials are required and added via the [dashboard](https://dashboard.shotstack.io/integrations/mux), not in the request.
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 rendered assets to - set to `mux` for Mux.
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
- self.class.openapi_types.each_pair do |key, type|
129
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
- self.send("#{key}=", nil)
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[self.class.attribute_map[key]].is_a?(Array)
135
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
138
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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
- #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.io/docs/guide/) 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>
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
- OpenAPI Generator version: 5.4.0
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 playback policy option.
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
- self.class.openapi_types.each_pair do |key, type|
137
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
138
- self.send("#{key}=", nil)
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[self.class.attribute_map[key]].is_a?(Array)
143
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
146
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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
- #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.io/docs/guide/) 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>
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
- OpenAPI Generator version: 5.4.0
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 -1 to 1. 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.
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 -1 to 1. 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.
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 > 1
85
- invalid_properties.push('invalid value for "x", must be smaller than or equal to 1.')
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 < -1
89
- invalid_properties.push('invalid value for "x", must be greater than or equal to -1.')
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 > 1
93
- invalid_properties.push('invalid value for "y", must be smaller than or equal to 1.')
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 < -1
97
- invalid_properties.push('invalid value for "y", must be greater than or equal to -1.')
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
- return false if !@x.nil? && @x > 1
107
- return false if !@x.nil? && @x < -1
108
- return false if !@y.nil? && @y > 1
109
- return false if !@y.nil? && @y < -1
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 !x.nil? && x > 1
117
- fail ArgumentError, 'invalid value for "x", must be smaller than or equal to 1.'
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 !x.nil? && x < -1
121
- fail ArgumentError, 'invalid value for "x", must be greater than or equal to -1.'
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 !y.nil? && y > 1
131
- fail ArgumentError, 'invalid value for "y", must be smaller than or equal to 1.'
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 !y.nil? && y < -1
135
- fail ArgumentError, 'invalid value for "y", must be greater than or equal to -1.'
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
- self.class.openapi_types.each_pair do |key, type|
175
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
- self.send("#{key}=", nil)
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[self.class.attribute_map[key]].is_a?(Array)
181
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
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[self.class.attribute_map[key]].nil?
184
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
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