shotstack 0.0.9

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