shotstack 0.0.11 → 0.1.4

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.
@@ -0,0 +1,228 @@
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: 4.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Shotstack
16
+ # Generate a thumbnail image for the video at a specific point from the timeline.
17
+ class Thumbnail
18
+ # The point on the timeline in seconds to capture a single frame to use as the thumbnail image.
19
+ attr_accessor :capture
20
+
21
+ # Scale the thumbnail size to a fraction of the viewport size - i.e. setting the scale to 0.5 will scale the thumbnail to half the size of the viewport.
22
+ attr_accessor :scale
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'capture' => :'capture',
28
+ :'scale' => :'scale'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'capture' => :'Float',
36
+ :'scale' => :'Float'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::Thumbnail` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::Thumbnail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'capture')
62
+ self.capture = attributes[:'capture']
63
+ end
64
+
65
+ if attributes.key?(:'scale')
66
+ self.scale = attributes[:'scale']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @capture.nil?
75
+ invalid_properties.push('invalid value for "capture", capture cannot be nil.')
76
+ end
77
+
78
+ if @scale.nil?
79
+ invalid_properties.push('invalid value for "scale", scale cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @capture.nil?
89
+ return false if @scale.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ capture == o.capture &&
99
+ scale == o.scale
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [capture, scale].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ Shotstack.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -1,26 +1,29 @@
1
1
  =begin
2
- #shotstack
2
+ #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
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
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.0.0
9
+ OpenAPI Generator version: 4.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module Shotstack
16
- # A timeline represents the contents of a video edit over time, in seconds. A timeline consists of layers called tracks. Tracks are composed of titles, images or video segments referred to as clips which are placed along the track at specific starting point and lasting for a specific amount of time.
16
+ # A timeline represents the contents of a video edit over time, in seconds. A timeline consists of layers called tracks. Tracks are composed of titles, images or video segments referred to as clips which are placed along the track at specific starting point and lasting for a specific amount of time.
17
17
  class Timeline
18
18
  attr_accessor :soundtrack
19
19
 
20
- # A hexidecimal value for the timeline background colour. Defaults to black (#000000).
20
+ # A hexadecimal value for the timeline background colour. Defaults to #000000 (black).
21
21
  attr_accessor :background
22
22
 
23
- # A timeline consists of an array of tracks, each track containing clips. Tracks are layered on top of each other in the same order they are added to the array with the top most track layered over the top of those below it. Ensure that a track containing titles is the top most track so that it is displayed above videos and images.
23
+ # An array of custom fonts to be downloaded for use by the HTML assets.
24
+ attr_accessor :fonts
25
+
26
+ # A timeline consists of an array of tracks, each track containing clips. Tracks are layered on top of each other in the same order they are added to the array with the top most track layered over the top of those below it. Ensure that a track containing titles is the top most track so that it is displayed above videos and images.
24
27
  attr_accessor :tracks
25
28
 
26
29
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -28,6 +31,7 @@ module Shotstack
28
31
  {
29
32
  :'soundtrack' => :'soundtrack',
30
33
  :'background' => :'background',
34
+ :'fonts' => :'fonts',
31
35
  :'tracks' => :'tracks'
32
36
  }
33
37
  end
@@ -37,10 +41,17 @@ module Shotstack
37
41
  {
38
42
  :'soundtrack' => :'Soundtrack',
39
43
  :'background' => :'String',
44
+ :'fonts' => :'Array<Font>',
40
45
  :'tracks' => :'Array<Track>'
41
46
  }
42
47
  end
43
48
 
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
44
55
  # Initializes the object
45
56
  # @param [Hash] attributes Model attributes in the form of hash
46
57
  def initialize(attributes = {})
@@ -62,6 +73,14 @@ module Shotstack
62
73
 
63
74
  if attributes.key?(:'background')
64
75
  self.background = attributes[:'background']
76
+ else
77
+ self.background = '#000000'
78
+ end
79
+
80
+ if attributes.key?(:'fonts')
81
+ if (value = attributes[:'fonts']).is_a?(Array)
82
+ self.fonts = value
83
+ end
65
84
  end
66
85
 
67
86
  if attributes.key?(:'tracks')
@@ -96,6 +115,7 @@ module Shotstack
96
115
  self.class == o.class &&
97
116
  soundtrack == o.soundtrack &&
98
117
  background == o.background &&
118
+ fonts == o.fonts &&
99
119
  tracks == o.tracks
100
120
  end
101
121
 
@@ -108,7 +128,7 @@ module Shotstack
108
128
  # Calculates hash code according to all attributes.
109
129
  # @return [Integer] Hash code
110
130
  def hash
111
- [soundtrack, background, tracks].hash
131
+ [soundtrack, background, fonts, tracks].hash
112
132
  end
113
133
 
114
134
  # Builds the object from hash
@@ -197,7 +217,11 @@ module Shotstack
197
217
  hash = {}
198
218
  self.class.attribute_map.each_pair do |attr, param|
199
219
  value = self.send(attr)
200
- next if value.nil?
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
201
225
  hash[param] = _to_hash(value)
202
226
  end
203
227
  hash
@@ -1,12 +1,12 @@
1
1
  =begin
2
- #shotstack
2
+ #Shotstack
3
3
 
4
- #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
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
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.0.0
9
+ OpenAPI Generator version: 4.2.1
10
10
 
11
11
  =end
12
12
 
@@ -14,20 +14,31 @@ require 'date'
14
14
  require_relative 'asset'
15
15
 
16
16
  module Shotstack
17
- # The TitleAsset clip type lets you create video titles from a text string and apply styling.
17
+ # The TitleAsset clip type lets you create video titles from a text string and apply styling and positioning.
18
18
  class TitleAsset < Asset
19
- # The type of asset - set to <b>title</b> for titles.
19
+ # The type of asset - set to `title` for titles.
20
20
  attr_accessor :type
21
21
 
22
22
  # The title text string - i.e. \"My Title\".
23
23
  attr_accessor :text
24
24
 
25
- # Uses a preset to apply font properties and stylng to the title.
25
+ # Uses a preset to apply font properties and styling to the title. <ul> <li>`minimal`</li> <li>`blockbuster`</li> <li>`vogue`</li> <li>`sketchy`</li> <li>`skinny`</li> <li>`chunk`</li> <li>`chunkLight`</li> <li>`marker`</li> <li>`future`</li> <li>`subtitle`</li> </ul>
26
26
  attr_accessor :style
27
27
 
28
- # Place the title in one of nine predefined positions of the viewport.
28
+ # Set the text color using hexadecimal color notation. Transparency is supported by setting the first two characters of the hex string (opposite to HTML), i.e. #80ffffff will be white with 50% transparency.
29
+ attr_accessor :color
30
+
31
+ # Set the relative size of the text using predefined sizes from xx-small to xx-large. <ul> <li>`xx-small`</li> <li>`x-small`</li> <li>`small`</li> <li>`medium`</li> <li>`large`</li> <li>`x-large`</li> <li>`xx-large`</li> </ul>
32
+ attr_accessor :size
33
+
34
+ # Apply a background color behind the text. Set the text color using hexadecimal color notation. Transparency is supported by setting the first two characters of the hex string (opposite to HTML), i.e. #80ffffff will be white with 50% transparency. Omit to use transparent background.
35
+ attr_accessor :background
36
+
37
+ # Place the title in one of nine predefined positions of the viewport. <ul> <li>`top` - top (center)</li> <li>`topRight` - top right</li> <li>`right` - right (center)</li> <li>`bottomRight` - bottom right</li> <li>`bottom` - bottom (center)</li> <li>`bottomLeft` - bottom left</li> <li>`left` - left (center)</li> <li>`topLeft` - top left</li> <li>`center` - center</li> </ul>
29
38
  attr_accessor :position
30
39
 
40
+ attr_accessor :offset
41
+
31
42
  class EnumAttributeValidator
32
43
  attr_reader :datatype
33
44
  attr_reader :allowable_values
@@ -56,7 +67,11 @@ module Shotstack
56
67
  :'type' => :'type',
57
68
  :'text' => :'text',
58
69
  :'style' => :'style',
59
- :'position' => :'position'
70
+ :'color' => :'color',
71
+ :'size' => :'size',
72
+ :'background' => :'background',
73
+ :'position' => :'position',
74
+ :'offset' => :'offset'
60
75
  }
61
76
  end
62
77
 
@@ -66,10 +81,20 @@ module Shotstack
66
81
  :'type' => :'String',
67
82
  :'text' => :'String',
68
83
  :'style' => :'String',
69
- :'position' => :'String'
84
+ :'color' => :'String',
85
+ :'size' => :'String',
86
+ :'background' => :'String',
87
+ :'position' => :'String',
88
+ :'offset' => :'Offset'
70
89
  }
71
90
  end
72
91
 
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
73
98
  # Initializes the object
74
99
  # @param [Hash] attributes Model attributes in the form of hash
75
100
  def initialize(attributes = {})
@@ -99,11 +124,31 @@ module Shotstack
99
124
  self.style = attributes[:'style']
100
125
  end
101
126
 
127
+ if attributes.key?(:'color')
128
+ self.color = attributes[:'color']
129
+ else
130
+ self.color = '#ffffff'
131
+ end
132
+
133
+ if attributes.key?(:'size')
134
+ self.size = attributes[:'size']
135
+ else
136
+ self.size = 'medium'
137
+ end
138
+
139
+ if attributes.key?(:'background')
140
+ self.background = attributes[:'background']
141
+ end
142
+
102
143
  if attributes.key?(:'position')
103
144
  self.position = attributes[:'position']
104
145
  else
105
146
  self.position = 'center'
106
147
  end
148
+
149
+ if attributes.key?(:'offset')
150
+ self.offset = attributes[:'offset']
151
+ end
107
152
  end
108
153
 
109
154
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -126,8 +171,10 @@ module Shotstack
126
171
  def valid?
127
172
  return false if @type.nil?
128
173
  return false if @text.nil?
129
- style_validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny"])
174
+ style_validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny", "chunk", "chunkLight", "marker", "future", "subtitle"])
130
175
  return false unless style_validator.valid?(@style)
176
+ size_validator = EnumAttributeValidator.new('String', ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"])
177
+ return false unless size_validator.valid?(@size)
131
178
  position_validator = EnumAttributeValidator.new('String', ["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"])
132
179
  return false unless position_validator.valid?(@position)
133
180
  true
@@ -136,13 +183,23 @@ module Shotstack
136
183
  # Custom attribute writer method checking allowed values (enum).
137
184
  # @param [Object] style Object to be assigned
138
185
  def style=(style)
139
- validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny"])
186
+ validator = EnumAttributeValidator.new('String', ["minimal", "blockbuster", "vogue", "sketchy", "skinny", "chunk", "chunkLight", "marker", "future", "subtitle"])
140
187
  unless validator.valid?(style)
141
188
  fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}."
142
189
  end
143
190
  @style = style
144
191
  end
145
192
 
193
+ # Custom attribute writer method checking allowed values (enum).
194
+ # @param [Object] size Object to be assigned
195
+ def size=(size)
196
+ validator = EnumAttributeValidator.new('String', ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"])
197
+ unless validator.valid?(size)
198
+ fail ArgumentError, "invalid value for \"size\", must be one of #{validator.allowable_values}."
199
+ end
200
+ @size = size
201
+ end
202
+
146
203
  # Custom attribute writer method checking allowed values (enum).
147
204
  # @param [Object] position Object to be assigned
148
205
  def position=(position)
@@ -161,7 +218,11 @@ module Shotstack
161
218
  type == o.type &&
162
219
  text == o.text &&
163
220
  style == o.style &&
164
- position == o.position
221
+ color == o.color &&
222
+ size == o.size &&
223
+ background == o.background &&
224
+ position == o.position &&
225
+ offset == o.offset
165
226
  end
166
227
 
167
228
  # @see the `==` method
@@ -173,7 +234,7 @@ module Shotstack
173
234
  # Calculates hash code according to all attributes.
174
235
  # @return [Integer] Hash code
175
236
  def hash
176
- [type, text, style, position].hash
237
+ [type, text, style, color, size, background, position, offset].hash
177
238
  end
178
239
 
179
240
  # Builds the object from hash
@@ -262,7 +323,11 @@ module Shotstack
262
323
  hash = {}
263
324
  self.class.attribute_map.each_pair do |attr, param|
264
325
  value = self.send(attr)
265
- next if value.nil?
326
+ if value.nil?
327
+ is_nullable = self.class.openapi_nullable.include?(attr)
328
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
329
+ end
330
+
266
331
  hash[param] = _to_hash(value)
267
332
  end
268
333
  hash