shotstack 0.0.9

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,216 @@
1
+ require 'date'
2
+
3
+ module Shotstack
4
+ # Model for TitleClip
5
+ class TitleClip
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' => :'TitleClipOptions',
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 = ["title"]
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
@@ -0,0 +1,194 @@
1
+ require 'date'
2
+
3
+ module Shotstack
4
+ # Model for TitleClipOptions
5
+ class TitleClipOptions
6
+ attr_accessor :effect
7
+
8
+ attr_accessor :filter
9
+
10
+ attr_accessor :style
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+
16
+ :'effect' => :'effect',
17
+
18
+ :'filter' => :'filter',
19
+
20
+ :'style' => :'style'
21
+
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ :'effect' => :'String',
29
+ :'filter' => :'String',
30
+ :'style' => :'String'
31
+
32
+ }
33
+ end
34
+
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
40
+
41
+
42
+ if attributes[:'effect']
43
+ self.effect = attributes[:'effect']
44
+ end
45
+
46
+ if attributes[:'filter']
47
+ self.filter = attributes[:'filter']
48
+ end
49
+
50
+ if attributes[:'style']
51
+ self.style = attributes[:'style']
52
+ end
53
+
54
+ end
55
+
56
+ # Custom attribute writer method checking allowed values (enum).
57
+ def effect=(effect)
58
+ allowed_values = ["zoomIn", "zoomOut", "slideLeft", "slideRight", "slideUp", "slideDown"]
59
+ if effect && !allowed_values.include?(effect)
60
+ fail "invalid value for 'effect', must be one of #{allowed_values}"
61
+ end
62
+ @effect = effect
63
+ end
64
+
65
+ # Custom attribute writer method checking allowed values (enum).
66
+ def filter=(filter)
67
+ allowed_values = ["boost", "contrast", "darken", "greyscale", "lighten", "muted", "negative"]
68
+ if filter && !allowed_values.include?(filter)
69
+ fail "invalid value for 'filter', must be one of #{allowed_values}"
70
+ end
71
+ @filter = filter
72
+ end
73
+
74
+ # Custom attribute writer method checking allowed values (enum).
75
+ def style=(style)
76
+ allowed_values = ["minimal", "blockbuster", "vogue", "sketchy", "skinny"]
77
+ if style && !allowed_values.include?(style)
78
+ fail "invalid value for 'style', must be one of #{allowed_values}"
79
+ end
80
+ @style = style
81
+ end
82
+
83
+ # Check equality by comparing each attribute.
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ effect == o.effect &&
88
+ filter == o.filter &&
89
+ style == o.style
90
+ end
91
+
92
+ # @see the `==` method
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculate hash code according to all attributes.
98
+ def hash
99
+ [effect, filter, style].hash
100
+ end
101
+
102
+ # build the object from hash
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.swagger_types.each_pair do |key, type|
106
+ if type =~ /^Array<(.*)>/i
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
109
+ else
110
+ #TODO show warning in debug mode
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ else
115
+ # data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :BOOLEAN
135
+ if value =~ /^(true|t|yes|y|1)$/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ _model = Shotstack.const_get(type).new
153
+ _model.build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_body (backward compatibility))
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ # return the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Method to output non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map{ |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+
193
+ end
194
+ end
@@ -0,0 +1,149 @@
1
+ require 'date'
2
+
3
+ module Shotstack
4
+ # Model for Track
5
+ class Track
6
+ attr_accessor :clips
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+
12
+ :'clips' => :'clips'
13
+
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.swagger_types
19
+ {
20
+ :'clips' => :'Array<Clips>'
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[:'clips']
33
+ if (value = attributes[:'clips']).is_a?(Array)
34
+ self.clips = value
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ # Check equality by comparing each attribute.
41
+ def ==(o)
42
+ return true if self.equal?(o)
43
+ self.class == o.class &&
44
+ clips == o.clips
45
+ end
46
+
47
+ # @see the `==` method
48
+ def eql?(o)
49
+ self == o
50
+ end
51
+
52
+ # Calculate hash code according to all attributes.
53
+ def hash
54
+ [clips].hash
55
+ end
56
+
57
+ # build the object from hash
58
+ def build_from_hash(attributes)
59
+ return nil unless attributes.is_a?(Hash)
60
+ self.class.swagger_types.each_pair do |key, type|
61
+ if type =~ /^Array<(.*)>/i
62
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
63
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
64
+ else
65
+ #TODO show warning in debug mode
66
+ end
67
+ elsif !attributes[self.class.attribute_map[key]].nil?
68
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
69
+ else
70
+ # data not found in attributes(hash), not an issue as the data can be optional
71
+ end
72
+ end
73
+
74
+ self
75
+ end
76
+
77
+ def _deserialize(type, value)
78
+ case type.to_sym
79
+ when :DateTime
80
+ DateTime.parse(value)
81
+ when :Date
82
+ Date.parse(value)
83
+ when :String
84
+ value.to_s
85
+ when :Integer
86
+ value.to_i
87
+ when :Float
88
+ value.to_f
89
+ when :BOOLEAN
90
+ if value =~ /^(true|t|yes|y|1)$/i
91
+ true
92
+ else
93
+ false
94
+ end
95
+ when /\AArray<(?<inner_type>.+)>\z/
96
+ inner_type = Regexp.last_match[:inner_type]
97
+ value.map { |v| _deserialize(inner_type, v) }
98
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
99
+ k_type = Regexp.last_match[:k_type]
100
+ v_type = Regexp.last_match[:v_type]
101
+ {}.tap do |hash|
102
+ value.each do |k, v|
103
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
104
+ end
105
+ end
106
+ else # model
107
+ _model = Shotstack.const_get(type).new
108
+ _model.build_from_hash(value)
109
+ end
110
+ end
111
+
112
+ def to_s
113
+ to_hash.to_s
114
+ end
115
+
116
+ # to_body is an alias to to_body (backward compatibility))
117
+ def to_body
118
+ to_hash
119
+ end
120
+
121
+ # return the object in the form of hash
122
+ def to_hash
123
+ hash = {}
124
+ self.class.attribute_map.each_pair do |attr, param|
125
+ value = self.send(attr)
126
+ next if value.nil?
127
+ hash[param] = _to_hash(value)
128
+ end
129
+ hash
130
+ end
131
+
132
+ # Method to output non-array value in the form of hash
133
+ # For object, use to_hash. Otherwise, just return the value
134
+ def _to_hash(value)
135
+ if value.is_a?(Array)
136
+ value.compact.map{ |v| _to_hash(v) }
137
+ elsif value.is_a?(Hash)
138
+ {}.tap do |hash|
139
+ value.each { |k, v| hash[k] = _to_hash(v) }
140
+ end
141
+ elsif value.respond_to? :to_hash
142
+ value.to_hash
143
+ else
144
+ value
145
+ end
146
+ end
147
+
148
+ end
149
+ end