docraptor 1.0.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ =begin
2
+ #DocRaptor
3
+
4
+ #A native client library for the DocRaptor HTML to PDF/XLS service.
5
+
6
+ OpenAPI spec version: 1.4.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module DocRaptor
@@ -17,12 +29,18 @@ module DocRaptor
17
29
  # Enable test mode for this document. Test documents are not charged for but include a watermark.
18
30
  attr_accessor :test
19
31
 
32
+ # Specify a specific verison of the DocRaptor Pipeline to use.
33
+ attr_accessor :pipeline
34
+
20
35
  # Force strict HTML validation.
21
36
  attr_accessor :strict
22
37
 
23
38
  # Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop.
24
39
  attr_accessor :ignore_resource_errors
25
40
 
41
+ # Prevent console.log from stopping document rendering during JavaScript execution.
42
+ attr_accessor :ignore_console_messages
43
+
26
44
  # A field for storing a small amount of metadata with this document.
27
45
  attr_accessor :tag
28
46
 
@@ -35,41 +53,59 @@ module DocRaptor
35
53
  # Set HTTP referrer when generating this document.
36
54
  attr_accessor :referrer
37
55
 
38
- # A URL that will receive a POST request after successfully completing an asynchronous document. The POST data will include download_url and download_id similar to status api responses. WARNING: this only works on asynchronous documents.
56
+ # A URL that will receive a POST request after successfully completing an asynchronous document. The POST data will include download_url and download_id similar to status API responses. WARNING: this only works on asynchronous documents.
39
57
  attr_accessor :callback_url
40
58
 
59
+ # The number of times a hosted document can be downloaded. If no limit is specified, the document will be available for an unlimited number of downloads.
60
+ attr_accessor :hosted_download_limit
61
+
62
+ # The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00.
63
+ attr_accessor :hosted_expires_at
64
+
41
65
  attr_accessor :prince_options
42
66
 
67
+ class EnumAttributeValidator
68
+ attr_reader :datatype
69
+ attr_reader :allowable_values
70
+
71
+ def initialize(datatype, allowable_values)
72
+ @allowable_values = allowable_values.map do |value|
73
+ case datatype.to_s
74
+ when /Integer/i
75
+ value.to_i
76
+ when /Float/i
77
+ value.to_f
78
+ else
79
+ value
80
+ end
81
+ end
82
+ end
83
+
84
+ def valid?(value)
85
+ !value || allowable_values.include?(value)
86
+ end
87
+ end
88
+
43
89
  # Attribute mapping from ruby-style variable name to JSON key.
44
90
  def self.attribute_map
45
91
  {
46
-
47
92
  :'name' => :'name',
48
-
49
93
  :'document_type' => :'document_type',
50
-
51
94
  :'document_content' => :'document_content',
52
-
53
95
  :'document_url' => :'document_url',
54
-
55
96
  :'test' => :'test',
56
-
97
+ :'pipeline' => :'pipeline',
57
98
  :'strict' => :'strict',
58
-
59
99
  :'ignore_resource_errors' => :'ignore_resource_errors',
60
-
100
+ :'ignore_console_messages' => :'ignore_console_messages',
61
101
  :'tag' => :'tag',
62
-
63
102
  :'help' => :'help',
64
-
65
103
  :'javascript' => :'javascript',
66
-
67
104
  :'referrer' => :'referrer',
68
-
69
105
  :'callback_url' => :'callback_url',
70
-
106
+ :'hosted_download_limit' => :'hosted_download_limit',
107
+ :'hosted_expires_at' => :'hosted_expires_at',
71
108
  :'prince_options' => :'prince_options'
72
-
73
109
  }
74
110
  end
75
111
 
@@ -81,108 +117,162 @@ module DocRaptor
81
117
  :'document_content' => :'String',
82
118
  :'document_url' => :'String',
83
119
  :'test' => :'BOOLEAN',
120
+ :'pipeline' => :'String',
84
121
  :'strict' => :'String',
85
122
  :'ignore_resource_errors' => :'BOOLEAN',
123
+ :'ignore_console_messages' => :'BOOLEAN',
86
124
  :'tag' => :'String',
87
125
  :'help' => :'BOOLEAN',
88
126
  :'javascript' => :'BOOLEAN',
89
127
  :'referrer' => :'String',
90
128
  :'callback_url' => :'String',
129
+ :'hosted_download_limit' => :'Integer',
130
+ :'hosted_expires_at' => :'String',
91
131
  :'prince_options' => :'PrinceOptions'
92
-
93
132
  }
94
133
  end
95
134
 
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
96
137
  def initialize(attributes = {})
97
138
  return unless attributes.is_a?(Hash)
98
139
 
99
140
  # convert string to symbol for hash key
100
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
141
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
101
142
 
102
-
103
- if attributes[:'name']
143
+ if attributes.has_key?(:'name')
104
144
  self.name = attributes[:'name']
105
145
  end
106
146
 
107
- if attributes[:'document_type']
147
+ if attributes.has_key?(:'document_type')
108
148
  self.document_type = attributes[:'document_type']
109
149
  end
110
150
 
111
- if attributes[:'document_content']
151
+ if attributes.has_key?(:'document_content')
112
152
  self.document_content = attributes[:'document_content']
113
153
  end
114
154
 
115
- if attributes[:'document_url']
155
+ if attributes.has_key?(:'document_url')
116
156
  self.document_url = attributes[:'document_url']
117
157
  end
118
158
 
119
- if attributes[:'test']
159
+ if attributes.has_key?(:'test')
120
160
  self.test = attributes[:'test']
121
161
  else
122
162
  self.test = true
123
163
  end
124
164
 
125
- if attributes[:'strict']
165
+ if attributes.has_key?(:'pipeline')
166
+ self.pipeline = attributes[:'pipeline']
167
+ end
168
+
169
+ if attributes.has_key?(:'strict')
126
170
  self.strict = attributes[:'strict']
127
- else
128
- self.strict = "none"
129
171
  end
130
172
 
131
- if attributes[:'ignore_resource_errors']
173
+ if attributes.has_key?(:'ignore_resource_errors')
132
174
  self.ignore_resource_errors = attributes[:'ignore_resource_errors']
133
175
  else
134
176
  self.ignore_resource_errors = true
135
177
  end
136
178
 
137
- if attributes[:'tag']
179
+ if attributes.has_key?(:'ignore_console_messages')
180
+ self.ignore_console_messages = attributes[:'ignore_console_messages']
181
+ else
182
+ self.ignore_console_messages = false
183
+ end
184
+
185
+ if attributes.has_key?(:'tag')
138
186
  self.tag = attributes[:'tag']
139
187
  end
140
188
 
141
- if attributes[:'help']
189
+ if attributes.has_key?(:'help')
142
190
  self.help = attributes[:'help']
143
191
  else
144
192
  self.help = false
145
193
  end
146
194
 
147
- if attributes[:'javascript']
195
+ if attributes.has_key?(:'javascript')
148
196
  self.javascript = attributes[:'javascript']
149
197
  else
150
198
  self.javascript = false
151
199
  end
152
200
 
153
- if attributes[:'referrer']
201
+ if attributes.has_key?(:'referrer')
154
202
  self.referrer = attributes[:'referrer']
155
203
  end
156
204
 
157
- if attributes[:'callback_url']
205
+ if attributes.has_key?(:'callback_url')
158
206
  self.callback_url = attributes[:'callback_url']
159
207
  end
160
208
 
161
- if attributes[:'prince_options']
209
+ if attributes.has_key?(:'hosted_download_limit')
210
+ self.hosted_download_limit = attributes[:'hosted_download_limit']
211
+ end
212
+
213
+ if attributes.has_key?(:'hosted_expires_at')
214
+ self.hosted_expires_at = attributes[:'hosted_expires_at']
215
+ end
216
+
217
+ if attributes.has_key?(:'prince_options')
162
218
  self.prince_options = attributes[:'prince_options']
163
219
  end
220
+ end
221
+
222
+ # Show invalid properties with the reasons. Usually used together with valid?
223
+ # @return Array for valid properties with the reasons
224
+ def list_invalid_properties
225
+ invalid_properties = Array.new
226
+ if @name.nil?
227
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
228
+ end
164
229
 
230
+ if @document_type.nil?
231
+ invalid_properties.push('invalid value for "document_type", document_type cannot be nil.')
232
+ end
233
+
234
+ if @document_content.nil?
235
+ invalid_properties.push('invalid value for "document_content", document_content cannot be nil.')
236
+ end
237
+
238
+ invalid_properties
239
+ end
240
+
241
+ # Check to see if the all the properties in the model are valid
242
+ # @return true if the model is valid
243
+ def valid?
244
+ return false if @name.nil?
245
+ return false if @document_type.nil?
246
+ document_type_validator = EnumAttributeValidator.new('String', ['pdf', 'xls', 'xlsx'])
247
+ return false unless document_type_validator.valid?(@document_type)
248
+ return false if @document_content.nil?
249
+ strict_validator = EnumAttributeValidator.new('String', ['none', 'html'])
250
+ return false unless strict_validator.valid?(@strict)
251
+ true
165
252
  end
166
253
 
167
254
  # Custom attribute writer method checking allowed values (enum).
255
+ # @param [Object] document_type Object to be assigned
168
256
  def document_type=(document_type)
169
- allowed_values = ["pdf", "xls", "xlsx"]
170
- if document_type && !allowed_values.include?(document_type)
171
- fail "invalid value for 'document_type', must be one of #{allowed_values}"
257
+ validator = EnumAttributeValidator.new('String', ['pdf', 'xls', 'xlsx'])
258
+ unless validator.valid?(document_type)
259
+ fail ArgumentError, 'invalid value for "document_type", must be one of #{validator.allowable_values}.'
172
260
  end
173
261
  @document_type = document_type
174
262
  end
175
263
 
176
264
  # Custom attribute writer method checking allowed values (enum).
265
+ # @param [Object] strict Object to be assigned
177
266
  def strict=(strict)
178
- allowed_values = ["none"]
179
- if strict && !allowed_values.include?(strict)
180
- fail "invalid value for 'strict', must be one of #{allowed_values}"
267
+ validator = EnumAttributeValidator.new('String', ['none', 'html'])
268
+ unless validator.valid?(strict)
269
+ fail ArgumentError, 'invalid value for "strict", must be one of #{validator.allowable_values}.'
181
270
  end
182
271
  @strict = strict
183
272
  end
184
273
 
185
- # Check equality by comparing each attribute.
274
+ # Checks equality by comparing each attribute.
275
+ # @param [Object] Object to be compared
186
276
  def ==(o)
187
277
  return true if self.equal?(o)
188
278
  self.class == o.class &&
@@ -191,46 +281,56 @@ module DocRaptor
191
281
  document_content == o.document_content &&
192
282
  document_url == o.document_url &&
193
283
  test == o.test &&
284
+ pipeline == o.pipeline &&
194
285
  strict == o.strict &&
195
286
  ignore_resource_errors == o.ignore_resource_errors &&
287
+ ignore_console_messages == o.ignore_console_messages &&
196
288
  tag == o.tag &&
197
289
  help == o.help &&
198
290
  javascript == o.javascript &&
199
291
  referrer == o.referrer &&
200
292
  callback_url == o.callback_url &&
293
+ hosted_download_limit == o.hosted_download_limit &&
294
+ hosted_expires_at == o.hosted_expires_at &&
201
295
  prince_options == o.prince_options
202
296
  end
203
297
 
204
298
  # @see the `==` method
299
+ # @param [Object] Object to be compared
205
300
  def eql?(o)
206
301
  self == o
207
302
  end
208
303
 
209
- # Calculate hash code according to all attributes.
304
+ # Calculates hash code according to all attributes.
305
+ # @return [Fixnum] Hash code
210
306
  def hash
211
- [name, document_type, document_content, document_url, test, strict, ignore_resource_errors, tag, help, javascript, referrer, callback_url, prince_options].hash
307
+ [name, document_type, document_content, document_url, test, pipeline, strict, ignore_resource_errors, ignore_console_messages, tag, help, javascript, referrer, callback_url, hosted_download_limit, hosted_expires_at, prince_options].hash
212
308
  end
213
309
 
214
- # build the object from hash
310
+ # Builds the object from hash
311
+ # @param [Hash] attributes Model attributes in the form of hash
312
+ # @return [Object] Returns the model itself
215
313
  def build_from_hash(attributes)
216
314
  return nil unless attributes.is_a?(Hash)
217
315
  self.class.swagger_types.each_pair do |key, type|
218
- if type =~ /^Array<(.*)>/i
316
+ if type =~ /\AArray<(.*)>/i
317
+ # check to ensure the input is an array given that the attribute
318
+ # is documented as an array but the input is not
219
319
  if attributes[self.class.attribute_map[key]].is_a?(Array)
220
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
221
- else
222
- #TODO show warning in debug mode
320
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
223
321
  end
224
322
  elsif !attributes[self.class.attribute_map[key]].nil?
225
323
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
- else
227
- # data not found in attributes(hash), not an issue as the data can be optional
228
- end
324
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
229
325
  end
230
326
 
231
327
  self
232
328
  end
233
329
 
330
+ # Deserializes the data based on type
331
+ # @param string type Data type
332
+ # @param string value Value to be deserialized
333
+ # @return [Object] Deserialized data
234
334
  def _deserialize(type, value)
235
335
  case type.to_sym
236
336
  when :DateTime
@@ -244,7 +344,7 @@ module DocRaptor
244
344
  when :Float
245
345
  value.to_f
246
346
  when :BOOLEAN
247
- if value.to_s =~ /^(true|t|yes|y|1)$/i
347
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
248
348
  true
249
349
  else
250
350
  false
@@ -255,7 +355,7 @@ module DocRaptor
255
355
  when /\AArray<(?<inner_type>.+)>\z/
256
356
  inner_type = Regexp.last_match[:inner_type]
257
357
  value.map { |v| _deserialize(inner_type, v) }
258
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
358
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
259
359
  k_type = Regexp.last_match[:k_type]
260
360
  v_type = Regexp.last_match[:v_type]
261
361
  {}.tap do |hash|
@@ -264,21 +364,25 @@ module DocRaptor
264
364
  end
265
365
  end
266
366
  else # model
267
- _model = DocRaptor.const_get(type).new
268
- _model.build_from_hash(value)
367
+ temp_model = DocRaptor.const_get(type).new
368
+ temp_model.build_from_hash(value)
269
369
  end
270
370
  end
271
371
 
372
+ # Returns the string representation of the object
373
+ # @return [String] String presentation of the object
272
374
  def to_s
273
375
  to_hash.to_s
274
376
  end
275
377
 
276
- # to_body is an alias to to_body (backward compatibility))
378
+ # to_body is an alias to to_hash (backward compatibility)
379
+ # @return [Hash] Returns the object in the form of hash
277
380
  def to_body
278
381
  to_hash
279
382
  end
280
383
 
281
- # return the object in the form of hash
384
+ # Returns the object in the form of hash
385
+ # @return [Hash] Returns the object in the form of hash
282
386
  def to_hash
283
387
  hash = {}
284
388
  self.class.attribute_map.each_pair do |attr, param|
@@ -289,11 +393,13 @@ module DocRaptor
289
393
  hash
290
394
  end
291
395
 
292
- # Method to output non-array value in the form of hash
396
+ # Outputs non-array value in the form of hash
293
397
  # For object, use to_hash. Otherwise, just return the value
398
+ # @param [Object] value Any valid value
399
+ # @return [Hash] Returns the value in the form of hash
294
400
  def _to_hash(value)
295
401
  if value.is_a?(Array)
296
- value.compact.map{ |v| _to_hash(v) }
402
+ value.compact.map { |v| _to_hash(v) }
297
403
  elsif value.is_a?(Hash)
298
404
  {}.tap do |hash|
299
405
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -1,14 +1,26 @@
1
+ =begin
2
+ #DocRaptor
3
+
4
+ #A native client library for the DocRaptor HTML to PDF/XLS service.
5
+
6
+ OpenAPI spec version: 1.4.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module DocRaptor
4
- class AsyncDocStatus
16
+ class DocStatus
5
17
  # The present status of the document. Can be queued, working, completed, and failed.
6
18
  attr_accessor :status
7
19
 
8
20
  # The URL where the document can be retrieved. This URL may only be used a few times.
9
21
  attr_accessor :download_url
10
22
 
11
- # The identifier for downloading the document with the download api.
23
+ # The identifier for downloading the document with the download API.
12
24
  attr_accessor :download_id
13
25
 
14
26
  # Additional information.
@@ -23,19 +35,12 @@ module DocRaptor
23
35
  # Attribute mapping from ruby-style variable name to JSON key.
24
36
  def self.attribute_map
25
37
  {
26
-
27
38
  :'status' => :'status',
28
-
29
39
  :'download_url' => :'download_url',
30
-
31
40
  :'download_id' => :'download_id',
32
-
33
41
  :'message' => :'message',
34
-
35
42
  :'number_of_pages' => :'number_of_pages',
36
-
37
43
  :'validation_errors' => :'validation_errors'
38
-
39
44
  }
40
45
  end
41
46
 
@@ -48,44 +53,57 @@ module DocRaptor
48
53
  :'message' => :'String',
49
54
  :'number_of_pages' => :'Integer',
50
55
  :'validation_errors' => :'String'
51
-
52
56
  }
53
57
  end
54
58
 
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
55
61
  def initialize(attributes = {})
56
62
  return unless attributes.is_a?(Hash)
57
63
 
58
64
  # convert string to symbol for hash key
59
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
65
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
66
 
61
-
62
- if attributes[:'status']
67
+ if attributes.has_key?(:'status')
63
68
  self.status = attributes[:'status']
64
69
  end
65
70
 
66
- if attributes[:'download_url']
71
+ if attributes.has_key?(:'download_url')
67
72
  self.download_url = attributes[:'download_url']
68
73
  end
69
74
 
70
- if attributes[:'download_id']
75
+ if attributes.has_key?(:'download_id')
71
76
  self.download_id = attributes[:'download_id']
72
77
  end
73
78
 
74
- if attributes[:'message']
79
+ if attributes.has_key?(:'message')
75
80
  self.message = attributes[:'message']
76
81
  end
77
82
 
78
- if attributes[:'number_of_pages']
83
+ if attributes.has_key?(:'number_of_pages')
79
84
  self.number_of_pages = attributes[:'number_of_pages']
80
85
  end
81
86
 
82
- if attributes[:'validation_errors']
87
+ if attributes.has_key?(:'validation_errors')
83
88
  self.validation_errors = attributes[:'validation_errors']
84
89
  end
90
+ end
85
91
 
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ invalid_properties
86
97
  end
87
98
 
88
- # Check equality by comparing each attribute.
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
89
107
  def ==(o)
90
108
  return true if self.equal?(o)
91
109
  self.class == o.class &&
@@ -98,35 +116,41 @@ module DocRaptor
98
116
  end
99
117
 
100
118
  # @see the `==` method
119
+ # @param [Object] Object to be compared
101
120
  def eql?(o)
102
121
  self == o
103
122
  end
104
123
 
105
- # Calculate hash code according to all attributes.
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
106
126
  def hash
107
127
  [status, download_url, download_id, message, number_of_pages, validation_errors].hash
108
128
  end
109
129
 
110
- # build the object from hash
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
111
133
  def build_from_hash(attributes)
112
134
  return nil unless attributes.is_a?(Hash)
113
135
  self.class.swagger_types.each_pair do |key, type|
114
- if type =~ /^Array<(.*)>/i
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
115
139
  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
- else
118
- #TODO show warning in debug mode
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
141
  end
120
142
  elsif !attributes[self.class.attribute_map[key]].nil?
121
143
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
- else
123
- # data not found in attributes(hash), not an issue as the data can be optional
124
- end
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
145
  end
126
146
 
127
147
  self
128
148
  end
129
149
 
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
130
154
  def _deserialize(type, value)
131
155
  case type.to_sym
132
156
  when :DateTime
@@ -140,7 +164,7 @@ module DocRaptor
140
164
  when :Float
141
165
  value.to_f
142
166
  when :BOOLEAN
143
- if value.to_s =~ /^(true|t|yes|y|1)$/i
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
168
  true
145
169
  else
146
170
  false
@@ -151,7 +175,7 @@ module DocRaptor
151
175
  when /\AArray<(?<inner_type>.+)>\z/
152
176
  inner_type = Regexp.last_match[:inner_type]
153
177
  value.map { |v| _deserialize(inner_type, v) }
154
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
179
  k_type = Regexp.last_match[:k_type]
156
180
  v_type = Regexp.last_match[:v_type]
157
181
  {}.tap do |hash|
@@ -160,21 +184,25 @@ module DocRaptor
160
184
  end
161
185
  end
162
186
  else # model
163
- _model = DocRaptor.const_get(type).new
164
- _model.build_from_hash(value)
187
+ temp_model = DocRaptor.const_get(type).new
188
+ temp_model.build_from_hash(value)
165
189
  end
166
190
  end
167
191
 
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
168
194
  def to_s
169
195
  to_hash.to_s
170
196
  end
171
197
 
172
- # to_body is an alias to to_body (backward compatibility))
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
173
200
  def to_body
174
201
  to_hash
175
202
  end
176
203
 
177
- # return the object in the form of hash
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
178
206
  def to_hash
179
207
  hash = {}
180
208
  self.class.attribute_map.each_pair do |attr, param|
@@ -185,11 +213,13 @@ module DocRaptor
185
213
  hash
186
214
  end
187
215
 
188
- # Method to output non-array value in the form of hash
216
+ # Outputs non-array value in the form of hash
189
217
  # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
190
220
  def _to_hash(value)
191
221
  if value.is_a?(Array)
192
- value.compact.map{ |v| _to_hash(v) }
222
+ value.compact.map { |v| _to_hash(v) }
193
223
  elsif value.is_a?(Hash)
194
224
  {}.tap do |hash|
195
225
  value.each { |k, v| hash[k] = _to_hash(v) }