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