docusign_webforms 1.0.2.rc12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +34 -0
- data/Gemfile +7 -0
- data/README.md +131 -0
- data/Rakefile +8 -0
- data/docusign_webforms.gemspec +48 -0
- data/lib/docusign_webforms/api/form_instance_management_api.rb +272 -0
- data/lib/docusign_webforms/api/form_management_api.rb +192 -0
- data/lib/docusign_webforms/client/api_client.rb +600 -0
- data/lib/docusign_webforms/client/api_error.rb +37 -0
- data/lib/docusign_webforms/client/auth/oauth.rb +1061 -0
- data/lib/docusign_webforms/configuration.rb +203 -0
- data/lib/docusign_webforms/models/account_id.rb +175 -0
- data/lib/docusign_webforms/models/assertion_id.rb +175 -0
- data/lib/docusign_webforms/models/authentication_instant.rb +175 -0
- data/lib/docusign_webforms/models/authentication_method.rb +175 -0
- data/lib/docusign_webforms/models/brand_id.rb +175 -0
- data/lib/docusign_webforms/models/client_user_id.rb +175 -0
- data/lib/docusign_webforms/models/component_key.rb +174 -0
- data/lib/docusign_webforms/models/count.rb +175 -0
- data/lib/docusign_webforms/models/create_instance_request_body.rb +264 -0
- data/lib/docusign_webforms/models/created_date_time.rb +175 -0
- data/lib/docusign_webforms/models/date_time.rb +174 -0
- data/lib/docusign_webforms/models/envelope_id.rb +175 -0
- data/lib/docusign_webforms/models/expiration_date_time.rb +175 -0
- data/lib/docusign_webforms/models/expiration_offset.rb +175 -0
- data/lib/docusign_webforms/models/form_sort_by.rb +175 -0
- data/lib/docusign_webforms/models/form_url.rb +175 -0
- data/lib/docusign_webforms/models/guid.rb +174 -0
- data/lib/docusign_webforms/models/http_error.rb +195 -0
- data/lib/docusign_webforms/models/http_success.rb +184 -0
- data/lib/docusign_webforms/models/instance_id.rb +175 -0
- data/lib/docusign_webforms/models/instance_source.rb +31 -0
- data/lib/docusign_webforms/models/instance_status.rb +31 -0
- data/lib/docusign_webforms/models/instance_token.rb +175 -0
- data/lib/docusign_webforms/models/is_private_access.rb +175 -0
- data/lib/docusign_webforms/models/is_published.rb +175 -0
- data/lib/docusign_webforms/models/is_standalone.rb +175 -0
- data/lib/docusign_webforms/models/last_modified_date_time.rb +175 -0
- data/lib/docusign_webforms/models/return_url.rb +175 -0
- data/lib/docusign_webforms/models/search_text.rb +175 -0
- data/lib/docusign_webforms/models/security_domain.rb +175 -0
- data/lib/docusign_webforms/models/source.rb +31 -0
- data/lib/docusign_webforms/models/start_position.rb +175 -0
- data/lib/docusign_webforms/models/tags.rb +175 -0
- data/lib/docusign_webforms/models/template_properties.rb +217 -0
- data/lib/docusign_webforms/models/token_expiration_date_time.rb +175 -0
- data/lib/docusign_webforms/models/update_instance_request_body.rb +184 -0
- data/lib/docusign_webforms/models/user_filter.rb +30 -0
- data/lib/docusign_webforms/models/user_id.rb +175 -0
- data/lib/docusign_webforms/models/web_form.rb +268 -0
- data/lib/docusign_webforms/models/web_form_adm_type.rb +39 -0
- data/lib/docusign_webforms/models/web_form_component.rb +248 -0
- data/lib/docusign_webforms/models/web_form_component_type.rb +34 -0
- data/lib/docusign_webforms/models/web_form_components_map.rb +175 -0
- data/lib/docusign_webforms/models/web_form_content.rb +217 -0
- data/lib/docusign_webforms/models/web_form_id.rb +175 -0
- data/lib/docusign_webforms/models/web_form_instance.rb +295 -0
- data/lib/docusign_webforms/models/web_form_instance_envelopes.rb +183 -0
- data/lib/docusign_webforms/models/web_form_instance_list.rb +187 -0
- data/lib/docusign_webforms/models/web_form_instance_metadata.rb +237 -0
- data/lib/docusign_webforms/models/web_form_metadata.rb +377 -0
- data/lib/docusign_webforms/models/web_form_name.rb +175 -0
- data/lib/docusign_webforms/models/web_form_properties.rb +193 -0
- data/lib/docusign_webforms/models/web_form_published_names.rb +175 -0
- data/lib/docusign_webforms/models/web_form_source.rb +29 -0
- data/lib/docusign_webforms/models/web_form_state.rb +29 -0
- data/lib/docusign_webforms/models/web_form_summary.rb +250 -0
- data/lib/docusign_webforms/models/web_form_summary_list.rb +247 -0
- data/lib/docusign_webforms/models/web_form_user_info.rb +209 -0
- data/lib/docusign_webforms/models/web_form_values.rb +175 -0
- data/lib/docusign_webforms/models/web_form_version_id.rb +175 -0
- data/lib/docusign_webforms/version.rb +14 -0
- data/lib/docusign_webforms.rb +64 -0
- data/runLinter.sh +1 -0
- data/tests/Gemfile +5 -0
- data/tests/spec/unit_tests_using_jwt_spec.rb +38 -0
- metadata +382 -0
@@ -0,0 +1,268 @@
|
|
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 fully describes an instance of a form
|
16
|
+
class WebForm
|
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
|
+
attr_accessor :version_id
|
37
|
+
|
38
|
+
attr_accessor :form_content
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'id' => :'id',
|
44
|
+
:'account_id' => :'accountId',
|
45
|
+
:'is_published' => :'isPublished',
|
46
|
+
:'is_enabled' => :'isEnabled',
|
47
|
+
:'has_draft_changes' => :'hasDraftChanges',
|
48
|
+
:'form_state' => :'formState',
|
49
|
+
:'form_properties' => :'formProperties',
|
50
|
+
:'form_metadata' => :'formMetadata',
|
51
|
+
:'version_id' => :'versionId',
|
52
|
+
:'form_content' => :'formContent'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'id' => :'String',
|
60
|
+
:'account_id' => :'String',
|
61
|
+
:'is_published' => :'BOOLEAN',
|
62
|
+
:'is_enabled' => :'BOOLEAN',
|
63
|
+
:'has_draft_changes' => :'BOOLEAN',
|
64
|
+
:'form_state' => :'WebFormState',
|
65
|
+
:'form_properties' => :'WebFormProperties',
|
66
|
+
:'form_metadata' => :'WebFormMetadata',
|
67
|
+
:'version_id' => :'Integer',
|
68
|
+
:'form_content' => :'WebFormContent'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
return unless attributes.is_a?(Hash)
|
76
|
+
|
77
|
+
# convert string to symbol for hash key
|
78
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
79
|
+
|
80
|
+
if attributes.has_key?(:'id')
|
81
|
+
self.id = attributes[:'id']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'accountId')
|
85
|
+
self.account_id = attributes[:'accountId']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'isPublished')
|
89
|
+
self.is_published = attributes[:'isPublished']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'isEnabled')
|
93
|
+
self.is_enabled = attributes[:'isEnabled']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'hasDraftChanges')
|
97
|
+
self.has_draft_changes = attributes[:'hasDraftChanges']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:'formState')
|
101
|
+
self.form_state = attributes[:'formState']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:'formProperties')
|
105
|
+
self.form_properties = attributes[:'formProperties']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.has_key?(:'formMetadata')
|
109
|
+
self.form_metadata = attributes[:'formMetadata']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.has_key?(:'versionId')
|
113
|
+
self.version_id = attributes[:'versionId']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.has_key?(:'formContent')
|
117
|
+
self.form_content = attributes[:'formContent']
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
122
|
+
# @return Array for valid properties with the reasons
|
123
|
+
def list_invalid_properties
|
124
|
+
invalid_properties = Array.new
|
125
|
+
invalid_properties
|
126
|
+
end
|
127
|
+
|
128
|
+
# Check to see if the all the properties in the model are valid
|
129
|
+
# @return true if the model is valid
|
130
|
+
def valid?
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
# Checks equality by comparing each attribute.
|
135
|
+
# @param [Object] Object to be compared
|
136
|
+
def ==(o)
|
137
|
+
return true if self.equal?(o)
|
138
|
+
self.class == o.class &&
|
139
|
+
id == o.id &&
|
140
|
+
account_id == o.account_id &&
|
141
|
+
is_published == o.is_published &&
|
142
|
+
is_enabled == o.is_enabled &&
|
143
|
+
has_draft_changes == o.has_draft_changes &&
|
144
|
+
form_state == o.form_state &&
|
145
|
+
form_properties == o.form_properties &&
|
146
|
+
form_metadata == o.form_metadata &&
|
147
|
+
version_id == o.version_id &&
|
148
|
+
form_content == o.form_content
|
149
|
+
end
|
150
|
+
|
151
|
+
# @see the `==` method
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def eql?(o)
|
154
|
+
self == o
|
155
|
+
end
|
156
|
+
|
157
|
+
# Calculates hash code according to all attributes.
|
158
|
+
# @return [Fixnum] Hash code
|
159
|
+
def hash
|
160
|
+
[id, account_id, is_published, is_enabled, has_draft_changes, form_state, form_properties, form_metadata, version_id, form_content].hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def build_from_hash(attributes)
|
167
|
+
return nil unless attributes.is_a?(Hash)
|
168
|
+
self.class.swagger_types.each_pair do |key, type|
|
169
|
+
if type =~ /\AArray<(.*)>/i
|
170
|
+
# check to ensure the input is an array given that the attribute
|
171
|
+
# is documented as an array but the input is not
|
172
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
173
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
174
|
+
end
|
175
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
176
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
177
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
178
|
+
end
|
179
|
+
|
180
|
+
self
|
181
|
+
end
|
182
|
+
|
183
|
+
# Deserializes the data based on type
|
184
|
+
# @param string type Data type
|
185
|
+
# @param string value Value to be deserialized
|
186
|
+
# @return [Object] Deserialized data
|
187
|
+
def _deserialize(type, value)
|
188
|
+
case type.to_sym
|
189
|
+
when :DateTime
|
190
|
+
DateTime.parse(value)
|
191
|
+
when :Date
|
192
|
+
Date.parse(value)
|
193
|
+
when :String
|
194
|
+
value.to_s
|
195
|
+
when :Integer
|
196
|
+
value.to_i
|
197
|
+
when :Float
|
198
|
+
value.to_f
|
199
|
+
when :BOOLEAN
|
200
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
201
|
+
true
|
202
|
+
else
|
203
|
+
false
|
204
|
+
end
|
205
|
+
when :Object
|
206
|
+
# generic object (usually a Hash), return directly
|
207
|
+
value
|
208
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
209
|
+
inner_type = Regexp.last_match[:inner_type]
|
210
|
+
value.map { |v| _deserialize(inner_type, v) }
|
211
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
212
|
+
k_type = Regexp.last_match[:k_type]
|
213
|
+
v_type = Regexp.last_match[:v_type]
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each do |k, v|
|
216
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
else # model
|
220
|
+
temp_model = DocuSign_WebForms.const_get(type).new
|
221
|
+
temp_model.build_from_hash(value)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the string representation of the object
|
226
|
+
# @return [String] String presentation of the object
|
227
|
+
def to_s
|
228
|
+
to_hash.to_s
|
229
|
+
end
|
230
|
+
|
231
|
+
# to_body is an alias to to_hash (backward compatibility)
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
233
|
+
def to_body
|
234
|
+
to_hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Returns the object in the form of hash
|
238
|
+
# @return [Hash] Returns the object in the form of hash
|
239
|
+
def to_hash
|
240
|
+
hash = {}
|
241
|
+
self.class.attribute_map.each_pair do |attr, param|
|
242
|
+
value = self.send(attr)
|
243
|
+
next if value.nil?
|
244
|
+
hash[param] = _to_hash(value)
|
245
|
+
end
|
246
|
+
hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to? :to_hash
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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
|
+
class WebFormAdmType
|
16
|
+
|
17
|
+
STRING = 'String'.freeze
|
18
|
+
BOOLEAN = 'Boolean'.freeze
|
19
|
+
DOUBLE = 'Double'.freeze
|
20
|
+
DATE_TIME = 'DateTime'.freeze
|
21
|
+
ARRAY_OF_STRING = 'ArrayOfString'.freeze
|
22
|
+
CHECKBOX_GROUP = 'CheckboxGroup'.freeze
|
23
|
+
DATE = 'Date'.freeze
|
24
|
+
EMAIL = 'Email'.freeze
|
25
|
+
NUMBER = 'Number'.freeze
|
26
|
+
RADIO_BUTTON_GROUP = 'RadioButtonGroup'.freeze
|
27
|
+
SELECT = 'Select'.freeze
|
28
|
+
TEXT_BOX = 'TextBox'.freeze
|
29
|
+
|
30
|
+
# Builds the enum from string
|
31
|
+
# @param [String] The enum value in the form of the string
|
32
|
+
# @return [String] The enum value
|
33
|
+
def build_from_hash(value)
|
34
|
+
constantValues = WebFormAdmType.constants.select { |c| WebFormAdmType::const_get(c) == value }
|
35
|
+
raise "Invalid ENUM value #{value} for class #WebFormAdmType" if constantValues.empty?
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,248 @@
|
|
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
|
+
# Each component type contains additional properties
|
16
|
+
class WebFormComponent
|
17
|
+
attr_accessor :component_key
|
18
|
+
|
19
|
+
# The type of component this object represents
|
20
|
+
attr_accessor :component_type
|
21
|
+
|
22
|
+
# Name value that is used for mapping components to external sources
|
23
|
+
attr_accessor :component_name
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'component_key' => :'componentKey',
|
29
|
+
:'component_type' => :'componentType',
|
30
|
+
:'component_name' => :'componentName'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'component_key' => :'String',
|
38
|
+
:'component_type' => :'String',
|
39
|
+
:'component_name' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
50
|
+
|
51
|
+
if attributes.has_key?(:'componentKey')
|
52
|
+
self.component_key = attributes[:'componentKey']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'componentType')
|
56
|
+
self.component_type = attributes[:'componentType']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'componentName')
|
60
|
+
self.component_name = attributes[:'componentName']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
65
|
+
# @return Array for valid properties with the reasons
|
66
|
+
def list_invalid_properties
|
67
|
+
invalid_properties = Array.new
|
68
|
+
if @component_key.nil?
|
69
|
+
invalid_properties.push('invalid value for "component_key", component_key cannot be nil.')
|
70
|
+
end
|
71
|
+
|
72
|
+
if @component_type.nil?
|
73
|
+
invalid_properties.push('invalid value for "component_type", component_type cannot be nil.')
|
74
|
+
end
|
75
|
+
|
76
|
+
if @component_type.to_s.length > 100
|
77
|
+
invalid_properties.push('invalid value for "component_type", the character length must be smaller than or equal to 100.')
|
78
|
+
end
|
79
|
+
|
80
|
+
if !@component_name.nil? && @component_name.to_s.length > 100
|
81
|
+
invalid_properties.push('invalid value for "component_name", the character length must be smaller than or equal to 100.')
|
82
|
+
end
|
83
|
+
|
84
|
+
invalid_properties
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check to see if the all the properties in the model are valid
|
88
|
+
# @return true if the model is valid
|
89
|
+
def valid?
|
90
|
+
return false if @component_key.nil?
|
91
|
+
return false if @component_type.nil?
|
92
|
+
return false if @component_type.to_s.length > 100
|
93
|
+
return false if !@component_name.nil? && @component_name.to_s.length > 100
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
# Custom attribute writer method with validation
|
98
|
+
# @param [Object] component_type Value to be assigned
|
99
|
+
def component_type=(component_type)
|
100
|
+
if component_type.nil?
|
101
|
+
fail ArgumentError, 'component_type cannot be nil'
|
102
|
+
end
|
103
|
+
|
104
|
+
if component_type.to_s.length > 100
|
105
|
+
fail ArgumentError, 'invalid value for "component_type", the character length must be smaller than or equal to 100.'
|
106
|
+
end
|
107
|
+
|
108
|
+
@component_type = component_type
|
109
|
+
end
|
110
|
+
|
111
|
+
# Custom attribute writer method with validation
|
112
|
+
# @param [Object] component_name Value to be assigned
|
113
|
+
def component_name=(component_name)
|
114
|
+
if !component_name.nil? && component_name.to_s.length > 100
|
115
|
+
fail ArgumentError, 'invalid value for "component_name", the character length must be smaller than or equal to 100.'
|
116
|
+
end
|
117
|
+
|
118
|
+
@component_name = component_name
|
119
|
+
end
|
120
|
+
|
121
|
+
# Checks equality by comparing each attribute.
|
122
|
+
# @param [Object] Object to be compared
|
123
|
+
def ==(o)
|
124
|
+
return true if self.equal?(o)
|
125
|
+
self.class == o.class &&
|
126
|
+
component_key == o.component_key &&
|
127
|
+
component_type == o.component_type &&
|
128
|
+
component_name == o.component_name
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Fixnum] Hash code
|
139
|
+
def hash
|
140
|
+
[component_key, component_type, component_name].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
self.class.swagger_types.each_pair do |key, type|
|
149
|
+
if type =~ /\AArray<(.*)>/i
|
150
|
+
# check to ensure the input is an array given that the attribute
|
151
|
+
# is documented as an array but the input is not
|
152
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
158
|
+
end
|
159
|
+
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def _deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :DateTime
|
170
|
+
DateTime.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :BOOLEAN
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
temp_model = DocuSign_WebForms.const_get(type).new
|
201
|
+
temp_model.build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
next if value.nil?
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map { |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
class WebFormComponentType
|
16
|
+
|
17
|
+
CHECKBOX_GROUP = 'CheckboxGroup'.freeze
|
18
|
+
DATE = 'Date'.freeze
|
19
|
+
EMAIL = 'Email'.freeze
|
20
|
+
NUMBER = 'Number'.freeze
|
21
|
+
RADIO_BUTTON_GROUP = 'RadioButtonGroup'.freeze
|
22
|
+
SELECT = 'Select'.freeze
|
23
|
+
TEXT_BOX = 'TextBox'.freeze
|
24
|
+
|
25
|
+
# Builds the enum from string
|
26
|
+
# @param [String] The enum value in the form of the string
|
27
|
+
# @return [String] The enum value
|
28
|
+
def build_from_hash(value)
|
29
|
+
constantValues = WebFormComponentType.constants.select { |c| WebFormComponentType::const_get(c) == value }
|
30
|
+
raise "Invalid ENUM value #{value} for class #WebFormComponentType" if constantValues.empty?
|
31
|
+
value
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|