docusign_webforms 1.0.2.rc12

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 +7 -0
  2. data/CHANGELOG.md +34 -0
  3. data/Gemfile +7 -0
  4. data/README.md +131 -0
  5. data/Rakefile +8 -0
  6. data/docusign_webforms.gemspec +48 -0
  7. data/lib/docusign_webforms/api/form_instance_management_api.rb +272 -0
  8. data/lib/docusign_webforms/api/form_management_api.rb +192 -0
  9. data/lib/docusign_webforms/client/api_client.rb +600 -0
  10. data/lib/docusign_webforms/client/api_error.rb +37 -0
  11. data/lib/docusign_webforms/client/auth/oauth.rb +1061 -0
  12. data/lib/docusign_webforms/configuration.rb +203 -0
  13. data/lib/docusign_webforms/models/account_id.rb +175 -0
  14. data/lib/docusign_webforms/models/assertion_id.rb +175 -0
  15. data/lib/docusign_webforms/models/authentication_instant.rb +175 -0
  16. data/lib/docusign_webforms/models/authentication_method.rb +175 -0
  17. data/lib/docusign_webforms/models/brand_id.rb +175 -0
  18. data/lib/docusign_webforms/models/client_user_id.rb +175 -0
  19. data/lib/docusign_webforms/models/component_key.rb +174 -0
  20. data/lib/docusign_webforms/models/count.rb +175 -0
  21. data/lib/docusign_webforms/models/create_instance_request_body.rb +264 -0
  22. data/lib/docusign_webforms/models/created_date_time.rb +175 -0
  23. data/lib/docusign_webforms/models/date_time.rb +174 -0
  24. data/lib/docusign_webforms/models/envelope_id.rb +175 -0
  25. data/lib/docusign_webforms/models/expiration_date_time.rb +175 -0
  26. data/lib/docusign_webforms/models/expiration_offset.rb +175 -0
  27. data/lib/docusign_webforms/models/form_sort_by.rb +175 -0
  28. data/lib/docusign_webforms/models/form_url.rb +175 -0
  29. data/lib/docusign_webforms/models/guid.rb +174 -0
  30. data/lib/docusign_webforms/models/http_error.rb +195 -0
  31. data/lib/docusign_webforms/models/http_success.rb +184 -0
  32. data/lib/docusign_webforms/models/instance_id.rb +175 -0
  33. data/lib/docusign_webforms/models/instance_source.rb +31 -0
  34. data/lib/docusign_webforms/models/instance_status.rb +31 -0
  35. data/lib/docusign_webforms/models/instance_token.rb +175 -0
  36. data/lib/docusign_webforms/models/is_private_access.rb +175 -0
  37. data/lib/docusign_webforms/models/is_published.rb +175 -0
  38. data/lib/docusign_webforms/models/is_standalone.rb +175 -0
  39. data/lib/docusign_webforms/models/last_modified_date_time.rb +175 -0
  40. data/lib/docusign_webforms/models/return_url.rb +175 -0
  41. data/lib/docusign_webforms/models/search_text.rb +175 -0
  42. data/lib/docusign_webforms/models/security_domain.rb +175 -0
  43. data/lib/docusign_webforms/models/source.rb +31 -0
  44. data/lib/docusign_webforms/models/start_position.rb +175 -0
  45. data/lib/docusign_webforms/models/tags.rb +175 -0
  46. data/lib/docusign_webforms/models/template_properties.rb +217 -0
  47. data/lib/docusign_webforms/models/token_expiration_date_time.rb +175 -0
  48. data/lib/docusign_webforms/models/update_instance_request_body.rb +184 -0
  49. data/lib/docusign_webforms/models/user_filter.rb +30 -0
  50. data/lib/docusign_webforms/models/user_id.rb +175 -0
  51. data/lib/docusign_webforms/models/web_form.rb +268 -0
  52. data/lib/docusign_webforms/models/web_form_adm_type.rb +39 -0
  53. data/lib/docusign_webforms/models/web_form_component.rb +248 -0
  54. data/lib/docusign_webforms/models/web_form_component_type.rb +34 -0
  55. data/lib/docusign_webforms/models/web_form_components_map.rb +175 -0
  56. data/lib/docusign_webforms/models/web_form_content.rb +217 -0
  57. data/lib/docusign_webforms/models/web_form_id.rb +175 -0
  58. data/lib/docusign_webforms/models/web_form_instance.rb +295 -0
  59. data/lib/docusign_webforms/models/web_form_instance_envelopes.rb +183 -0
  60. data/lib/docusign_webforms/models/web_form_instance_list.rb +187 -0
  61. data/lib/docusign_webforms/models/web_form_instance_metadata.rb +237 -0
  62. data/lib/docusign_webforms/models/web_form_metadata.rb +377 -0
  63. data/lib/docusign_webforms/models/web_form_name.rb +175 -0
  64. data/lib/docusign_webforms/models/web_form_properties.rb +193 -0
  65. data/lib/docusign_webforms/models/web_form_published_names.rb +175 -0
  66. data/lib/docusign_webforms/models/web_form_source.rb +29 -0
  67. data/lib/docusign_webforms/models/web_form_state.rb +29 -0
  68. data/lib/docusign_webforms/models/web_form_summary.rb +250 -0
  69. data/lib/docusign_webforms/models/web_form_summary_list.rb +247 -0
  70. data/lib/docusign_webforms/models/web_form_user_info.rb +209 -0
  71. data/lib/docusign_webforms/models/web_form_values.rb +175 -0
  72. data/lib/docusign_webforms/models/web_form_version_id.rb +175 -0
  73. data/lib/docusign_webforms/version.rb +14 -0
  74. data/lib/docusign_webforms.rb +64 -0
  75. data/runLinter.sh +1 -0
  76. data/tests/Gemfile +5 -0
  77. data/tests/spec/unit_tests_using_jwt_spec.rb +38 -0
  78. metadata +382 -0
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #Web Forms API version 1.1
3
+
4
+ #The Web Forms API facilitates generating semantic HTML forms around everyday contracts.
5
+
6
+ OpenAPI spec version: 1.1.0
7
+ Contact: devcenter@docusign.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module DocuSign_WebForms
15
+ # An object that summarizes an instance of a form that can be used to display a listing
16
+ class WebFormSummary
17
+ attr_accessor :id
18
+
19
+ attr_accessor :account_id
20
+
21
+ # Has the form been published
22
+ attr_accessor :is_published
23
+
24
+ # Is the form currently enabled and available for data collection
25
+ attr_accessor :is_enabled
26
+
27
+ # Does the form have draft changes that need to be published?
28
+ attr_accessor :has_draft_changes
29
+
30
+ attr_accessor :form_state
31
+
32
+ attr_accessor :form_properties
33
+
34
+ attr_accessor :form_metadata
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'id' => :'id',
40
+ :'account_id' => :'accountId',
41
+ :'is_published' => :'isPublished',
42
+ :'is_enabled' => :'isEnabled',
43
+ :'has_draft_changes' => :'hasDraftChanges',
44
+ :'form_state' => :'formState',
45
+ :'form_properties' => :'formProperties',
46
+ :'form_metadata' => :'formMetadata'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'id' => :'String',
54
+ :'account_id' => :'String',
55
+ :'is_published' => :'BOOLEAN',
56
+ :'is_enabled' => :'BOOLEAN',
57
+ :'has_draft_changes' => :'BOOLEAN',
58
+ :'form_state' => :'WebFormState',
59
+ :'form_properties' => :'WebFormProperties',
60
+ :'form_metadata' => :'WebFormMetadata'
61
+ }
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
+
72
+ if attributes.has_key?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.has_key?(:'accountId')
77
+ self.account_id = attributes[:'accountId']
78
+ end
79
+
80
+ if attributes.has_key?(:'isPublished')
81
+ self.is_published = attributes[:'isPublished']
82
+ end
83
+
84
+ if attributes.has_key?(:'isEnabled')
85
+ self.is_enabled = attributes[:'isEnabled']
86
+ end
87
+
88
+ if attributes.has_key?(:'hasDraftChanges')
89
+ self.has_draft_changes = attributes[:'hasDraftChanges']
90
+ end
91
+
92
+ if attributes.has_key?(:'formState')
93
+ self.form_state = attributes[:'formState']
94
+ end
95
+
96
+ if attributes.has_key?(:'formProperties')
97
+ self.form_properties = attributes[:'formProperties']
98
+ end
99
+
100
+ if attributes.has_key?(:'formMetadata')
101
+ self.form_metadata = attributes[:'formMetadata']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
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
+ true
116
+ end
117
+
118
+ # Checks equality by comparing each attribute.
119
+ # @param [Object] Object to be compared
120
+ def ==(o)
121
+ return true if self.equal?(o)
122
+ self.class == o.class &&
123
+ id == o.id &&
124
+ account_id == o.account_id &&
125
+ is_published == o.is_published &&
126
+ is_enabled == o.is_enabled &&
127
+ has_draft_changes == o.has_draft_changes &&
128
+ form_state == o.form_state &&
129
+ form_properties == o.form_properties &&
130
+ form_metadata == o.form_metadata
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Fixnum] Hash code
141
+ def hash
142
+ [id, account_id, is_published, is_enabled, has_draft_changes, form_state, form_properties, form_metadata].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.swagger_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :BOOLEAN
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ temp_model = DocuSign_WebForms.const_get(type).new
203
+ temp_model.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ next if value.nil?
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+
249
+ end
250
+ end
@@ -0,0 +1,247 @@
1
+ =begin
2
+ #Web Forms API version 1.1
3
+
4
+ #The Web Forms API facilitates generating semantic HTML forms around everyday contracts.
5
+
6
+ OpenAPI spec version: 1.1.0
7
+ Contact: devcenter@docusign.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module DocuSign_WebForms
15
+ # A list of web form summary items.
16
+ class WebFormSummaryList
17
+ # Array of web form items with each containing summary.
18
+ attr_accessor :items
19
+
20
+ # Result set size for current page
21
+ attr_accessor :result_set_size
22
+
23
+ # Total result set size
24
+ attr_accessor :total_set_size
25
+
26
+ # Starting position of fields returned for the current page
27
+ attr_accessor :start_position
28
+
29
+ # Ending position of fields returned for the current page
30
+ attr_accessor :end_position
31
+
32
+ # Url for the next page of results
33
+ attr_accessor :next_url
34
+
35
+ # Url for the previous page of results
36
+ attr_accessor :previous_url
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'items' => :'items',
42
+ :'result_set_size' => :'resultSetSize',
43
+ :'total_set_size' => :'totalSetSize',
44
+ :'start_position' => :'startPosition',
45
+ :'end_position' => :'endPosition',
46
+ :'next_url' => :'nextUrl',
47
+ :'previous_url' => :'previousUrl'
48
+ }
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.swagger_types
53
+ {
54
+ :'items' => :'Array<WebFormSummary>',
55
+ :'result_set_size' => :'Float',
56
+ :'total_set_size' => :'Float',
57
+ :'start_position' => :'Float',
58
+ :'end_position' => :'Float',
59
+ :'next_url' => :'String',
60
+ :'previous_url' => :'String'
61
+ }
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
+
72
+ if attributes.has_key?(:'items')
73
+ if (value = attributes[:'items']).is_a?(Array)
74
+ self.items = value
75
+ end
76
+ end
77
+
78
+ if attributes.has_key?(:'resultSetSize')
79
+ self.result_set_size = attributes[:'resultSetSize']
80
+ end
81
+
82
+ if attributes.has_key?(:'totalSetSize')
83
+ self.total_set_size = attributes[:'totalSetSize']
84
+ end
85
+
86
+ if attributes.has_key?(:'startPosition')
87
+ self.start_position = attributes[:'startPosition']
88
+ end
89
+
90
+ if attributes.has_key?(:'endPosition')
91
+ self.end_position = attributes[:'endPosition']
92
+ end
93
+
94
+ if attributes.has_key?(:'nextUrl')
95
+ self.next_url = attributes[:'nextUrl']
96
+ end
97
+
98
+ if attributes.has_key?(:'previousUrl')
99
+ self.previous_url = attributes[:'previousUrl']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ items == o.items &&
122
+ result_set_size == o.result_set_size &&
123
+ total_set_size == o.total_set_size &&
124
+ start_position == o.start_position &&
125
+ end_position == o.end_position &&
126
+ next_url == o.next_url &&
127
+ previous_url == o.previous_url
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Fixnum] Hash code
138
+ def hash
139
+ [items, result_set_size, total_set_size, start_position, end_position, next_url, previous_url].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.swagger_types.each_pair do |key, type|
148
+ if type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :DateTime
169
+ DateTime.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :BOOLEAN
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ temp_model = DocuSign_WebForms.const_get(type).new
200
+ temp_model.build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ next if value.nil?
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+ end
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #Web Forms API version 1.1
3
+
4
+ #The Web Forms API facilitates generating semantic HTML forms around everyday contracts.
5
+
6
+ OpenAPI spec version: 1.1.0
7
+ Contact: devcenter@docusign.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module DocuSign_WebForms
15
+ # Information about a DocuSign system user. The user exists within the account associated with the form.
16
+ class WebFormUserInfo
17
+ attr_accessor :user_id
18
+
19
+ # Name of the user that can be displayed in the user interface.
20
+ attr_accessor :user_name
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'user_id' => :'userId',
26
+ :'user_name' => :'userName'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'user_id' => :'String',
34
+ :'user_name' => :'String'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
+
46
+ if attributes.has_key?(:'userId')
47
+ self.user_id = attributes[:'userId']
48
+ end
49
+
50
+ if attributes.has_key?(:'userName')
51
+ self.user_name = attributes[:'userName']
52
+ end
53
+ end
54
+
55
+ # Show invalid properties with the reasons. Usually used together with valid?
56
+ # @return Array for valid properties with the reasons
57
+ def list_invalid_properties
58
+ invalid_properties = Array.new
59
+ if !@user_name.nil? && @user_name.to_s.length > 150
60
+ invalid_properties.push('invalid value for "user_name", the character length must be smaller than or equal to 150.')
61
+ end
62
+
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return false if !@user_name.nil? && @user_name.to_s.length > 150
70
+ true
71
+ end
72
+
73
+ # Custom attribute writer method with validation
74
+ # @param [Object] user_name Value to be assigned
75
+ def user_name=(user_name)
76
+ if !user_name.nil? && user_name.to_s.length > 150
77
+ fail ArgumentError, 'invalid value for "user_name", the character length must be smaller than or equal to 150.'
78
+ end
79
+
80
+ @user_name = user_name
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ user_id == o.user_id &&
89
+ user_name == o.user_name
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Fixnum] Hash code
100
+ def hash
101
+ [user_id, user_name].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.swagger_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :BOOLEAN
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ temp_model = DocuSign_WebForms.const_get(type).new
162
+ temp_model.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+
208
+ end
209
+ end