dropbox-sign 1.6.1 → 1.7.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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +15 -5
  4. data/VERSION +1 -1
  5. data/docs/AccountResponseQuotas.md +1 -1
  6. data/docs/FaxApi.md +364 -0
  7. data/docs/FaxGetResponse.md +11 -0
  8. data/docs/FaxListResponse.md +11 -0
  9. data/docs/FaxResponse.md +19 -0
  10. data/docs/FaxResponseTransmission.md +13 -0
  11. data/docs/FaxSendRequest.md +18 -0
  12. data/docs/OAuthTokenRefreshRequest.md +2 -0
  13. data/docs/SignatureRequestApi.md +1 -1
  14. data/docs/SubWhiteLabelingOptions.md +12 -12
  15. data/docs/TemplateApi.md +3 -3
  16. data/docs/TemplateResponse.md +2 -1
  17. data/docs/TemplateResponseDocumentFormFieldBase.md +0 -1
  18. data/docs/TemplateResponseDocumentFormFieldCheckbox.md +1 -0
  19. data/docs/TemplateResponseDocumentFormFieldDateSigned.md +1 -0
  20. data/docs/TemplateResponseDocumentFormFieldDropdown.md +1 -0
  21. data/docs/TemplateResponseDocumentFormFieldHyperlink.md +1 -0
  22. data/docs/TemplateResponseDocumentFormFieldInitials.md +1 -0
  23. data/docs/TemplateResponseDocumentFormFieldRadio.md +1 -0
  24. data/docs/TemplateResponseDocumentFormFieldSignature.md +1 -0
  25. data/docs/TemplateResponseDocumentFormFieldText.md +1 -0
  26. data/examples/FaxDelete.rb +14 -0
  27. data/examples/FaxFiles.rb +17 -0
  28. data/examples/FaxGet.rb +17 -0
  29. data/examples/FaxList.rb +18 -0
  30. data/examples/FaxSend.rb +25 -0
  31. data/lib/dropbox-sign/api/fax_api.rb +495 -0
  32. data/lib/dropbox-sign/api/o_auth_api.rb +28 -0
  33. data/lib/dropbox-sign/api/signature_request_api.rb +2 -2
  34. data/lib/dropbox-sign/api/template_api.rb +2 -2
  35. data/lib/dropbox-sign/models/account_response_quotas.rb +1 -1
  36. data/lib/dropbox-sign/models/api_app_response_o_auth.rb +2 -1
  37. data/lib/dropbox-sign/models/fax_get_response.rb +263 -0
  38. data/lib/dropbox-sign/models/fax_list_response.rb +267 -0
  39. data/lib/dropbox-sign/models/fax_response.rb +399 -0
  40. data/lib/dropbox-sign/models/fax_response_transmission.rb +328 -0
  41. data/lib/dropbox-sign/models/fax_send_request.rb +345 -0
  42. data/lib/dropbox-sign/models/o_auth_token_refresh_request.rb +26 -4
  43. data/lib/dropbox-sign/models/sub_white_labeling_options.rb +12 -12
  44. data/lib/dropbox-sign/models/template_response.rb +22 -13
  45. data/lib/dropbox-sign/models/template_response_document.rb +1 -2
  46. data/lib/dropbox-sign/models/template_response_document_form_field_base.rb +4 -16
  47. data/lib/dropbox-sign/models/template_response_document_form_field_checkbox.rb +16 -4
  48. data/lib/dropbox-sign/models/template_response_document_form_field_date_signed.rb +16 -4
  49. data/lib/dropbox-sign/models/template_response_document_form_field_dropdown.rb +16 -4
  50. data/lib/dropbox-sign/models/template_response_document_form_field_hyperlink.rb +16 -4
  51. data/lib/dropbox-sign/models/template_response_document_form_field_initials.rb +16 -4
  52. data/lib/dropbox-sign/models/template_response_document_form_field_radio.rb +20 -4
  53. data/lib/dropbox-sign/models/template_response_document_form_field_signature.rb +16 -4
  54. data/lib/dropbox-sign/models/template_response_document_form_field_text.rb +17 -5
  55. data/lib/dropbox-sign/version.rb +1 -1
  56. data/lib/dropbox-sign.rb +6 -0
  57. data/openapi-config.yaml +1 -1
  58. data/openapi-sdk.yaml +821 -112
  59. data/run-build +9 -0
  60. data/test_fixtures/ApiAppCreateRequest.json +10 -10
  61. data/test_fixtures/ApiAppGetResponse.json +18 -3
  62. data/test_fixtures/ApiAppListResponse.json +7 -1
  63. data/test_fixtures/ApiAppUpdateRequest.json +11 -11
  64. data/test_fixtures/FaxGetResponse.json +23 -0
  65. data/test_fixtures/FaxListResponse.json +31 -0
  66. data/test_fixtures/FaxSendRequest.json +14 -0
  67. data/test_fixtures/FaxSendResponse.json +16 -0
  68. data/test_fixtures/TeamGetResponse.json +5 -0
  69. data/test_fixtures/TemplateGetResponse.json +25 -478
  70. data/test_fixtures/TemplateListResponse.json +34 -5
  71. metadata +29 -8
@@ -0,0 +1,328 @@
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
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Dropbox
17
+ end
18
+
19
+ module Dropbox::Sign
20
+ class FaxResponseTransmission
21
+ # Fax Transmission Recipient
22
+ # @return [String]
23
+ attr_accessor :recipient
24
+
25
+ # Fax Transmission Sender
26
+ # @return [String]
27
+ attr_accessor :sender
28
+
29
+ # Fax Transmission Status Code
30
+ # @return [String]
31
+ attr_accessor :status_code
32
+
33
+ # Fax Transmission Sent Timestamp
34
+ # @return [Integer]
35
+ attr_accessor :sent_at
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'recipient' => :'recipient',
63
+ :'sender' => :'sender',
64
+ :'status_code' => :'status_code',
65
+ :'sent_at' => :'sent_at'
66
+ }
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'recipient' => :'String',
78
+ :'sender' => :'String',
79
+ :'status_code' => :'String',
80
+ :'sent_at' => :'Integer'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Returns attribute map of this model + parent
91
+ def self.merged_attributes
92
+ self.attribute_map
93
+ end
94
+
95
+ # Attribute type mapping of this model + parent
96
+ def self.merged_types
97
+ self.openapi_types
98
+ end
99
+
100
+ # Returns list of attributes with nullable: true of this model + parent
101
+ def self.merged_nullable
102
+ self.openapi_nullable
103
+ end
104
+
105
+ # Attempt to instantiate and hydrate a new instance of this class
106
+ # @param [Object] data Data to be converted
107
+ # @return [FaxResponseTransmission]
108
+ def self.init(data)
109
+ ApiClient.default.convert_to_type(
110
+ data,
111
+ "FaxResponseTransmission"
112
+ ) || FaxResponseTransmission.new
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::FaxResponseTransmission` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!self.class.merged_attributes.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::FaxResponseTransmission`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'recipient')
131
+ self.recipient = attributes[:'recipient']
132
+ end
133
+
134
+ if attributes.key?(:'sender')
135
+ self.sender = attributes[:'sender']
136
+ end
137
+
138
+ if attributes.key?(:'status_code')
139
+ self.status_code = attributes[:'status_code']
140
+ end
141
+
142
+ if attributes.key?(:'sent_at')
143
+ self.sent_at = attributes[:'sent_at']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ if @recipient.nil?
152
+ invalid_properties.push('invalid value for "recipient", recipient cannot be nil.')
153
+ end
154
+
155
+ if @sender.nil?
156
+ invalid_properties.push('invalid value for "sender", sender cannot be nil.')
157
+ end
158
+
159
+ if @status_code.nil?
160
+ invalid_properties.push('invalid value for "status_code", status_code cannot be nil.')
161
+ end
162
+
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ return false if @recipient.nil?
170
+ return false if @sender.nil?
171
+ return false if @status_code.nil?
172
+ status_code_validator = EnumAttributeValidator.new('String', ["success", "transmitting", "error_could_not_fax", "error_unknown", "error_busy", "error_no_answer", "error_disconnected", "error_bad_destination"])
173
+ return false unless status_code_validator.valid?(@status_code)
174
+ true
175
+ end
176
+
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] status_code Object to be assigned
179
+ def status_code=(status_code)
180
+ validator = EnumAttributeValidator.new('String', ["success", "transmitting", "error_could_not_fax", "error_unknown", "error_busy", "error_no_answer", "error_disconnected", "error_bad_destination"])
181
+ unless validator.valid?(status_code)
182
+ fail ArgumentError, "invalid value for \"status_code\", must be one of #{validator.allowable_values}."
183
+ end
184
+ @status_code = status_code
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ recipient == o.recipient &&
193
+ sender == o.sender &&
194
+ status_code == o.status_code &&
195
+ sent_at == o.sent_at
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [recipient, sender, status_code, sent_at].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ new.build_from_hash(attributes)
215
+ end
216
+
217
+ # Builds the object from hash
218
+ # @param [Hash] attributes Model attributes in the form of hash
219
+ # @return [Object] Returns the model itself
220
+ def build_from_hash(attributes)
221
+ return nil unless attributes.is_a?(Hash)
222
+ attribute_map = self.class.merged_attributes
223
+
224
+ self.class.merged_types.each_pair do |key, type|
225
+ if type =~ /\AArray<(.*)>/i
226
+ # check to ensure the input is an array given that the attribute
227
+ # is documented as an array but the input is not
228
+ if attributes[attribute_map[key]].is_a?(Array)
229
+ self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
230
+ end
231
+ elsif !attributes[attribute_map[key]].nil?
232
+ self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
233
+ end
234
+ end
235
+
236
+ self
237
+ end
238
+
239
+ # Deserializes the data based on type
240
+ # @param string type Data type
241
+ # @param string value Value to be deserialized
242
+ # @return [Object] Deserialized data
243
+ def _deserialize(type, value)
244
+ case type.to_sym
245
+ when :Time
246
+ Time.parse(value)
247
+ when :Date
248
+ Date.parse(value)
249
+ when :String
250
+ value.to_s
251
+ when :Integer
252
+ value.to_i
253
+ when :Float
254
+ value.to_f
255
+ when :Boolean
256
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
257
+ true
258
+ else
259
+ false
260
+ end
261
+ when :Object
262
+ # generic object (usually a Hash), return directly
263
+ value
264
+ when /\AArray<(?<inner_type>.+)>\z/
265
+ inner_type = Regexp.last_match[:inner_type]
266
+ value.map { |v| _deserialize(inner_type, v) }
267
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
268
+ k_type = Regexp.last_match[:k_type]
269
+ v_type = Regexp.last_match[:v_type]
270
+ {}.tap do |hash|
271
+ value.each do |k, v|
272
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
273
+ end
274
+ end
275
+ else # model
276
+ klass = Dropbox::Sign.const_get(type)
277
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_hash
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash(include_nil = true)
296
+ hash = {}
297
+ self.class.merged_attributes.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ next unless include_nil
301
+ is_nullable = self.class.merged_nullable.include?(attr)
302
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
303
+ end
304
+
305
+ hash[param] = _to_hash(value, include_nil)
306
+ end
307
+ hash
308
+ end
309
+
310
+ # Outputs non-array value in the form of hash
311
+ # For object, use to_hash. Otherwise, just return the value
312
+ # @param [Object] value Any valid value
313
+ # @return [Hash] Returns the value in the form of hash
314
+ def _to_hash(value, include_nil = true)
315
+ if value.is_a?(Array)
316
+ value.compact.map { |v| _to_hash(v, include_nil) }
317
+ elsif value.is_a?(Hash)
318
+ {}.tap do |hash|
319
+ value.each { |k, v| hash[k] = _to_hash(v, include_nil) }
320
+ end
321
+ elsif value.respond_to? :to_hash
322
+ value.to_hash(include_nil)
323
+ else
324
+ value
325
+ end
326
+ end
327
+ end
328
+ end
@@ -0,0 +1,345 @@
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
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Dropbox
17
+ end
18
+
19
+ module Dropbox::Sign
20
+ class FaxSendRequest
21
+ # Fax Send To Recipient
22
+ # @return [String]
23
+ attr_accessor :recipient
24
+
25
+ # Fax Send From Sender (used only with fax number)
26
+ # @return [String]
27
+ attr_accessor :sender
28
+
29
+ # Fax File to Send
30
+ # @return [Array<File>]
31
+ attr_accessor :files
32
+
33
+ # Fax File URL to Send
34
+ # @return [Array<String>]
35
+ attr_accessor :file_urls
36
+
37
+ # API Test Mode Setting
38
+ # @return [Boolean]
39
+ attr_accessor :test_mode
40
+
41
+ # Fax Cover Page for Recipient
42
+ # @return [String]
43
+ attr_accessor :cover_page_to
44
+
45
+ # Fax Cover Page for Sender
46
+ # @return [String]
47
+ attr_accessor :cover_page_from
48
+
49
+ # Fax Cover Page Message
50
+ # @return [String]
51
+ attr_accessor :cover_page_message
52
+
53
+ # Fax Title
54
+ # @return [String]
55
+ attr_accessor :title
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'recipient' => :'recipient',
61
+ :'sender' => :'sender',
62
+ :'files' => :'files',
63
+ :'file_urls' => :'file_urls',
64
+ :'test_mode' => :'test_mode',
65
+ :'cover_page_to' => :'cover_page_to',
66
+ :'cover_page_from' => :'cover_page_from',
67
+ :'cover_page_message' => :'cover_page_message',
68
+ :'title' => :'title'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'recipient' => :'String',
81
+ :'sender' => :'String',
82
+ :'files' => :'Array<File>',
83
+ :'file_urls' => :'Array<String>',
84
+ :'test_mode' => :'Boolean',
85
+ :'cover_page_to' => :'String',
86
+ :'cover_page_from' => :'String',
87
+ :'cover_page_message' => :'String',
88
+ :'title' => :'String'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
98
+ # Returns attribute map of this model + parent
99
+ def self.merged_attributes
100
+ self.attribute_map
101
+ end
102
+
103
+ # Attribute type mapping of this model + parent
104
+ def self.merged_types
105
+ self.openapi_types
106
+ end
107
+
108
+ # Returns list of attributes with nullable: true of this model + parent
109
+ def self.merged_nullable
110
+ self.openapi_nullable
111
+ end
112
+
113
+ # Attempt to instantiate and hydrate a new instance of this class
114
+ # @param [Object] data Data to be converted
115
+ # @return [FaxSendRequest]
116
+ def self.init(data)
117
+ ApiClient.default.convert_to_type(
118
+ data,
119
+ "FaxSendRequest"
120
+ ) || FaxSendRequest.new
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ if (!attributes.is_a?(Hash))
127
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::FaxSendRequest` initialize method"
128
+ end
129
+
130
+ # check to see if the attribute exists and convert string to symbol for hash key
131
+ attributes = attributes.each_with_object({}) { |(k, v), h|
132
+ if (!self.class.merged_attributes.key?(k.to_sym))
133
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::FaxSendRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
134
+ end
135
+ h[k.to_sym] = v
136
+ }
137
+
138
+ if attributes.key?(:'recipient')
139
+ self.recipient = attributes[:'recipient']
140
+ end
141
+
142
+ if attributes.key?(:'sender')
143
+ self.sender = attributes[:'sender']
144
+ end
145
+
146
+ if attributes.key?(:'files')
147
+ if (value = attributes[:'files']).is_a?(Array)
148
+ self.files = value
149
+ end
150
+ end
151
+
152
+ if attributes.key?(:'file_urls')
153
+ if (value = attributes[:'file_urls']).is_a?(Array)
154
+ self.file_urls = value
155
+ end
156
+ end
157
+
158
+ if attributes.key?(:'test_mode')
159
+ self.test_mode = attributes[:'test_mode']
160
+ else
161
+ self.test_mode = false
162
+ end
163
+
164
+ if attributes.key?(:'cover_page_to')
165
+ self.cover_page_to = attributes[:'cover_page_to']
166
+ end
167
+
168
+ if attributes.key?(:'cover_page_from')
169
+ self.cover_page_from = attributes[:'cover_page_from']
170
+ end
171
+
172
+ if attributes.key?(:'cover_page_message')
173
+ self.cover_page_message = attributes[:'cover_page_message']
174
+ end
175
+
176
+ if attributes.key?(:'title')
177
+ self.title = attributes[:'title']
178
+ end
179
+ end
180
+
181
+ # Show invalid properties with the reasons. Usually used together with valid?
182
+ # @return Array for valid properties with the reasons
183
+ def list_invalid_properties
184
+ invalid_properties = Array.new
185
+ if @recipient.nil?
186
+ invalid_properties.push('invalid value for "recipient", recipient cannot be nil.')
187
+ end
188
+
189
+ invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ return false if @recipient.nil?
196
+ true
197
+ end
198
+
199
+ # Checks equality by comparing each attribute.
200
+ # @param [Object] Object to be compared
201
+ def ==(o)
202
+ return true if self.equal?(o)
203
+ self.class == o.class &&
204
+ recipient == o.recipient &&
205
+ sender == o.sender &&
206
+ files == o.files &&
207
+ file_urls == o.file_urls &&
208
+ test_mode == o.test_mode &&
209
+ cover_page_to == o.cover_page_to &&
210
+ cover_page_from == o.cover_page_from &&
211
+ cover_page_message == o.cover_page_message &&
212
+ title == o.title
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [recipient, sender, files, file_urls, test_mode, cover_page_to, cover_page_from, cover_page_message, title].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ new.build_from_hash(attributes)
232
+ end
233
+
234
+ # Builds the object from hash
235
+ # @param [Hash] attributes Model attributes in the form of hash
236
+ # @return [Object] Returns the model itself
237
+ def build_from_hash(attributes)
238
+ return nil unless attributes.is_a?(Hash)
239
+ attribute_map = self.class.merged_attributes
240
+
241
+ self.class.merged_types.each_pair do |key, type|
242
+ if type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[attribute_map[key]].is_a?(Array)
246
+ self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
247
+ end
248
+ elsif !attributes[attribute_map[key]].nil?
249
+ self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
250
+ end
251
+ end
252
+
253
+ self
254
+ end
255
+
256
+ # Deserializes the data based on type
257
+ # @param string type Data type
258
+ # @param string value Value to be deserialized
259
+ # @return [Object] Deserialized data
260
+ def _deserialize(type, value)
261
+ case type.to_sym
262
+ when :Time
263
+ Time.parse(value)
264
+ when :Date
265
+ Date.parse(value)
266
+ when :String
267
+ value.to_s
268
+ when :Integer
269
+ value.to_i
270
+ when :Float
271
+ value.to_f
272
+ when :Boolean
273
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
274
+ true
275
+ else
276
+ false
277
+ end
278
+ when :Object
279
+ # generic object (usually a Hash), return directly
280
+ value
281
+ when /\AArray<(?<inner_type>.+)>\z/
282
+ inner_type = Regexp.last_match[:inner_type]
283
+ value.map { |v| _deserialize(inner_type, v) }
284
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
285
+ k_type = Regexp.last_match[:k_type]
286
+ v_type = Regexp.last_match[:v_type]
287
+ {}.tap do |hash|
288
+ value.each do |k, v|
289
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
290
+ end
291
+ end
292
+ else # model
293
+ klass = Dropbox::Sign.const_get(type)
294
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
295
+ end
296
+ end
297
+
298
+ # Returns the string representation of the object
299
+ # @return [String] String presentation of the object
300
+ def to_s
301
+ to_hash.to_s
302
+ end
303
+
304
+ # to_body is an alias to to_hash (backward compatibility)
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_body
307
+ to_hash
308
+ end
309
+
310
+ # Returns the object in the form of hash
311
+ # @return [Hash] Returns the object in the form of hash
312
+ def to_hash(include_nil = true)
313
+ hash = {}
314
+ self.class.merged_attributes.each_pair do |attr, param|
315
+ value = self.send(attr)
316
+ if value.nil?
317
+ next unless include_nil
318
+ is_nullable = self.class.merged_nullable.include?(attr)
319
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
+ end
321
+
322
+ hash[param] = _to_hash(value, include_nil)
323
+ end
324
+ hash
325
+ end
326
+
327
+ # Outputs non-array value in the form of hash
328
+ # For object, use to_hash. Otherwise, just return the value
329
+ # @param [Object] value Any valid value
330
+ # @return [Hash] Returns the value in the form of hash
331
+ def _to_hash(value, include_nil = true)
332
+ if value.is_a?(Array)
333
+ value.compact.map { |v| _to_hash(v, include_nil) }
334
+ elsif value.is_a?(Hash)
335
+ {}.tap do |hash|
336
+ value.each { |k, v| hash[k] = _to_hash(v, include_nil) }
337
+ end
338
+ elsif value.respond_to? :to_hash
339
+ value.to_hash(include_nil)
340
+ else
341
+ value
342
+ end
343
+ end
344
+ end
345
+ end