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