dropbox-sign 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) 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/SignatureRequestCreateEmbeddedRequest.md +1 -1
  7. data/docs/TeamResponse.md +1 -0
  8. data/docs/TemplateResponse.md +2 -2
  9. data/docs/TemplateResponseDocument.md +3 -3
  10. data/docs/{TemplateResponseCustomField.md → TemplateResponseDocumentCustomFieldBase.md} +5 -8
  11. data/docs/TemplateResponseDocumentCustomFieldCheckbox.md +10 -0
  12. data/docs/TemplateResponseDocumentCustomFieldText.md +14 -0
  13. data/docs/TemplateResponseDocumentFieldGroup.md +1 -1
  14. data/docs/TemplateResponseDocumentFieldGroupRule.md +11 -0
  15. data/docs/{TemplateResponseDocumentFormField.md → TemplateResponseDocumentFormFieldBase.md} +4 -8
  16. data/docs/TemplateResponseDocumentFormFieldCheckbox.md +10 -0
  17. data/docs/TemplateResponseDocumentFormFieldDateSigned.md +10 -0
  18. data/docs/TemplateResponseDocumentFormFieldDropdown.md +10 -0
  19. data/docs/TemplateResponseDocumentFormFieldHyperlink.md +14 -0
  20. data/docs/TemplateResponseDocumentFormFieldInitials.md +10 -0
  21. data/docs/TemplateResponseDocumentFormFieldRadio.md +10 -0
  22. data/docs/TemplateResponseDocumentFormFieldSignature.md +10 -0
  23. data/docs/TemplateResponseDocumentFormFieldText.md +15 -0
  24. data/docs/{TemplateResponseDocumentStaticField.md → TemplateResponseDocumentStaticFieldBase.md} +5 -5
  25. data/docs/TemplateResponseDocumentStaticFieldCheckbox.md +10 -0
  26. data/docs/TemplateResponseDocumentStaticFieldDateSigned.md +10 -0
  27. data/docs/TemplateResponseDocumentStaticFieldDropdown.md +10 -0
  28. data/docs/TemplateResponseDocumentStaticFieldHyperlink.md +10 -0
  29. data/docs/TemplateResponseDocumentStaticFieldInitials.md +10 -0
  30. data/docs/TemplateResponseDocumentStaticFieldRadio.md +10 -0
  31. data/docs/TemplateResponseDocumentStaticFieldSignature.md +10 -0
  32. data/docs/TemplateResponseDocumentStaticFieldText.md +10 -0
  33. data/docs/TemplateResponseFieldAvgTextLength.md +1 -1
  34. data/lib/dropbox-sign/api/bulk_send_job_api.rb +6 -0
  35. data/lib/dropbox-sign/models/signature_request_create_embedded_request.rb +1 -1
  36. data/lib/dropbox-sign/models/team_response.rb +17 -4
  37. data/lib/dropbox-sign/models/template_response.rb +5 -5
  38. data/lib/dropbox-sign/models/template_response_document.rb +9 -9
  39. data/lib/dropbox-sign/models/{template_response_document_static_field.rb → template_response_document_custom_field_base.rb} +60 -39
  40. data/lib/dropbox-sign/models/template_response_document_custom_field_checkbox.rb +263 -0
  41. data/lib/dropbox-sign/models/template_response_document_custom_field_text.rb +306 -0
  42. data/lib/dropbox-sign/models/template_response_document_field_group.rb +2 -3
  43. data/lib/dropbox-sign/models/template_response_document_field_group_rule.rb +263 -0
  44. data/lib/dropbox-sign/models/{template_response_named_form_field.rb → template_response_document_form_field_base.rb} +78 -86
  45. data/lib/dropbox-sign/models/template_response_document_form_field_checkbox.rb +263 -0
  46. data/lib/dropbox-sign/models/template_response_document_form_field_date_signed.rb +263 -0
  47. data/lib/dropbox-sign/models/template_response_document_form_field_dropdown.rb +263 -0
  48. data/lib/dropbox-sign/models/template_response_document_form_field_hyperlink.rb +306 -0
  49. data/lib/dropbox-sign/models/template_response_document_form_field_initials.rb +263 -0
  50. data/lib/dropbox-sign/models/template_response_document_form_field_radio.rb +263 -0
  51. data/lib/dropbox-sign/models/template_response_document_form_field_signature.rb +263 -0
  52. data/lib/dropbox-sign/models/{template_response_document_form_field.rb → template_response_document_form_field_text.rb} +53 -132
  53. data/lib/dropbox-sign/models/{template_response_custom_field.rb → template_response_document_static_field_base.rb} +90 -119
  54. data/lib/dropbox-sign/models/template_response_document_static_field_checkbox.rb +263 -0
  55. data/lib/dropbox-sign/models/template_response_document_static_field_date_signed.rb +263 -0
  56. data/lib/dropbox-sign/models/template_response_document_static_field_dropdown.rb +263 -0
  57. data/lib/dropbox-sign/models/template_response_document_static_field_hyperlink.rb +263 -0
  58. data/lib/dropbox-sign/models/template_response_document_static_field_initials.rb +263 -0
  59. data/lib/dropbox-sign/models/template_response_document_static_field_radio.rb +263 -0
  60. data/lib/dropbox-sign/models/template_response_document_static_field_signature.rb +263 -0
  61. data/lib/dropbox-sign/models/template_response_document_static_field_text.rb +263 -0
  62. data/lib/dropbox-sign/models/template_response_field_avg_text_length.rb +1 -1
  63. data/lib/dropbox-sign/version.rb +1 -1
  64. data/lib/dropbox-sign.rb +22 -5
  65. data/openapi-config.yaml +1 -1
  66. data/openapi-sdk.yaml +586 -182
  67. data/test_fixtures/AccountCreateResponse.json +1 -0
  68. data/test_fixtures/ApiAppGetResponse.json +1 -0
  69. data/test_fixtures/ApiAppListResponse.json +1 -0
  70. data/test_fixtures/BulkSendJobGetResponse.json +8 -3
  71. data/test_fixtures/SignatureRequestGetResponse.json +65 -65
  72. data/test_fixtures/SignatureRequestListResponse.json +11 -4
  73. data/test_fixtures/TemplateGetResponse.json +1002 -41
  74. data/test_fixtures/TemplateListResponse.json +483 -44
  75. metadata +52 -18
  76. data/docs/TemplateResponseDocumentCustomField.md +0 -25
  77. data/docs/TemplateResponseNamedFormField.md +0 -23
  78. data/lib/dropbox-sign/models/template_response_document_custom_field.rb +0 -454
@@ -30,12 +30,17 @@ module Dropbox::Sign
30
30
  # @return [Array<AccountResponse>]
31
31
  attr_accessor :invited_accounts
32
32
 
33
+ # A list of email addresses that have an outstanding invitation to join your Team and do not yet have a Dropbox Sign account.
34
+ # @return [Array<String>]
35
+ attr_accessor :invited_emails
36
+
33
37
  # Attribute mapping from ruby-style variable name to JSON key.
34
38
  def self.attribute_map
35
39
  {
36
40
  :'name' => :'name',
37
41
  :'accounts' => :'accounts',
38
- :'invited_accounts' => :'invited_accounts'
42
+ :'invited_accounts' => :'invited_accounts',
43
+ :'invited_emails' => :'invited_emails'
39
44
  }
40
45
  end
41
46
 
@@ -54,7 +59,8 @@ module Dropbox::Sign
54
59
  {
55
60
  :'name' => :'String',
56
61
  :'accounts' => :'Array<AccountResponse>',
57
- :'invited_accounts' => :'Array<AccountResponse>'
62
+ :'invited_accounts' => :'Array<AccountResponse>',
63
+ :'invited_emails' => :'Array<String>'
58
64
  }
59
65
  end
60
66
 
@@ -114,6 +120,12 @@ module Dropbox::Sign
114
120
  self.invited_accounts = value
115
121
  end
116
122
  end
123
+
124
+ if attributes.key?(:'invited_emails')
125
+ if (value = attributes[:'invited_emails']).is_a?(Array)
126
+ self.invited_emails = value
127
+ end
128
+ end
117
129
  end
118
130
 
119
131
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -136,7 +148,8 @@ module Dropbox::Sign
136
148
  self.class == o.class &&
137
149
  name == o.name &&
138
150
  accounts == o.accounts &&
139
- invited_accounts == o.invited_accounts
151
+ invited_accounts == o.invited_accounts &&
152
+ invited_emails == o.invited_emails
140
153
  end
141
154
 
142
155
  # @see the `==` method
@@ -148,7 +161,7 @@ module Dropbox::Sign
148
161
  # Calculates hash code according to all attributes.
149
162
  # @return [Integer] Hash code
150
163
  def hash
151
- [name, accounts, invited_accounts].hash
164
+ [name, accounts, invited_accounts, invited_emails].hash
152
165
  end
153
166
 
154
167
  # Builds the object from hash
@@ -67,12 +67,12 @@ module Dropbox::Sign
67
67
  # @return [Array<TemplateResponseDocument>]
68
68
  attr_accessor :documents
69
69
 
70
- # An array of Custom Field objects.
71
- # @return [Array<TemplateResponseCustomField>, nil]
70
+ # Deprecated. Use `custom_fields` inside the [documents](https://developers.hellosign.com/api/reference/operation/templateGet/#!c=200&path=template/documents&t=response) array instead.
71
+ # @return [Array<TemplateResponseDocumentCustomFieldBase>, nil]
72
72
  attr_accessor :custom_fields
73
73
 
74
74
  # Deprecated. Use `form_fields` inside the [documents](https://developers.hellosign.com/api/reference/operation/templateGet/#!c=200&path=template/documents&t=response) array instead.
75
- # @return [Array<TemplateResponseNamedFormField>, nil]
75
+ # @return [Array<TemplateResponseDocumentFormFieldBase>, nil]
76
76
  attr_accessor :named_form_fields
77
77
 
78
78
  # An array of the Accounts that can use this Template.
@@ -125,8 +125,8 @@ module Dropbox::Sign
125
125
  :'signer_roles' => :'Array<TemplateResponseSignerRole>',
126
126
  :'cc_roles' => :'Array<TemplateResponseCCRole>',
127
127
  :'documents' => :'Array<TemplateResponseDocument>',
128
- :'custom_fields' => :'Array<TemplateResponseCustomField>',
129
- :'named_form_fields' => :'Array<TemplateResponseNamedFormField>',
128
+ :'custom_fields' => :'Array<TemplateResponseDocumentCustomFieldBase>',
129
+ :'named_form_fields' => :'Array<TemplateResponseDocumentFormFieldBase>',
130
130
  :'accounts' => :'Array<TemplateResponseAccount>'
131
131
  }
132
132
  end
@@ -30,16 +30,16 @@ module Dropbox::Sign
30
30
  # @return [Array<TemplateResponseDocumentFieldGroup>]
31
31
  attr_accessor :field_groups
32
32
 
33
- # An array of Form Field objects containing the name and type of each named textbox and checkmark field.
34
- # @return [Array<TemplateResponseDocumentFormField>]
33
+ # An array of Form Field objects containing the name and type of each named field.
34
+ # @return [Array<TemplateResponseDocumentFormFieldBase>]
35
35
  attr_accessor :form_fields
36
36
 
37
- # An array of Document Custom Field objects.
38
- # @return [Array<TemplateResponseDocumentCustomField>]
37
+ # An array of Form Field objects containing the name and type of each named field.
38
+ # @return [Array<TemplateResponseDocumentCustomFieldBase>]
39
39
  attr_accessor :custom_fields
40
40
 
41
- # An array describing static overlay fields. <b>Note</b> only available for certain subscriptions.
42
- # @return [Array<TemplateResponseDocumentStaticField>, nil]
41
+ # An array describing static overlay fields. **Note** only available for certain subscriptions.
42
+ # @return [Array<TemplateResponseDocumentStaticFieldBase>, nil]
43
43
  attr_accessor :static_fields
44
44
 
45
45
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -70,9 +70,9 @@ module Dropbox::Sign
70
70
  :'name' => :'String',
71
71
  :'index' => :'Integer',
72
72
  :'field_groups' => :'Array<TemplateResponseDocumentFieldGroup>',
73
- :'form_fields' => :'Array<TemplateResponseDocumentFormField>',
74
- :'custom_fields' => :'Array<TemplateResponseDocumentCustomField>',
75
- :'static_fields' => :'Array<TemplateResponseDocumentStaticField>'
73
+ :'form_fields' => :'Array<TemplateResponseDocumentFormFieldBase>',
74
+ :'custom_fields' => :'Array<TemplateResponseDocumentCustomFieldBase>',
75
+ :'static_fields' => :'Array<TemplateResponseDocumentStaticFieldBase>'
76
76
  }
77
77
  end
78
78
 
@@ -17,32 +17,36 @@ module Dropbox
17
17
  end
18
18
 
19
19
  module Dropbox::Sign
20
- class TemplateResponseDocumentStaticField
21
- # The name of the static field.
20
+ # An array of Form Field objects containing the name and type of each named field.
21
+ class TemplateResponseDocumentCustomFieldBase
22
22
  # @return [String]
23
- attr_accessor :name
23
+ attr_accessor :type
24
24
 
25
- # The type of this static field. See [field types](/api/reference/constants/#field-types).
25
+ # The unique ID for this field.
26
26
  # @return [String]
27
- attr_accessor :type
27
+ attr_accessor :api_id
28
28
 
29
- # The signer of the Static Field.
29
+ # The name of the Custom Field.
30
30
  # @return [String]
31
+ attr_accessor :name
32
+
33
+ # The signer of the Custom Field. Can be `null` if field is a merge field (assigned to Sender).
34
+ # @return [String, nil]
31
35
  attr_accessor :signer
32
36
 
33
- # The horizontal offset in pixels for this static field.
37
+ # The horizontal offset in pixels for this form field.
34
38
  # @return [Integer]
35
39
  attr_accessor :x
36
40
 
37
- # The vertical offset in pixels for this static field.
41
+ # The vertical offset in pixels for this form field.
38
42
  # @return [Integer]
39
43
  attr_accessor :y
40
44
 
41
- # The width in pixels of this static field.
45
+ # The width in pixels of this form field.
42
46
  # @return [Integer]
43
47
  attr_accessor :width
44
48
 
45
- # The height in pixels of this static field.
49
+ # The height in pixels of this form field.
46
50
  # @return [Integer]
47
51
  attr_accessor :height
48
52
 
@@ -50,10 +54,6 @@ module Dropbox::Sign
50
54
  # @return [Boolean]
51
55
  attr_accessor :required
52
56
 
53
- # A unique id for the static field.
54
- # @return [String]
55
- attr_accessor :api_id
56
-
57
57
  # The name of the group this field is in. If this field is not a group, this defaults to `null`.
58
58
  # @return [String, nil]
59
59
  attr_accessor :group
@@ -61,15 +61,15 @@ module Dropbox::Sign
61
61
  # Attribute mapping from ruby-style variable name to JSON key.
62
62
  def self.attribute_map
63
63
  {
64
- :'name' => :'name',
65
64
  :'type' => :'type',
65
+ :'api_id' => :'api_id',
66
+ :'name' => :'name',
66
67
  :'signer' => :'signer',
67
68
  :'x' => :'x',
68
69
  :'y' => :'y',
69
70
  :'width' => :'width',
70
71
  :'height' => :'height',
71
72
  :'required' => :'required',
72
- :'api_id' => :'api_id',
73
73
  :'group' => :'group'
74
74
  }
75
75
  end
@@ -87,15 +87,15 @@ module Dropbox::Sign
87
87
  # Attribute type mapping.
88
88
  def self.openapi_types
89
89
  {
90
- :'name' => :'String',
91
90
  :'type' => :'String',
91
+ :'api_id' => :'String',
92
+ :'name' => :'String',
92
93
  :'signer' => :'String',
93
94
  :'x' => :'Integer',
94
95
  :'y' => :'Integer',
95
96
  :'width' => :'Integer',
96
97
  :'height' => :'Integer',
97
98
  :'required' => :'Boolean',
98
- :'api_id' => :'String',
99
99
  :'group' => :'String'
100
100
  }
101
101
  end
@@ -108,6 +108,7 @@ module Dropbox::Sign
108
108
  # List of attributes with nullable: true
109
109
  def self.openapi_nullable
110
110
  Set.new([
111
+ :'signer',
111
112
  :'group'
112
113
  ])
113
114
  end
@@ -117,39 +118,51 @@ module Dropbox::Sign
117
118
  self.openapi_nullable
118
119
  end
119
120
 
120
- # Attempt to instantiate and hydrate a new instance of this class
121
- # @param [Object] data Data to be converted
122
- # @return [TemplateResponseDocumentStaticField]
123
- def self.init(data)
124
- return ApiClient.default.convert_to_type(
125
- data,
126
- "TemplateResponseDocumentStaticField"
127
- ) || TemplateResponseDocumentStaticField.new
121
+ # discriminator's property name in OpenAPI v3
122
+ def self.openapi_discriminator_name
123
+ :'type'
124
+ end
125
+
126
+ def self.discriminator_class_name(value)
127
+ return nil unless value.is_a?(String)
128
+
129
+ if value == 'checkbox'
130
+ return "Dropbox::Sign::TemplateResponseDocumentCustomFieldCheckbox"
131
+ end
132
+ if value == 'text'
133
+ return "Dropbox::Sign::TemplateResponseDocumentCustomFieldText"
134
+ end
135
+
136
+ return nil
128
137
  end
129
138
 
130
139
  # Initializes the object
131
140
  # @param [Hash] attributes Model attributes in the form of hash
132
141
  def initialize(attributes = {})
133
142
  if (!attributes.is_a?(Hash))
134
- fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateResponseDocumentStaticField` initialize method"
143
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateResponseDocumentCustomFieldBase` initialize method"
135
144
  end
136
145
 
137
146
  # check to see if the attribute exists and convert string to symbol for hash key
138
147
  attributes = attributes.each_with_object({}) { |(k, v), h|
139
148
  if (!self.class.merged_attributes.key?(k.to_sym))
140
- fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateResponseDocumentStaticField`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
149
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateResponseDocumentCustomFieldBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
141
150
  end
142
151
  h[k.to_sym] = v
143
152
  }
144
153
 
145
- if attributes.key?(:'name')
146
- self.name = attributes[:'name']
147
- end
148
-
149
154
  if attributes.key?(:'type')
150
155
  self.type = attributes[:'type']
151
156
  end
152
157
 
158
+ if attributes.key?(:'api_id')
159
+ self.api_id = attributes[:'api_id']
160
+ end
161
+
162
+ if attributes.key?(:'name')
163
+ self.name = attributes[:'name']
164
+ end
165
+
153
166
  if attributes.key?(:'signer')
154
167
  self.signer = attributes[:'signer']
155
168
  end
@@ -174,10 +187,6 @@ module Dropbox::Sign
174
187
  self.required = attributes[:'required']
175
188
  end
176
189
 
177
- if attributes.key?(:'api_id')
178
- self.api_id = attributes[:'api_id']
179
- end
180
-
181
190
  if attributes.key?(:'group')
182
191
  self.group = attributes[:'group']
183
192
  end
@@ -187,12 +196,17 @@ module Dropbox::Sign
187
196
  # @return Array for valid properties with the reasons
188
197
  def list_invalid_properties
189
198
  invalid_properties = Array.new
199
+ if @type.nil?
200
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
201
+ end
202
+
190
203
  invalid_properties
191
204
  end
192
205
 
193
206
  # Check to see if the all the properties in the model are valid
194
207
  # @return true if the model is valid
195
208
  def valid?
209
+ return false if @type.nil?
196
210
  true
197
211
  end
198
212
 
@@ -201,15 +215,15 @@ module Dropbox::Sign
201
215
  def ==(o)
202
216
  return true if self.equal?(o)
203
217
  self.class == o.class &&
204
- name == o.name &&
205
218
  type == o.type &&
219
+ api_id == o.api_id &&
220
+ name == o.name &&
206
221
  signer == o.signer &&
207
222
  x == o.x &&
208
223
  y == o.y &&
209
224
  width == o.width &&
210
225
  height == o.height &&
211
226
  required == o.required &&
212
- api_id == o.api_id &&
213
227
  group == o.group
214
228
  end
215
229
 
@@ -222,13 +236,20 @@ module Dropbox::Sign
222
236
  # Calculates hash code according to all attributes.
223
237
  # @return [Integer] Hash code
224
238
  def hash
225
- [name, type, signer, x, y, width, height, required, api_id, group].hash
239
+ [type, api_id, name, signer, x, y, width, height, required, group].hash
226
240
  end
227
241
 
228
242
  # Builds the object from hash
229
243
  # @param [Hash] attributes Model attributes in the form of hash
230
244
  # @return [Object] Returns the model itself
231
245
  def self.build_from_hash(attributes)
246
+ if !attributes[self.openapi_discriminator_name].nil?
247
+ klass = self.discriminator_class_name(attributes[self.openapi_discriminator_name])
248
+ if klass != new.class.to_s
249
+ obj = Object.const_get(klass).new.build_from_hash(attributes)
250
+ return obj
251
+ end
252
+ end
232
253
  new.build_from_hash(attributes)
233
254
  end
234
255
 
@@ -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
+ # This class extends `TemplateResponseDocumentCustomFieldBase`
21
+ class TemplateResponseDocumentCustomFieldCheckbox < 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
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'type' => :'type'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about, including the ones defined in its parent(s)
34
+ def self.acceptable_attributes
35
+ attribute_map.values.concat(superclass.acceptable_attributes)
36
+ end
37
+
38
+ # Returns attribute map of this model + parent
39
+ def self.merged_attributes
40
+ self.superclass.attribute_map.merge(self.attribute_map)
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'type' => :'String'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping of this model + parent
51
+ def self.merged_types
52
+ self.superclass.openapi_types.merge(self.openapi_types)
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Returns list of attributes with nullable: true of this model + parent
62
+ def self.merged_nullable
63
+ self.superclass.openapi_nullable.merge(self.openapi_nullable)
64
+ end
65
+
66
+ # Attempt to instantiate and hydrate a new instance of this class
67
+ # @param [Object] data Data to be converted
68
+ # @return [TemplateResponseDocumentCustomFieldCheckbox]
69
+ def self.init(data)
70
+ return ApiClient.default.convert_to_type(
71
+ data,
72
+ "TemplateResponseDocumentCustomFieldCheckbox"
73
+ ) || TemplateResponseDocumentCustomFieldCheckbox.new
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateResponseDocumentCustomFieldCheckbox` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.merged_attributes.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateResponseDocumentCustomFieldCheckbox`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ # call parent's initialize
92
+ super(attributes)
93
+
94
+ if attributes.key?(:'type')
95
+ self.type = attributes[:'type']
96
+ else
97
+ self.type = 'checkbox'
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = super
105
+ if @type.nil?
106
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ return false if @type.nil?
116
+ true && super
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
+ type == o.type && super(o)
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [type].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ super(attributes)
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 = super
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