docusign_click 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,269 @@
1
+ =begin
2
+ #DocuSign Click API
3
+
4
+ #Elastic signing (also known as DocuSign Click) lets you capture consent to standard agreement terms with a single click: terms and conditions, terms of service, terms of use, privacy policies, and more. The Click API lets you include this customizable elastic template solution in your DocuSign integrations.
5
+
6
+ OpenAPI spec version: v1
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_Click
15
+ # Control the display of the agreement statement.
16
+ class AgreementStatementStyles
17
+ # Control the fore-ground color of the element.
18
+ attr_accessor :color
19
+
20
+ # Control the display of the header. Can only be set to 'none' over the default for hiding purposes.
21
+ attr_accessor :display
22
+
23
+ # Control the font family of the text.
24
+ attr_accessor :font_family
25
+
26
+ # Control the font size of the text.
27
+ attr_accessor :font_size
28
+
29
+ # Control the font style of the text.
30
+ attr_accessor :font_style
31
+
32
+ # Control the font weight of the text.
33
+ attr_accessor :font_weight
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'color' => :'color',
61
+ :'display' => :'display',
62
+ :'font_family' => :'fontFamily',
63
+ :'font_size' => :'fontSize',
64
+ :'font_style' => :'fontStyle',
65
+ :'font_weight' => :'fontWeight'
66
+ }
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.swagger_types
71
+ {
72
+ :'color' => :'String',
73
+ :'display' => :'String',
74
+ :'font_family' => :'String',
75
+ :'font_size' => :'String',
76
+ :'font_style' => :'String',
77
+ :'font_weight' => :'Object'
78
+ }
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ return unless attributes.is_a?(Hash)
85
+
86
+ # convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
88
+
89
+ if attributes.has_key?(:'color')
90
+ self.color = attributes[:'color']
91
+ end
92
+
93
+ if attributes.has_key?(:'display')
94
+ self.display = attributes[:'display']
95
+ end
96
+
97
+ if attributes.has_key?(:'fontFamily')
98
+ self.font_family = attributes[:'fontFamily']
99
+ end
100
+
101
+ if attributes.has_key?(:'fontSize')
102
+ self.font_size = attributes[:'fontSize']
103
+ end
104
+
105
+ if attributes.has_key?(:'fontStyle')
106
+ self.font_style = attributes[:'fontStyle']
107
+ end
108
+
109
+ if attributes.has_key?(:'fontWeight')
110
+ self.font_weight = attributes[:'fontWeight']
111
+ end
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ display_validator = EnumAttributeValidator.new('String', ['none'])
125
+ return false unless display_validator.valid?(@display)
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ # @param [Object] display Object to be assigned
131
+ def display=(display)
132
+ validator = EnumAttributeValidator.new('String', ['none'])
133
+ unless validator.valid?(display)
134
+ fail ArgumentError, 'invalid value for "display", must be one of #{validator.allowable_values}.'
135
+ end
136
+ @display = display
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ color == o.color &&
145
+ display == o.display &&
146
+ font_family == o.font_family &&
147
+ font_size == o.font_size &&
148
+ font_style == o.font_style &&
149
+ font_weight == o.font_weight
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Fixnum] Hash code
160
+ def hash
161
+ [color, display, font_family, font_size, font_style, font_weight].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.swagger_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :DateTime
191
+ DateTime.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :BOOLEAN
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ temp_model = DocuSign_Click.const_get(type).new
222
+ temp_model.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ next if value.nil?
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+ end
@@ -0,0 +1,364 @@
1
+ =begin
2
+ #DocuSign Click API
3
+
4
+ #Elastic signing (also known as DocuSign Click) lets you capture consent to standard agreement terms with a single click: terms and conditions, terms of service, terms of use, privacy policies, and more. The Click API lets you include this customizable elastic template solution in your DocuSign integrations.
5
+
6
+ OpenAPI spec version: v1
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_Click
15
+ class BaseAgreeButtonStyles
16
+ # Control the background color of the element.
17
+ attr_accessor :background_color
18
+
19
+ # Control the border of the element.
20
+ attr_accessor :border
21
+
22
+ # Control the border color of the element.
23
+ attr_accessor :border_color
24
+
25
+ # Control the border radius of the element.
26
+ attr_accessor :border_radius
27
+
28
+ # Control the border style of the element.
29
+ attr_accessor :border_style
30
+
31
+ # Control the border width of the element.
32
+ attr_accessor :border_width
33
+
34
+ # Control the display of the box shadow of the agree button.
35
+ attr_accessor :box_shadow
36
+
37
+ # Control the fore-ground color of the element.
38
+ attr_accessor :color
39
+
40
+ # Control the font family of the text.
41
+ attr_accessor :font_family
42
+
43
+ # Control the font size of the text.
44
+ attr_accessor :font_size
45
+
46
+ # Control the font style of the text.
47
+ attr_accessor :font_style
48
+
49
+ # Control the font weight of the text.
50
+ attr_accessor :font_weight
51
+
52
+ # Control the height of the agree button.
53
+ attr_accessor :height
54
+
55
+ # Control the margin of the element.
56
+ attr_accessor :margin
57
+
58
+ # Control the opacity of the element
59
+ attr_accessor :opacity
60
+
61
+ # Control the outline of the element
62
+ attr_accessor :outline
63
+
64
+ # Conrol the outline offset of the element
65
+ attr_accessor :outline_offset
66
+
67
+ # Control the padding of the element.
68
+ attr_accessor :padding
69
+
70
+ # Control the width of the agree button.
71
+ attr_accessor :width
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'background_color' => :'backgroundColor',
77
+ :'border' => :'border',
78
+ :'border_color' => :'borderColor',
79
+ :'border_radius' => :'borderRadius',
80
+ :'border_style' => :'borderStyle',
81
+ :'border_width' => :'borderWidth',
82
+ :'box_shadow' => :'boxShadow',
83
+ :'color' => :'color',
84
+ :'font_family' => :'fontFamily',
85
+ :'font_size' => :'fontSize',
86
+ :'font_style' => :'fontStyle',
87
+ :'font_weight' => :'fontWeight',
88
+ :'height' => :'height',
89
+ :'margin' => :'margin',
90
+ :'opacity' => :'opacity',
91
+ :'outline' => :'outline',
92
+ :'outline_offset' => :'outlineOffset',
93
+ :'padding' => :'padding',
94
+ :'width' => :'width'
95
+ }
96
+ end
97
+
98
+ # Attribute type mapping.
99
+ def self.swagger_types
100
+ {
101
+ :'background_color' => :'String',
102
+ :'border' => :'String',
103
+ :'border_color' => :'String',
104
+ :'border_radius' => :'String',
105
+ :'border_style' => :'String',
106
+ :'border_width' => :'String',
107
+ :'box_shadow' => :'String',
108
+ :'color' => :'String',
109
+ :'font_family' => :'String',
110
+ :'font_size' => :'String',
111
+ :'font_style' => :'String',
112
+ :'font_weight' => :'Object',
113
+ :'height' => :'String',
114
+ :'margin' => :'String',
115
+ :'opacity' => :'String',
116
+ :'outline' => :'String',
117
+ :'outline_offset' => :'String',
118
+ :'padding' => :'String',
119
+ :'width' => :'String'
120
+ }
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ return unless attributes.is_a?(Hash)
127
+
128
+ # convert string to symbol for hash key
129
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
130
+
131
+ if attributes.has_key?(:'backgroundColor')
132
+ self.background_color = attributes[:'backgroundColor']
133
+ end
134
+
135
+ if attributes.has_key?(:'border')
136
+ self.border = attributes[:'border']
137
+ end
138
+
139
+ if attributes.has_key?(:'borderColor')
140
+ self.border_color = attributes[:'borderColor']
141
+ end
142
+
143
+ if attributes.has_key?(:'borderRadius')
144
+ self.border_radius = attributes[:'borderRadius']
145
+ end
146
+
147
+ if attributes.has_key?(:'borderStyle')
148
+ self.border_style = attributes[:'borderStyle']
149
+ end
150
+
151
+ if attributes.has_key?(:'borderWidth')
152
+ self.border_width = attributes[:'borderWidth']
153
+ end
154
+
155
+ if attributes.has_key?(:'boxShadow')
156
+ self.box_shadow = attributes[:'boxShadow']
157
+ end
158
+
159
+ if attributes.has_key?(:'color')
160
+ self.color = attributes[:'color']
161
+ end
162
+
163
+ if attributes.has_key?(:'fontFamily')
164
+ self.font_family = attributes[:'fontFamily']
165
+ end
166
+
167
+ if attributes.has_key?(:'fontSize')
168
+ self.font_size = attributes[:'fontSize']
169
+ end
170
+
171
+ if attributes.has_key?(:'fontStyle')
172
+ self.font_style = attributes[:'fontStyle']
173
+ end
174
+
175
+ if attributes.has_key?(:'fontWeight')
176
+ self.font_weight = attributes[:'fontWeight']
177
+ end
178
+
179
+ if attributes.has_key?(:'height')
180
+ self.height = attributes[:'height']
181
+ end
182
+
183
+ if attributes.has_key?(:'margin')
184
+ self.margin = attributes[:'margin']
185
+ end
186
+
187
+ if attributes.has_key?(:'opacity')
188
+ self.opacity = attributes[:'opacity']
189
+ end
190
+
191
+ if attributes.has_key?(:'outline')
192
+ self.outline = attributes[:'outline']
193
+ end
194
+
195
+ if attributes.has_key?(:'outlineOffset')
196
+ self.outline_offset = attributes[:'outlineOffset']
197
+ end
198
+
199
+ if attributes.has_key?(:'padding')
200
+ self.padding = attributes[:'padding']
201
+ end
202
+
203
+ if attributes.has_key?(:'width')
204
+ self.width = attributes[:'width']
205
+ end
206
+ end
207
+
208
+ # Show invalid properties with the reasons. Usually used together with valid?
209
+ # @return Array for valid properties with the reasons
210
+ def list_invalid_properties
211
+ invalid_properties = Array.new
212
+ invalid_properties
213
+ end
214
+
215
+ # Check to see if the all the properties in the model are valid
216
+ # @return true if the model is valid
217
+ def valid?
218
+ true
219
+ end
220
+
221
+ # Checks equality by comparing each attribute.
222
+ # @param [Object] Object to be compared
223
+ def ==(o)
224
+ return true if self.equal?(o)
225
+ self.class == o.class &&
226
+ background_color == o.background_color &&
227
+ border == o.border &&
228
+ border_color == o.border_color &&
229
+ border_radius == o.border_radius &&
230
+ border_style == o.border_style &&
231
+ border_width == o.border_width &&
232
+ box_shadow == o.box_shadow &&
233
+ color == o.color &&
234
+ font_family == o.font_family &&
235
+ font_size == o.font_size &&
236
+ font_style == o.font_style &&
237
+ font_weight == o.font_weight &&
238
+ height == o.height &&
239
+ margin == o.margin &&
240
+ opacity == o.opacity &&
241
+ outline == o.outline &&
242
+ outline_offset == o.outline_offset &&
243
+ padding == o.padding &&
244
+ width == o.width
245
+ end
246
+
247
+ # @see the `==` method
248
+ # @param [Object] Object to be compared
249
+ def eql?(o)
250
+ self == o
251
+ end
252
+
253
+ # Calculates hash code according to all attributes.
254
+ # @return [Fixnum] Hash code
255
+ def hash
256
+ [background_color, border, border_color, border_radius, border_style, border_width, box_shadow, color, font_family, font_size, font_style, font_weight, height, margin, opacity, outline, outline_offset, padding, width].hash
257
+ end
258
+
259
+ # Builds the object from hash
260
+ # @param [Hash] attributes Model attributes in the form of hash
261
+ # @return [Object] Returns the model itself
262
+ def build_from_hash(attributes)
263
+ return nil unless attributes.is_a?(Hash)
264
+ self.class.swagger_types.each_pair do |key, type|
265
+ if type =~ /\AArray<(.*)>/i
266
+ # check to ensure the input is an array given that the attribute
267
+ # is documented as an array but the input is not
268
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
269
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
270
+ end
271
+ elsif !attributes[self.class.attribute_map[key]].nil?
272
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
273
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
274
+ end
275
+
276
+ self
277
+ end
278
+
279
+ # Deserializes the data based on type
280
+ # @param string type Data type
281
+ # @param string value Value to be deserialized
282
+ # @return [Object] Deserialized data
283
+ def _deserialize(type, value)
284
+ case type.to_sym
285
+ when :DateTime
286
+ DateTime.parse(value)
287
+ when :Date
288
+ Date.parse(value)
289
+ when :String
290
+ value.to_s
291
+ when :Integer
292
+ value.to_i
293
+ when :Float
294
+ value.to_f
295
+ when :BOOLEAN
296
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
297
+ true
298
+ else
299
+ false
300
+ end
301
+ when :Object
302
+ # generic object (usually a Hash), return directly
303
+ value
304
+ when /\AArray<(?<inner_type>.+)>\z/
305
+ inner_type = Regexp.last_match[:inner_type]
306
+ value.map { |v| _deserialize(inner_type, v) }
307
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
308
+ k_type = Regexp.last_match[:k_type]
309
+ v_type = Regexp.last_match[:v_type]
310
+ {}.tap do |hash|
311
+ value.each do |k, v|
312
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
313
+ end
314
+ end
315
+ else # model
316
+ temp_model = DocuSign_Click.const_get(type).new
317
+ temp_model.build_from_hash(value)
318
+ end
319
+ end
320
+
321
+ # Returns the string representation of the object
322
+ # @return [String] String presentation of the object
323
+ def to_s
324
+ to_hash.to_s
325
+ end
326
+
327
+ # to_body is an alias to to_hash (backward compatibility)
328
+ # @return [Hash] Returns the object in the form of hash
329
+ def to_body
330
+ to_hash
331
+ end
332
+
333
+ # Returns the object in the form of hash
334
+ # @return [Hash] Returns the object in the form of hash
335
+ def to_hash
336
+ hash = {}
337
+ self.class.attribute_map.each_pair do |attr, param|
338
+ value = self.send(attr)
339
+ next if value.nil?
340
+ hash[param] = _to_hash(value)
341
+ end
342
+ hash
343
+ end
344
+
345
+ # Outputs non-array value in the form of hash
346
+ # For object, use to_hash. Otherwise, just return the value
347
+ # @param [Object] value Any valid value
348
+ # @return [Hash] Returns the value in the form of hash
349
+ def _to_hash(value)
350
+ if value.is_a?(Array)
351
+ value.compact.map { |v| _to_hash(v) }
352
+ elsif value.is_a?(Hash)
353
+ {}.tap do |hash|
354
+ value.each { |k, v| hash[k] = _to_hash(v) }
355
+ end
356
+ elsif value.respond_to? :to_hash
357
+ value.to_hash
358
+ else
359
+ value
360
+ end
361
+ end
362
+
363
+ end
364
+ end