dropbox-sign 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +26 -9
  4. data/VERSION +1 -1
  5. data/docs/BulkSendJobApi.md +5 -3
  6. data/docs/TeamResponse.md +1 -0
  7. data/docs/TemplateResponse.md +2 -2
  8. data/docs/TemplateResponseDocument.md +3 -3
  9. data/docs/{TemplateResponseCustomField.md → TemplateResponseDocumentCustomFieldBase.md} +6 -8
  10. data/docs/TemplateResponseDocumentCustomFieldCheckbox.md +10 -0
  11. data/docs/TemplateResponseDocumentCustomFieldText.md +14 -0
  12. data/docs/TemplateResponseDocumentFieldGroup.md +1 -1
  13. data/docs/TemplateResponseDocumentFieldGroupRule.md +11 -0
  14. data/docs/{TemplateResponseDocumentFormField.md → TemplateResponseDocumentFormFieldBase.md} +5 -8
  15. data/docs/TemplateResponseDocumentFormFieldCheckbox.md +10 -0
  16. data/docs/TemplateResponseDocumentFormFieldDateSigned.md +10 -0
  17. data/docs/TemplateResponseDocumentFormFieldDropdown.md +10 -0
  18. data/docs/TemplateResponseDocumentFormFieldHyperlink.md +14 -0
  19. data/docs/TemplateResponseDocumentFormFieldInitials.md +10 -0
  20. data/docs/TemplateResponseDocumentFormFieldRadio.md +10 -0
  21. data/docs/TemplateResponseDocumentFormFieldSignature.md +10 -0
  22. data/docs/TemplateResponseDocumentFormFieldText.md +15 -0
  23. data/docs/{TemplateResponseDocumentStaticField.md → TemplateResponseDocumentStaticFieldBase.md} +6 -5
  24. data/docs/TemplateResponseDocumentStaticFieldCheckbox.md +10 -0
  25. data/docs/TemplateResponseDocumentStaticFieldDateSigned.md +10 -0
  26. data/docs/TemplateResponseDocumentStaticFieldDropdown.md +10 -0
  27. data/docs/TemplateResponseDocumentStaticFieldHyperlink.md +10 -0
  28. data/docs/TemplateResponseDocumentStaticFieldInitials.md +10 -0
  29. data/docs/TemplateResponseDocumentStaticFieldRadio.md +10 -0
  30. data/docs/TemplateResponseDocumentStaticFieldSignature.md +10 -0
  31. data/docs/TemplateResponseDocumentStaticFieldText.md +10 -0
  32. data/docs/TemplateResponseFieldAvgTextLength.md +1 -1
  33. data/lib/dropbox-sign/api/bulk_send_job_api.rb +6 -0
  34. data/lib/dropbox-sign/models/team_response.rb +17 -4
  35. data/lib/dropbox-sign/models/template_response.rb +5 -5
  36. data/lib/dropbox-sign/models/template_response_document.rb +9 -9
  37. data/lib/dropbox-sign/models/{template_response_document_static_field.rb → template_response_document_custom_field_base.rb} +75 -43
  38. data/lib/dropbox-sign/models/template_response_document_custom_field_checkbox.rb +263 -0
  39. data/lib/dropbox-sign/models/template_response_document_custom_field_text.rb +306 -0
  40. data/lib/dropbox-sign/models/template_response_document_field_group.rb +2 -3
  41. data/lib/dropbox-sign/models/template_response_document_field_group_rule.rb +263 -0
  42. data/lib/dropbox-sign/models/{template_response_named_form_field.rb → template_response_document_form_field_base.rb} +82 -79
  43. data/lib/dropbox-sign/models/template_response_document_form_field_checkbox.rb +263 -0
  44. data/lib/dropbox-sign/models/template_response_document_form_field_date_signed.rb +263 -0
  45. data/lib/dropbox-sign/models/template_response_document_form_field_dropdown.rb +263 -0
  46. data/lib/dropbox-sign/models/template_response_document_form_field_hyperlink.rb +306 -0
  47. data/lib/dropbox-sign/models/template_response_document_form_field_initials.rb +263 -0
  48. data/lib/dropbox-sign/models/template_response_document_form_field_radio.rb +263 -0
  49. data/lib/dropbox-sign/models/template_response_document_form_field_signature.rb +263 -0
  50. data/lib/dropbox-sign/models/{template_response_document_form_field.rb → template_response_document_form_field_text.rb} +53 -132
  51. data/lib/dropbox-sign/models/{template_response_custom_field.rb → template_response_document_static_field_base.rb} +94 -112
  52. data/lib/dropbox-sign/models/template_response_document_static_field_checkbox.rb +263 -0
  53. data/lib/dropbox-sign/models/template_response_document_static_field_date_signed.rb +263 -0
  54. data/lib/dropbox-sign/models/template_response_document_static_field_dropdown.rb +263 -0
  55. data/lib/dropbox-sign/models/template_response_document_static_field_hyperlink.rb +263 -0
  56. data/lib/dropbox-sign/models/template_response_document_static_field_initials.rb +263 -0
  57. data/lib/dropbox-sign/models/template_response_document_static_field_radio.rb +263 -0
  58. data/lib/dropbox-sign/models/template_response_document_static_field_signature.rb +263 -0
  59. data/lib/dropbox-sign/models/template_response_document_static_field_text.rb +263 -0
  60. data/lib/dropbox-sign/models/template_response_field_avg_text_length.rb +1 -1
  61. data/lib/dropbox-sign/version.rb +1 -1
  62. data/lib/dropbox-sign.rb +22 -5
  63. data/openapi-config.yaml +1 -1
  64. data/openapi-sdk.yaml +592 -176
  65. data/test_fixtures/AccountCreateResponse.json +1 -0
  66. data/test_fixtures/ApiAppGetResponse.json +1 -0
  67. data/test_fixtures/ApiAppListResponse.json +1 -0
  68. data/test_fixtures/BulkSendJobGetResponse.json +8 -3
  69. data/test_fixtures/SignatureRequestGetResponse.json +65 -65
  70. data/test_fixtures/SignatureRequestListResponse.json +11 -4
  71. data/test_fixtures/TemplateGetResponse.json +1064 -41
  72. data/test_fixtures/TemplateListResponse.json +513 -44
  73. metadata +52 -18
  74. data/docs/TemplateResponseDocumentCustomField.md +0 -25
  75. data/docs/TemplateResponseNamedFormField.md +0 -23
  76. data/lib/dropbox-sign/models/template_response_document_custom_field.rb +0 -454
@@ -0,0 +1,306 @@
1
+ =begin
2
+ #Dropbox Sign API
3
+
4
+ #Dropbox Sign v3 API
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: apisupport@hellosign.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Dropbox
17
+ end
18
+
19
+ module Dropbox::Sign
20
+ # This class extends `TemplateResponseDocumentCustomFieldBase`
21
+ class TemplateResponseDocumentCustomFieldText < TemplateResponseDocumentCustomFieldBase
22
+ # The type of this Custom Field. Only `text` and `checkbox` are currently supported. * Text uses `TemplateResponseDocumentCustomFieldText` * Checkbox uses `TemplateResponseDocumentCustomFieldCheckbox`
23
+ # @return [String]
24
+ attr_accessor :type
25
+
26
+ # @return [TemplateResponseFieldAvgTextLength]
27
+ attr_accessor :avg_text_length
28
+
29
+ # Whether this form field is multiline text.
30
+ # @return [Boolean]
31
+ attr_accessor :is_multiline
32
+
33
+ # Original font size used in this form field's text.
34
+ # @return [Integer]
35
+ attr_accessor :original_font_size
36
+
37
+ # Font family used in this form field's text.
38
+ # @return [String]
39
+ attr_accessor :font_family
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'type' => :'type',
45
+ :'avg_text_length' => :'avg_text_length',
46
+ :'is_multiline' => :'isMultiline',
47
+ :'original_font_size' => :'originalFontSize',
48
+ :'font_family' => :'fontFamily'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about, including the ones defined in its parent(s)
53
+ def self.acceptable_attributes
54
+ attribute_map.values.concat(superclass.acceptable_attributes)
55
+ end
56
+
57
+ # Returns attribute map of this model + parent
58
+ def self.merged_attributes
59
+ self.superclass.attribute_map.merge(self.attribute_map)
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'type' => :'String',
66
+ :'avg_text_length' => :'TemplateResponseFieldAvgTextLength',
67
+ :'is_multiline' => :'Boolean',
68
+ :'original_font_size' => :'Integer',
69
+ :'font_family' => :'String'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping of this model + parent
74
+ def self.merged_types
75
+ self.superclass.openapi_types.merge(self.openapi_types)
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Returns list of attributes with nullable: true of this model + parent
85
+ def self.merged_nullable
86
+ self.superclass.openapi_nullable.merge(self.openapi_nullable)
87
+ end
88
+
89
+ # Attempt to instantiate and hydrate a new instance of this class
90
+ # @param [Object] data Data to be converted
91
+ # @return [TemplateResponseDocumentCustomFieldText]
92
+ def self.init(data)
93
+ return ApiClient.default.convert_to_type(
94
+ data,
95
+ "TemplateResponseDocumentCustomFieldText"
96
+ ) || TemplateResponseDocumentCustomFieldText.new
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateResponseDocumentCustomFieldText` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}) { |(k, v), h|
108
+ if (!self.class.merged_attributes.key?(k.to_sym))
109
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateResponseDocumentCustomFieldText`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
110
+ end
111
+ h[k.to_sym] = v
112
+ }
113
+
114
+ # call parent's initialize
115
+ super(attributes)
116
+
117
+ if attributes.key?(:'type')
118
+ self.type = attributes[:'type']
119
+ else
120
+ self.type = 'text'
121
+ end
122
+
123
+ if attributes.key?(:'avg_text_length')
124
+ self.avg_text_length = attributes[:'avg_text_length']
125
+ end
126
+
127
+ if attributes.key?(:'is_multiline')
128
+ self.is_multiline = attributes[:'is_multiline']
129
+ end
130
+
131
+ if attributes.key?(:'original_font_size')
132
+ self.original_font_size = attributes[:'original_font_size']
133
+ end
134
+
135
+ if attributes.key?(:'font_family')
136
+ self.font_family = attributes[:'font_family']
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ invalid_properties = super
144
+ if @type.nil?
145
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
146
+ end
147
+
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ return false if @type.nil?
155
+ true && super
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ type == o.type &&
164
+ avg_text_length == o.avg_text_length &&
165
+ is_multiline == o.is_multiline &&
166
+ original_font_size == o.original_font_size &&
167
+ font_family == o.font_family && super(o)
168
+ end
169
+
170
+ # @see the `==` method
171
+ # @param [Object] Object to be compared
172
+ def eql?(o)
173
+ self == o
174
+ end
175
+
176
+ # Calculates hash code according to all attributes.
177
+ # @return [Integer] Hash code
178
+ def hash
179
+ [type, avg_text_length, is_multiline, original_font_size, font_family].hash
180
+ end
181
+
182
+ # Builds the object from hash
183
+ # @param [Hash] attributes Model attributes in the form of hash
184
+ # @return [Object] Returns the model itself
185
+ def self.build_from_hash(attributes)
186
+ new.build_from_hash(attributes)
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ super(attributes)
195
+ attribute_map = self.class.merged_attributes
196
+
197
+ self.class.merged_types.each_pair do |key, type|
198
+ if type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
203
+ end
204
+ elsif !attributes[attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
206
+ end
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :Time
219
+ Time.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :Boolean
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :File
235
+ value
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet)
252
+ klass = Dropbox::Sign.const_get(type)
253
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash(include_nil = true)
272
+ hash = super
273
+ self.class.merged_attributes.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ next unless include_nil
277
+ is_nullable = self.class.merged_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value, include_nil)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value, include_nil = true)
291
+ if value.is_a?(Array)
292
+ value.compact.map { |v| _to_hash(v, include_nil) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v, include_nil) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash(include_nil)
299
+ else
300
+ value
301
+ end
302
+ end
303
+
304
+ end
305
+
306
+ end
@@ -22,8 +22,7 @@ module Dropbox::Sign
22
22
  # @return [String]
23
23
  attr_accessor :name
24
24
 
25
- # The rule used to validate checkboxes in the form field group. See [checkbox field grouping](/api/reference/constants/#checkbox-field-grouping).
26
- # @return [String]
25
+ # @return [TemplateResponseDocumentFieldGroupRule]
27
26
  attr_accessor :rule
28
27
 
29
28
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -48,7 +47,7 @@ module Dropbox::Sign
48
47
  def self.openapi_types
49
48
  {
50
49
  :'name' => :'String',
51
- :'rule' => :'String'
50
+ :'rule' => :'TemplateResponseDocumentFieldGroupRule'
52
51
  }
53
52
  end
54
53
 
@@ -0,0 +1,263 @@
1
+ =begin
2
+ #Dropbox Sign API
3
+
4
+ #Dropbox Sign v3 API
5
+
6
+ The version of the OpenAPI document: 3.0.0
7
+ Contact: apisupport@hellosign.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Dropbox
17
+ end
18
+
19
+ module Dropbox::Sign
20
+ # The rule used to validate checkboxes in the form field group. See [checkbox field grouping](/api/reference/constants/#checkbox-field-grouping).
21
+ class TemplateResponseDocumentFieldGroupRule
22
+ # Examples: `require_0-1` `require_1` `require_1-ormore` - Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group.
23
+ # @return [String]
24
+ attr_accessor :requirement
25
+
26
+ # Name of the group
27
+ # @return [String]
28
+ attr_accessor :group_label
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'requirement' => :'requirement',
34
+ :'group_label' => :'groupLabel'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Returns attribute map of this model + parent
44
+ def self.merged_attributes
45
+ self.attribute_map
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'requirement' => :'String',
52
+ :'group_label' => :'String'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping of this model + parent
57
+ def self.merged_types
58
+ self.openapi_types
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Returns list of attributes with nullable: true of this model + parent
68
+ def self.merged_nullable
69
+ self.openapi_nullable
70
+ end
71
+
72
+ # Attempt to instantiate and hydrate a new instance of this class
73
+ # @param [Object] data Data to be converted
74
+ # @return [TemplateResponseDocumentFieldGroupRule]
75
+ def self.init(data)
76
+ return ApiClient.default.convert_to_type(
77
+ data,
78
+ "TemplateResponseDocumentFieldGroupRule"
79
+ ) || TemplateResponseDocumentFieldGroupRule.new
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateResponseDocumentFieldGroupRule` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.merged_attributes.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateResponseDocumentFieldGroupRule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'requirement')
98
+ self.requirement = attributes[:'requirement']
99
+ end
100
+
101
+ if attributes.key?(:'group_label')
102
+ self.group_label = attributes[:'group_label']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ requirement == o.requirement &&
125
+ group_label == o.group_label
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [requirement, group_label].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ attribute_map = self.class.merged_attributes
153
+
154
+ self.class.merged_types.each_pair do |key, type|
155
+ if type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
163
+ end
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :File
192
+ value
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ # models (e.g. Pet)
209
+ klass = Dropbox::Sign.const_get(type)
210
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash(include_nil = true)
229
+ hash = {}
230
+ self.class.merged_attributes.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ next unless include_nil
234
+ is_nullable = self.class.merged_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value, include_nil)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value, include_nil = true)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v, include_nil) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v, include_nil) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash(include_nil)
256
+ else
257
+ value
258
+ end
259
+ end
260
+
261
+ end
262
+
263
+ end