shotstack 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +17 -0
  3. data/lib/shotstack.rb +24 -15
  4. data/lib/shotstack/api/default_api.rb +131 -0
  5. data/lib/shotstack/api_client.rb +120 -51
  6. data/lib/shotstack/api_error.rb +38 -5
  7. data/lib/shotstack/configuration.rb +90 -3
  8. data/lib/shotstack/models/asset.rb +17 -0
  9. data/lib/shotstack/models/clip.rb +308 -0
  10. data/lib/shotstack/models/edit.rb +104 -45
  11. data/lib/shotstack/models/image_asset.rb +221 -0
  12. data/lib/shotstack/models/output.rb +128 -41
  13. data/lib/shotstack/models/queued_response.rb +110 -48
  14. data/lib/shotstack/models/queued_response_data.rb +105 -45
  15. data/lib/shotstack/models/render_response.rb +110 -48
  16. data/lib/shotstack/models/render_response_data.rb +172 -68
  17. data/lib/shotstack/models/soundtrack.rb +106 -45
  18. data/lib/shotstack/models/timeline.rb +101 -46
  19. data/lib/shotstack/models/title_asset.rb +265 -0
  20. data/lib/shotstack/models/track.rb +89 -33
  21. data/lib/shotstack/models/transition.rb +121 -42
  22. data/lib/shotstack/models/video_asset.rb +241 -0
  23. data/lib/shotstack/version.rb +13 -1
  24. data/shotstack.gemspec +26 -13
  25. metadata +38 -40
  26. data/lib/shotstack/api/render_api.rb +0 -137
  27. data/lib/shotstack/models/clips.rb +0 -147
  28. data/lib/shotstack/models/image_clip.rb +0 -216
  29. data/lib/shotstack/models/image_clip_options.rb +0 -175
  30. data/lib/shotstack/models/title_clip.rb +0 -216
  31. data/lib/shotstack/models/title_clip_options.rb +0 -194
  32. data/lib/shotstack/models/video_clip.rb +0 -216
  33. data/lib/shotstack/models/video_clip_options.rb +0 -185
  34. data/tags +0 -306
@@ -1,87 +1,140 @@
1
+ =begin
2
+ #shotstack
3
+
4
+ #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module Shotstack
4
- # Model for QueuedResponseData
5
16
  class QueuedResponseData
6
- attr_accessor :id
7
-
17
+ # Success response message
8
18
  attr_accessor :message
9
19
 
20
+ # The id of the render task in UUID format
21
+ attr_accessor :id
22
+
10
23
  # Attribute mapping from ruby-style variable name to JSON key.
11
24
  def self.attribute_map
12
25
  {
13
-
14
- :'id' => :'id',
15
-
16
- :'message' => :'message'
17
-
26
+ :'message' => :'message',
27
+ :'id' => :'id'
18
28
  }
19
29
  end
20
30
 
21
31
  # Attribute type mapping.
22
- def self.swagger_types
32
+ def self.openapi_types
23
33
  {
24
- :'id' => :'String',
25
- :'message' => :'String'
26
-
34
+ :'message' => :'String',
35
+ :'id' => :'String'
27
36
  }
28
37
  end
29
38
 
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
30
41
  def initialize(attributes = {})
31
- return unless attributes.is_a?(Hash)
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::QueuedResponseData` initialize method"
44
+ end
32
45
 
33
- # convert string to symbol for hash key
34
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::QueuedResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'message')
55
+ self.message = attributes[:'message']
56
+ end
35
57
 
36
-
37
- if attributes[:'id']
58
+ if attributes.key?(:'id')
38
59
  self.id = attributes[:'id']
39
60
  end
40
-
41
- if attributes[:'message']
42
- self.message = attributes[:'message']
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ if @message.nil?
68
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
43
69
  end
44
-
70
+
71
+ if @id.nil?
72
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
73
+ end
74
+
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @message.nil?
82
+ return false if @id.nil?
83
+ true
45
84
  end
46
85
 
47
- # Check equality by comparing each attribute.
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
48
88
  def ==(o)
49
89
  return true if self.equal?(o)
50
90
  self.class == o.class &&
51
- id == o.id &&
52
- message == o.message
91
+ message == o.message &&
92
+ id == o.id
53
93
  end
54
94
 
55
95
  # @see the `==` method
96
+ # @param [Object] Object to be compared
56
97
  def eql?(o)
57
98
  self == o
58
99
  end
59
100
 
60
- # Calculate hash code according to all attributes.
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
61
103
  def hash
62
- [id, message].hash
104
+ [message, id].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
63
112
  end
64
113
 
65
- # build the object from hash
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
66
117
  def build_from_hash(attributes)
67
118
  return nil unless attributes.is_a?(Hash)
68
- self.class.swagger_types.each_pair do |key, type|
69
- if type =~ /^Array<(.*)>/i
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
70
123
  if attributes[self.class.attribute_map[key]].is_a?(Array)
71
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
72
- else
73
- #TODO show warning in debug mode
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
74
125
  end
75
126
  elsif !attributes[self.class.attribute_map[key]].nil?
76
127
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
77
- else
78
- # data not found in attributes(hash), not an issue as the data can be optional
79
- end
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
80
129
  end
81
130
 
82
131
  self
83
132
  end
84
133
 
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
85
138
  def _deserialize(type, value)
86
139
  case type.to_sym
87
140
  when :DateTime
@@ -94,16 +147,19 @@ module Shotstack
94
147
  value.to_i
95
148
  when :Float
96
149
  value.to_f
97
- when :BOOLEAN
98
- if value =~ /^(true|t|yes|y|1)$/i
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
99
152
  true
100
153
  else
101
154
  false
102
155
  end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
103
159
  when /\AArray<(?<inner_type>.+)>\z/
104
160
  inner_type = Regexp.last_match[:inner_type]
105
161
  value.map { |v| _deserialize(inner_type, v) }
106
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
107
163
  k_type = Regexp.last_match[:k_type]
108
164
  v_type = Regexp.last_match[:v_type]
109
165
  {}.tap do |hash|
@@ -112,21 +168,24 @@ module Shotstack
112
168
  end
113
169
  end
114
170
  else # model
115
- _model = Shotstack.const_get(type).new
116
- _model.build_from_hash(value)
171
+ Shotstack.const_get(type).build_from_hash(value)
117
172
  end
118
173
  end
119
174
 
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
120
177
  def to_s
121
178
  to_hash.to_s
122
179
  end
123
180
 
124
- # to_body is an alias to to_body (backward compatibility))
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
125
183
  def to_body
126
184
  to_hash
127
185
  end
128
186
 
129
- # return the object in the form of hash
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
130
189
  def to_hash
131
190
  hash = {}
132
191
  self.class.attribute_map.each_pair do |attr, param|
@@ -137,11 +196,13 @@ module Shotstack
137
196
  hash
138
197
  end
139
198
 
140
- # Method to output non-array value in the form of hash
199
+ # Outputs non-array value in the form of hash
141
200
  # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
142
203
  def _to_hash(value)
143
204
  if value.is_a?(Array)
144
- value.compact.map{ |v| _to_hash(v) }
205
+ value.compact.map { |v| _to_hash(v) }
145
206
  elsif value.is_a?(Hash)
146
207
  {}.tap do |hash|
147
208
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -152,6 +213,5 @@ module Shotstack
152
213
  value
153
214
  end
154
215
  end
155
-
156
216
  end
157
217
  end
@@ -1,97 +1,152 @@
1
+ =begin
2
+ #shotstack
3
+
4
+ #The Shotstack API is a video editing service that allows for the programatic creation of videos using JSON.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module Shotstack
4
- # Model for RenderResponse
5
16
  class RenderResponse
17
+ attr_accessor :success
18
+
6
19
  attr_accessor :message
7
20
 
8
21
  attr_accessor :response
9
22
 
10
- attr_accessor :success
11
-
12
23
  # Attribute mapping from ruby-style variable name to JSON key.
13
24
  def self.attribute_map
14
25
  {
15
-
26
+ :'success' => :'success',
16
27
  :'message' => :'message',
17
-
18
- :'response' => :'response',
19
-
20
- :'success' => :'success'
21
-
28
+ :'response' => :'response'
22
29
  }
23
30
  end
24
31
 
25
32
  # Attribute type mapping.
26
- def self.swagger_types
33
+ def self.openapi_types
27
34
  {
35
+ :'success' => :'Boolean',
28
36
  :'message' => :'String',
29
- :'response' => :'RenderResponseData',
30
- :'success' => :'BOOLEAN'
31
-
37
+ :'response' => :'RenderResponseData'
32
38
  }
33
39
  end
34
40
 
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
35
43
  def initialize(attributes = {})
36
- return unless attributes.is_a?(Hash)
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Shotstack::RenderResponse` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Shotstack::RenderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
37
55
 
38
- # convert string to symbol for hash key
39
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
56
+ if attributes.key?(:'success')
57
+ self.success = attributes[:'success']
58
+ end
40
59
 
41
-
42
- if attributes[:'message']
60
+ if attributes.key?(:'message')
43
61
  self.message = attributes[:'message']
44
62
  end
45
-
46
- if attributes[:'response']
63
+
64
+ if attributes.key?(:'response')
47
65
  self.response = attributes[:'response']
48
66
  end
49
-
50
- if attributes[:'success']
51
- self.success = attributes[:'success']
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @success.nil?
74
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
75
+ end
76
+
77
+ if @message.nil?
78
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
79
+ end
80
+
81
+ if @response.nil?
82
+ invalid_properties.push('invalid value for "response", response cannot be nil.')
52
83
  end
53
-
84
+
85
+ invalid_properties
54
86
  end
55
87
 
56
- # Check equality by comparing each attribute.
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if @success.nil?
92
+ return false if @message.nil?
93
+ return false if @response.nil?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
57
99
  def ==(o)
58
100
  return true if self.equal?(o)
59
101
  self.class == o.class &&
102
+ success == o.success &&
60
103
  message == o.message &&
61
- response == o.response &&
62
- success == o.success
104
+ response == o.response
63
105
  end
64
106
 
65
107
  # @see the `==` method
108
+ # @param [Object] Object to be compared
66
109
  def eql?(o)
67
110
  self == o
68
111
  end
69
112
 
70
- # Calculate hash code according to all attributes.
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
71
115
  def hash
72
- [message, response, success].hash
116
+ [success, message, response].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
73
124
  end
74
125
 
75
- # build the object from hash
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
76
129
  def build_from_hash(attributes)
77
130
  return nil unless attributes.is_a?(Hash)
78
- self.class.swagger_types.each_pair do |key, type|
79
- if type =~ /^Array<(.*)>/i
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
80
135
  if attributes[self.class.attribute_map[key]].is_a?(Array)
81
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
82
- else
83
- #TODO show warning in debug mode
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
84
137
  end
85
138
  elsif !attributes[self.class.attribute_map[key]].nil?
86
139
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
- else
88
- # data not found in attributes(hash), not an issue as the data can be optional
89
- end
140
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
90
141
  end
91
142
 
92
143
  self
93
144
  end
94
145
 
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
95
150
  def _deserialize(type, value)
96
151
  case type.to_sym
97
152
  when :DateTime
@@ -104,16 +159,19 @@ module Shotstack
104
159
  value.to_i
105
160
  when :Float
106
161
  value.to_f
107
- when :BOOLEAN
108
- if value =~ /^(true|t|yes|y|1)$/i
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
109
164
  true
110
165
  else
111
166
  false
112
167
  end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
113
171
  when /\AArray<(?<inner_type>.+)>\z/
114
172
  inner_type = Regexp.last_match[:inner_type]
115
173
  value.map { |v| _deserialize(inner_type, v) }
116
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
117
175
  k_type = Regexp.last_match[:k_type]
118
176
  v_type = Regexp.last_match[:v_type]
119
177
  {}.tap do |hash|
@@ -122,21 +180,24 @@ module Shotstack
122
180
  end
123
181
  end
124
182
  else # model
125
- _model = Shotstack.const_get(type).new
126
- _model.build_from_hash(value)
183
+ Shotstack.const_get(type).build_from_hash(value)
127
184
  end
128
185
  end
129
186
 
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
130
189
  def to_s
131
190
  to_hash.to_s
132
191
  end
133
192
 
134
- # to_body is an alias to to_body (backward compatibility))
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
135
195
  def to_body
136
196
  to_hash
137
197
  end
138
198
 
139
- # return the object in the form of hash
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
140
201
  def to_hash
141
202
  hash = {}
142
203
  self.class.attribute_map.each_pair do |attr, param|
@@ -147,11 +208,13 @@ module Shotstack
147
208
  hash
148
209
  end
149
210
 
150
- # Method to output non-array value in the form of hash
211
+ # Outputs non-array value in the form of hash
151
212
  # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
152
215
  def _to_hash(value)
153
216
  if value.is_a?(Array)
154
- value.compact.map{ |v| _to_hash(v) }
217
+ value.compact.map { |v| _to_hash(v) }
155
218
  elsif value.is_a?(Hash)
156
219
  {}.tap do |hash|
157
220
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -162,6 +225,5 @@ module Shotstack
162
225
  value
163
226
  end
164
227
  end
165
-
166
228
  end
167
229
  end