docraptor 1.1.0 → 2.0.0

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.
@@ -1,10 +1,19 @@
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.19
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module DocRaptor
4
16
  class Doc
5
- # Specify a specific verison of the DocRaptor Pipeline to use.
6
- attr_accessor :pipeline
7
-
8
17
  # A name for identifying your document.
9
18
  attr_accessor :name
10
19
 
@@ -20,12 +29,18 @@ module DocRaptor
20
29
  # Enable test mode for this document. Test documents are not charged for but include a watermark.
21
30
  attr_accessor :test
22
31
 
32
+ # Specify a specific verison of the DocRaptor Pipeline to use.
33
+ attr_accessor :pipeline
34
+
23
35
  # Force strict HTML validation.
24
36
  attr_accessor :strict
25
37
 
26
38
  # Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop.
27
39
  attr_accessor :ignore_resource_errors
28
40
 
41
+ # Prevent console.log from stopping document rendering during JavaScript execution.
42
+ attr_accessor :ignore_console_messages
43
+
29
44
  # A field for storing a small amount of metadata with this document.
30
45
  attr_accessor :tag
31
46
 
@@ -38,210 +53,284 @@ module DocRaptor
38
53
  # Set HTTP referrer when generating this document.
39
54
  attr_accessor :referrer
40
55
 
41
- # 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.
42
57
  attr_accessor :callback_url
43
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
+
44
65
  attr_accessor :prince_options
45
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
+
46
89
  # Attribute mapping from ruby-style variable name to JSON key.
47
90
  def self.attribute_map
48
91
  {
49
-
50
- :'pipeline' => :'pipeline',
51
-
52
92
  :'name' => :'name',
53
-
54
93
  :'document_type' => :'document_type',
55
-
56
94
  :'document_content' => :'document_content',
57
-
58
95
  :'document_url' => :'document_url',
59
-
60
96
  :'test' => :'test',
61
-
97
+ :'pipeline' => :'pipeline',
62
98
  :'strict' => :'strict',
63
-
64
99
  :'ignore_resource_errors' => :'ignore_resource_errors',
65
-
100
+ :'ignore_console_messages' => :'ignore_console_messages',
66
101
  :'tag' => :'tag',
67
-
68
102
  :'help' => :'help',
69
-
70
103
  :'javascript' => :'javascript',
71
-
72
104
  :'referrer' => :'referrer',
73
-
74
105
  :'callback_url' => :'callback_url',
75
-
106
+ :'hosted_download_limit' => :'hosted_download_limit',
107
+ :'hosted_expires_at' => :'hosted_expires_at',
76
108
  :'prince_options' => :'prince_options'
77
-
78
109
  }
79
110
  end
80
111
 
81
112
  # Attribute type mapping.
82
113
  def self.swagger_types
83
114
  {
84
- :'pipeline' => :'String',
85
115
  :'name' => :'String',
86
116
  :'document_type' => :'String',
87
117
  :'document_content' => :'String',
88
118
  :'document_url' => :'String',
89
119
  :'test' => :'BOOLEAN',
120
+ :'pipeline' => :'String',
90
121
  :'strict' => :'String',
91
122
  :'ignore_resource_errors' => :'BOOLEAN',
123
+ :'ignore_console_messages' => :'BOOLEAN',
92
124
  :'tag' => :'String',
93
125
  :'help' => :'BOOLEAN',
94
126
  :'javascript' => :'BOOLEAN',
95
127
  :'referrer' => :'String',
96
128
  :'callback_url' => :'String',
129
+ :'hosted_download_limit' => :'Integer',
130
+ :'hosted_expires_at' => :'String',
97
131
  :'prince_options' => :'PrinceOptions'
98
-
99
132
  }
100
133
  end
101
134
 
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
102
137
  def initialize(attributes = {})
103
138
  return unless attributes.is_a?(Hash)
104
139
 
105
140
  # convert string to symbol for hash key
106
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
107
-
108
-
109
- if attributes[:'pipeline']
110
- self.pipeline = attributes[:'pipeline']
111
- end
141
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
112
142
 
113
- if attributes[:'name']
143
+ if attributes.has_key?(:'name')
114
144
  self.name = attributes[:'name']
115
145
  end
116
146
 
117
- if attributes[:'document_type']
147
+ if attributes.has_key?(:'document_type')
118
148
  self.document_type = attributes[:'document_type']
119
149
  end
120
150
 
121
- if attributes[:'document_content']
151
+ if attributes.has_key?(:'document_content')
122
152
  self.document_content = attributes[:'document_content']
123
153
  end
124
154
 
125
- if attributes[:'document_url']
155
+ if attributes.has_key?(:'document_url')
126
156
  self.document_url = attributes[:'document_url']
127
157
  end
128
158
 
129
- if attributes[:'test']
159
+ if attributes.has_key?(:'test')
130
160
  self.test = attributes[:'test']
131
161
  else
132
162
  self.test = true
133
163
  end
134
164
 
135
- if attributes[:'strict']
165
+ if attributes.has_key?(:'pipeline')
166
+ self.pipeline = attributes[:'pipeline']
167
+ end
168
+
169
+ if attributes.has_key?(:'strict')
136
170
  self.strict = attributes[:'strict']
137
- else
138
- self.strict = "none"
139
171
  end
140
172
 
141
- if attributes[:'ignore_resource_errors']
173
+ if attributes.has_key?(:'ignore_resource_errors')
142
174
  self.ignore_resource_errors = attributes[:'ignore_resource_errors']
143
175
  else
144
176
  self.ignore_resource_errors = true
145
177
  end
146
178
 
147
- 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')
148
186
  self.tag = attributes[:'tag']
149
187
  end
150
188
 
151
- if attributes[:'help']
189
+ if attributes.has_key?(:'help')
152
190
  self.help = attributes[:'help']
153
191
  else
154
192
  self.help = false
155
193
  end
156
194
 
157
- if attributes[:'javascript']
195
+ if attributes.has_key?(:'javascript')
158
196
  self.javascript = attributes[:'javascript']
159
197
  else
160
198
  self.javascript = false
161
199
  end
162
200
 
163
- if attributes[:'referrer']
201
+ if attributes.has_key?(:'referrer')
164
202
  self.referrer = attributes[:'referrer']
165
203
  end
166
204
 
167
- if attributes[:'callback_url']
205
+ if attributes.has_key?(:'callback_url')
168
206
  self.callback_url = attributes[:'callback_url']
169
207
  end
170
208
 
171
- 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')
172
218
  self.prince_options = attributes[:'prince_options']
173
219
  end
220
+ end
174
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
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
175
252
  end
176
253
 
177
254
  # Custom attribute writer method checking allowed values (enum).
255
+ # @param [Object] document_type Object to be assigned
178
256
  def document_type=(document_type)
179
- allowed_values = ["pdf", "xls", "xlsx"]
180
- if document_type && !allowed_values.include?(document_type)
181
- 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}.'
182
260
  end
183
261
  @document_type = document_type
184
262
  end
185
263
 
186
264
  # Custom attribute writer method checking allowed values (enum).
265
+ # @param [Object] strict Object to be assigned
187
266
  def strict=(strict)
188
- allowed_values = ["none"]
189
- if strict && !allowed_values.include?(strict)
190
- 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}.'
191
270
  end
192
271
  @strict = strict
193
272
  end
194
273
 
195
- # Check equality by comparing each attribute.
274
+ # Checks equality by comparing each attribute.
275
+ # @param [Object] Object to be compared
196
276
  def ==(o)
197
277
  return true if self.equal?(o)
198
278
  self.class == o.class &&
199
- pipeline == o.pipeline &&
200
279
  name == o.name &&
201
280
  document_type == o.document_type &&
202
281
  document_content == o.document_content &&
203
282
  document_url == o.document_url &&
204
283
  test == o.test &&
284
+ pipeline == o.pipeline &&
205
285
  strict == o.strict &&
206
286
  ignore_resource_errors == o.ignore_resource_errors &&
287
+ ignore_console_messages == o.ignore_console_messages &&
207
288
  tag == o.tag &&
208
289
  help == o.help &&
209
290
  javascript == o.javascript &&
210
291
  referrer == o.referrer &&
211
292
  callback_url == o.callback_url &&
293
+ hosted_download_limit == o.hosted_download_limit &&
294
+ hosted_expires_at == o.hosted_expires_at &&
212
295
  prince_options == o.prince_options
213
296
  end
214
297
 
215
298
  # @see the `==` method
299
+ # @param [Object] Object to be compared
216
300
  def eql?(o)
217
301
  self == o
218
302
  end
219
303
 
220
- # Calculate hash code according to all attributes.
304
+ # Calculates hash code according to all attributes.
305
+ # @return [Fixnum] Hash code
221
306
  def hash
222
- [pipeline, 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
223
308
  end
224
309
 
225
- # 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
226
313
  def build_from_hash(attributes)
227
314
  return nil unless attributes.is_a?(Hash)
228
315
  self.class.swagger_types.each_pair do |key, type|
229
- 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
230
319
  if attributes[self.class.attribute_map[key]].is_a?(Array)
231
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
232
- else
233
- #TODO show warning in debug mode
320
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
234
321
  end
235
322
  elsif !attributes[self.class.attribute_map[key]].nil?
236
323
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
- else
238
- # data not found in attributes(hash), not an issue as the data can be optional
239
- end
324
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
240
325
  end
241
326
 
242
327
  self
243
328
  end
244
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
245
334
  def _deserialize(type, value)
246
335
  case type.to_sym
247
336
  when :DateTime
@@ -255,7 +344,7 @@ module DocRaptor
255
344
  when :Float
256
345
  value.to_f
257
346
  when :BOOLEAN
258
- if value.to_s =~ /^(true|t|yes|y|1)$/i
347
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
259
348
  true
260
349
  else
261
350
  false
@@ -266,7 +355,7 @@ module DocRaptor
266
355
  when /\AArray<(?<inner_type>.+)>\z/
267
356
  inner_type = Regexp.last_match[:inner_type]
268
357
  value.map { |v| _deserialize(inner_type, v) }
269
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
358
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
270
359
  k_type = Regexp.last_match[:k_type]
271
360
  v_type = Regexp.last_match[:v_type]
272
361
  {}.tap do |hash|
@@ -275,21 +364,25 @@ module DocRaptor
275
364
  end
276
365
  end
277
366
  else # model
278
- _model = DocRaptor.const_get(type).new
279
- _model.build_from_hash(value)
367
+ temp_model = DocRaptor.const_get(type).new
368
+ temp_model.build_from_hash(value)
280
369
  end
281
370
  end
282
371
 
372
+ # Returns the string representation of the object
373
+ # @return [String] String presentation of the object
283
374
  def to_s
284
375
  to_hash.to_s
285
376
  end
286
377
 
287
- # 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
288
380
  def to_body
289
381
  to_hash
290
382
  end
291
383
 
292
- # 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
293
386
  def to_hash
294
387
  hash = {}
295
388
  self.class.attribute_map.each_pair do |attr, param|
@@ -300,11 +393,13 @@ module DocRaptor
300
393
  hash
301
394
  end
302
395
 
303
- # Method to output non-array value in the form of hash
396
+ # Outputs non-array value in the form of hash
304
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
305
400
  def _to_hash(value)
306
401
  if value.is_a?(Array)
307
- value.compact.map{ |v| _to_hash(v) }
402
+ value.compact.map { |v| _to_hash(v) }
308
403
  elsif value.is_a?(Hash)
309
404
  {}.tap do |hash|
310
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.19
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) }