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,137 +0,0 @@
1
- require "uri"
2
-
3
- module Shotstack
4
- class RenderApi
5
- attr_accessor :api_client
6
-
7
- def initialize(api_client = ApiClient.default)
8
- @api_client = api_client
9
- end
10
-
11
- #
12
- # Render the contents of a timeline as a video file.
13
- # @param edit Edit
14
- # @param [Hash] opts the optional parameters
15
- # @return [QueuedResponse]
16
- def post_render(edit, opts = {})
17
- data, status_code, headers = post_render_with_http_info(edit, opts)
18
- return data
19
- end
20
-
21
- #
22
- # Render the contents of a timeline as a video file.
23
- # @param edit Edit
24
- # @param [Hash] opts the optional parameters
25
- # @return [Array<(QueuedResponse, Fixnum, Hash)>] QueuedResponse data, response status code and response headers
26
- def post_render_with_http_info(edit, opts = {})
27
- if @api_client.config.debugging
28
- @api_client.config.logger.debug "Calling API: RenderApi#post_render ..."
29
- end
30
-
31
- # verify the required parameter 'edit' is set
32
- fail "Missing the required parameter 'edit' when calling post_render" if edit.nil?
33
-
34
- # resource path
35
- path = "/render".sub('{format}','json')
36
-
37
- # query parameters
38
- query_params = {}
39
-
40
- # header parameters
41
- header_params = {}
42
-
43
- # HTTP header 'Accept' (if needed)
44
- _header_accept = ['application/json']
45
- _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
46
-
47
- # HTTP header 'Content-Type'
48
- _header_content_type = []
49
- header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
50
-
51
- # form parameters
52
- form_params = {}
53
-
54
- # http body (model)
55
- post_body = @api_client.object_to_http_body(edit)
56
-
57
-
58
- auth_names = ['DeveloperKey']
59
- data, status_code, headers = @api_client.call_api(:POST, path,
60
- :header_params => header_params,
61
- :query_params => query_params,
62
- :form_params => form_params,
63
- :body => post_body,
64
- :auth_names => auth_names,
65
- :return_type => 'QueuedResponse')
66
- if @api_client.config.debugging
67
- @api_client.config.logger.debug "API called: RenderApi#post_render\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
68
- end
69
- return data, status_code, headers
70
- end
71
-
72
- #
73
- # Get the rendering status and details of a timeline by ID.
74
- # @param id The id of the timeline render task in UUID format
75
- # @param [Hash] opts the optional parameters
76
- # @return [RenderResponse]
77
- def get_render(id, opts = {})
78
- data, status_code, headers = get_render_with_http_info(id, opts)
79
- return data
80
- end
81
-
82
- #
83
- # Get the rendering status and details of a timeline by ID.
84
- # @param id The id of the timeline render task in UUID format
85
- # @param [Hash] opts the optional parameters
86
- # @return [Array<(RenderResponse, Fixnum, Hash)>] RenderResponse data, response status code and response headers
87
- def get_render_with_http_info(id, opts = {})
88
- if @api_client.config.debugging
89
- @api_client.config.logger.debug "Calling API: RenderApi#get_render ..."
90
- end
91
-
92
- # verify the required parameter 'id' is set
93
- fail "Missing the required parameter 'id' when calling get_render" if id.nil?
94
-
95
- # resource path
96
- path = "/render/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
97
-
98
- # query parameters
99
- query_params = {}
100
-
101
- # header parameters
102
- header_params = {}
103
-
104
- # HTTP header 'Accept' (if needed)
105
- _header_accept = ['application/json']
106
- _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
107
-
108
- # HTTP header 'Content-Type'
109
- _header_content_type = []
110
- header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
111
-
112
- # form parameters
113
- form_params = {}
114
-
115
- # http body (model)
116
- post_body = nil
117
-
118
-
119
- auth_names = ['DeveloperKey']
120
- data, status_code, headers = @api_client.call_api(:GET, path,
121
- :header_params => header_params,
122
- :query_params => query_params,
123
- :form_params => form_params,
124
- :body => post_body,
125
- :auth_names => auth_names,
126
- :return_type => 'RenderResponse')
127
- if @api_client.config.debugging
128
- @api_client.config.logger.debug "API called: RenderApi#get_render\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
129
- end
130
- return data, status_code, headers
131
- end
132
- end
133
- end
134
-
135
-
136
-
137
-
@@ -1,147 +0,0 @@
1
- require 'date'
2
-
3
- module Shotstack
4
- # Model for Clips
5
- class Clips
6
- attr_accessor :name
7
-
8
- # Attribute mapping from ruby-style variable name to JSON key.
9
- def self.attribute_map
10
- {
11
-
12
- :'name' => :'name'
13
-
14
- }
15
- end
16
-
17
- # Attribute type mapping.
18
- def self.swagger_types
19
- {
20
- :'name' => :'String'
21
-
22
- }
23
- end
24
-
25
- def initialize(attributes = {})
26
- return unless attributes.is_a?(Hash)
27
-
28
- # convert string to symbol for hash key
29
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
30
-
31
-
32
- if attributes[:'name']
33
- self.name = attributes[:'name']
34
- end
35
-
36
- end
37
-
38
- # Check equality by comparing each attribute.
39
- def ==(o)
40
- return true if self.equal?(o)
41
- self.class == o.class &&
42
- name == o.name
43
- end
44
-
45
- # @see the `==` method
46
- def eql?(o)
47
- self == o
48
- end
49
-
50
- # Calculate hash code according to all attributes.
51
- def hash
52
- [name].hash
53
- end
54
-
55
- # build the object from hash
56
- def build_from_hash(attributes)
57
- return nil unless attributes.is_a?(Hash)
58
- self.class.swagger_types.each_pair do |key, type|
59
- if type =~ /^Array<(.*)>/i
60
- if attributes[self.class.attribute_map[key]].is_a?(Array)
61
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
62
- else
63
- #TODO show warning in debug mode
64
- end
65
- elsif !attributes[self.class.attribute_map[key]].nil?
66
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
67
- else
68
- # data not found in attributes(hash), not an issue as the data can be optional
69
- end
70
- end
71
-
72
- self
73
- end
74
-
75
- def _deserialize(type, value)
76
- case type.to_sym
77
- when :DateTime
78
- DateTime.parse(value)
79
- when :Date
80
- Date.parse(value)
81
- when :String
82
- value.to_s
83
- when :Integer
84
- value.to_i
85
- when :Float
86
- value.to_f
87
- when :BOOLEAN
88
- if value =~ /^(true|t|yes|y|1)$/i
89
- true
90
- else
91
- false
92
- end
93
- when /\AArray<(?<inner_type>.+)>\z/
94
- inner_type = Regexp.last_match[:inner_type]
95
- value.map { |v| _deserialize(inner_type, v) }
96
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
97
- k_type = Regexp.last_match[:k_type]
98
- v_type = Regexp.last_match[:v_type]
99
- {}.tap do |hash|
100
- value.each do |k, v|
101
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
102
- end
103
- end
104
- else # model
105
- _model = Shotstack.const_get(type).new
106
- _model.build_from_hash(value)
107
- end
108
- end
109
-
110
- def to_s
111
- to_hash.to_s
112
- end
113
-
114
- # to_body is an alias to to_body (backward compatibility))
115
- def to_body
116
- to_hash
117
- end
118
-
119
- # return the object in the form of hash
120
- def to_hash
121
- hash = {}
122
- self.class.attribute_map.each_pair do |attr, param|
123
- value = self.send(attr)
124
- next if value.nil?
125
- hash[param] = _to_hash(value)
126
- end
127
- hash
128
- end
129
-
130
- # Method to output non-array value in the form of hash
131
- # For object, use to_hash. Otherwise, just return the value
132
- def _to_hash(value)
133
- if value.is_a?(Array)
134
- value.compact.map{ |v| _to_hash(v) }
135
- elsif value.is_a?(Hash)
136
- {}.tap do |hash|
137
- value.each { |k, v| hash[k] = _to_hash(v) }
138
- end
139
- elsif value.respond_to? :to_hash
140
- value.to_hash
141
- else
142
- value
143
- end
144
- end
145
-
146
- end
147
- end
@@ -1,216 +0,0 @@
1
- require 'date'
2
-
3
- module Shotstack
4
- # Model for ImageClip
5
- class ImageClip
6
- attr_accessor :_in
7
-
8
- attr_accessor :options
9
-
10
- attr_accessor :out
11
-
12
- attr_accessor :src
13
-
14
- attr_accessor :start
15
-
16
- attr_accessor :transition
17
-
18
- attr_accessor :type
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
-
24
- :'_in' => :'in',
25
-
26
- :'options' => :'options',
27
-
28
- :'out' => :'out',
29
-
30
- :'src' => :'src',
31
-
32
- :'start' => :'start',
33
-
34
- :'transition' => :'transition',
35
-
36
- :'type' => :'type'
37
-
38
- }
39
- end
40
-
41
- # Attribute type mapping.
42
- def self.swagger_types
43
- {
44
- :'_in' => :'Float',
45
- :'options' => :'ImageClipOptions',
46
- :'out' => :'Float',
47
- :'src' => :'String',
48
- :'start' => :'Float',
49
- :'transition' => :'Transition',
50
- :'type' => :'String'
51
-
52
- }
53
- end
54
-
55
- def initialize(attributes = {})
56
- return unless attributes.is_a?(Hash)
57
-
58
- # convert string to symbol for hash key
59
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
60
-
61
-
62
- if attributes[:'in']
63
- self._in = attributes[:'in']
64
- end
65
-
66
- if attributes[:'options']
67
- self.options = attributes[:'options']
68
- end
69
-
70
- if attributes[:'out']
71
- self.out = attributes[:'out']
72
- end
73
-
74
- if attributes[:'src']
75
- self.src = attributes[:'src']
76
- end
77
-
78
- if attributes[:'start']
79
- self.start = attributes[:'start']
80
- end
81
-
82
- if attributes[:'transition']
83
- self.transition = attributes[:'transition']
84
- end
85
-
86
- if attributes[:'type']
87
- self.type = attributes[:'type']
88
- end
89
-
90
- end
91
-
92
- # Custom attribute writer method checking allowed values (enum).
93
- def type=(type)
94
- allowed_values = ["image"]
95
- if type && !allowed_values.include?(type)
96
- fail "invalid value for 'type', must be one of #{allowed_values}"
97
- end
98
- @type = type
99
- end
100
-
101
- # Check equality by comparing each attribute.
102
- def ==(o)
103
- return true if self.equal?(o)
104
- self.class == o.class &&
105
- _in == o._in &&
106
- options == o.options &&
107
- out == o.out &&
108
- src == o.src &&
109
- start == o.start &&
110
- transition == o.transition &&
111
- type == o.type
112
- end
113
-
114
- # @see the `==` method
115
- def eql?(o)
116
- self == o
117
- end
118
-
119
- # Calculate hash code according to all attributes.
120
- def hash
121
- [_in, options, out, src, start, transition, type].hash
122
- end
123
-
124
- # build the object from hash
125
- def build_from_hash(attributes)
126
- return nil unless attributes.is_a?(Hash)
127
- self.class.swagger_types.each_pair do |key, type|
128
- if type =~ /^Array<(.*)>/i
129
- if attributes[self.class.attribute_map[key]].is_a?(Array)
130
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
131
- else
132
- #TODO show warning in debug mode
133
- end
134
- elsif !attributes[self.class.attribute_map[key]].nil?
135
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
- else
137
- # data not found in attributes(hash), not an issue as the data can be optional
138
- end
139
- end
140
-
141
- self
142
- end
143
-
144
- def _deserialize(type, value)
145
- case type.to_sym
146
- when :DateTime
147
- DateTime.parse(value)
148
- when :Date
149
- Date.parse(value)
150
- when :String
151
- value.to_s
152
- when :Integer
153
- value.to_i
154
- when :Float
155
- value.to_f
156
- when :BOOLEAN
157
- if value =~ /^(true|t|yes|y|1)$/i
158
- true
159
- else
160
- false
161
- end
162
- when /\AArray<(?<inner_type>.+)>\z/
163
- inner_type = Regexp.last_match[:inner_type]
164
- value.map { |v| _deserialize(inner_type, v) }
165
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
166
- k_type = Regexp.last_match[:k_type]
167
- v_type = Regexp.last_match[:v_type]
168
- {}.tap do |hash|
169
- value.each do |k, v|
170
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
- end
172
- end
173
- else # model
174
- _model = Shotstack.const_get(type).new
175
- _model.build_from_hash(value)
176
- end
177
- end
178
-
179
- def to_s
180
- to_hash.to_s
181
- end
182
-
183
- # to_body is an alias to to_body (backward compatibility))
184
- def to_body
185
- to_hash
186
- end
187
-
188
- # return the object in the form of hash
189
- def to_hash
190
- hash = {}
191
- self.class.attribute_map.each_pair do |attr, param|
192
- value = self.send(attr)
193
- next if value.nil?
194
- hash[param] = _to_hash(value)
195
- end
196
- hash
197
- end
198
-
199
- # Method to output non-array value in the form of hash
200
- # For object, use to_hash. Otherwise, just return the value
201
- def _to_hash(value)
202
- if value.is_a?(Array)
203
- value.compact.map{ |v| _to_hash(v) }
204
- elsif value.is_a?(Hash)
205
- {}.tap do |hash|
206
- value.each { |k, v| hash[k] = _to_hash(v) }
207
- end
208
- elsif value.respond_to? :to_hash
209
- value.to_hash
210
- else
211
- value
212
- end
213
- end
214
-
215
- end
216
- end