Class: YousignClient::FileObjectInput

Inherits:
Object
  • Object
show all
Defined in:
lib/yousign_client/models/file_object_input.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FileObjectInput

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/yousign_client/models/file_object_input.rb', line 123

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'file')
    self.file = attributes[:'file']
  end

  if attributes.has_key?(:'page')
    self.page = attributes[:'page']
  end

  if attributes.has_key?(:'position')
    self.position = attributes[:'position']
  end

  if attributes.has_key?(:'fieldName')
    self.field_name = attributes[:'fieldName']
  end

  if attributes.has_key?(:'mention')
    self.mention = attributes[:'mention']
  end

  if attributes.has_key?(:'mention2')
    self.mention2 = attributes[:'mention2']
  end

  if attributes.has_key?(:'member')
    self.member = attributes[:'member']
  end

  if attributes.has_key?(:'reason')
    self.reason = attributes[:'reason']
  else
    self.reason = 'Signed by Yousign'
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = 'signature'
  end

  if attributes.has_key?(:'contentRequired')
    self.content_required = attributes[:'contentRequired']
  else
    self.content_required = false
  end

  if attributes.has_key?(:'content')
    self.content = attributes[:'content']
  end

  if attributes.has_key?(:'fontFamily')
    self.font_family = attributes[:'fontFamily']
  else
    self.font_family = 'raleway'
  end

  if attributes.has_key?(:'fontSize')
    self.font_size = attributes[:'fontSize']
  else
    self.font_size = 12
  end

  if attributes.has_key?(:'fontColor')
    self.font_color = attributes[:'fontColor']
  end
end

Instance Attribute Details

#contentObject

type=text

The content of the field. Could be used for placeholder



48
49
50
# File 'lib/yousign_client/models/file_object_input.rb', line 48

def content
  @content
end

#content_requiredObject

type=text

Indicate if the member must fill or not the field



45
46
47
# File 'lib/yousign_client/models/file_object_input.rb', line 45

def content_required
  @content_required
end

#field_nameObject

type=signature

Name of the signature field existing in the document, it will be not used on the signature image.



27
28
29
# File 'lib/yousign_client/models/file_object_input.rb', line 27

def field_name
  @field_name
end

#fileObject

File id reference



18
19
20
# File 'lib/yousign_client/models/file_object_input.rb', line 18

def file
  @file
end

#font_colorObject

type=text

The font color used to render the field.



57
58
59
# File 'lib/yousign_client/models/file_object_input.rb', line 57

def font_color
  @font_color
end

#font_familyObject

type=text

The font familly used to render the TextField. Currently only the default value will be used.



51
52
53
# File 'lib/yousign_client/models/file_object_input.rb', line 51

def font_family
  @font_family
end

#font_sizeObject

type=text

The font size used to render the field. Currently only the default value will be used.



54
55
56
# File 'lib/yousign_client/models/file_object_input.rb', line 54

def font_size
  @font_size
end

#memberObject

Member id reference



36
37
38
# File 'lib/yousign_client/models/file_object_input.rb', line 36

def member
  @member
end

#mentionObject

type=signature

Text associated above the signature image. You can use some variable inside : YousignClient::FileObjectInput.{date{date.en} YousignClient::FileObjectInput.{date{date.fr} YousignClient::FileObjectInput.{time{time.en} YousignClient::FileObjectInput.{time{time.fr} that it will be parsed to show the date of the signature.



30
31
32
# File 'lib/yousign_client/models/file_object_input.rb', line 30

def mention
  @mention
end

#mention2Object

type=signature

Text associated below the signature image. (internal usage only, should not be used). You can use some variable inside : YousignClient::FileObjectInput.{date{date.en} YousignClient::FileObjectInput.{date{date.fr} YousignClient::FileObjectInput.{time{time.en} YousignClient::FileObjectInput.{time{time.fr} that it will be parsed to show the date of the signature.



33
34
35
# File 'lib/yousign_client/models/file_object_input.rb', line 33

def mention2
  @mention2
end

#pageObject

Page of the visible signature. This property is ignored if fieldName is set. If you want a visible signature, you must set page, position and fieldName.



21
22
23
# File 'lib/yousign_client/models/file_object_input.rb', line 21

def page
  @page
end

#positionObject

Coordinates of the signature image to set. Format is : "llx,lly,urx,ury". llx=left lower x coordinate, lly=left lower y coordinate, urx=upper right x coordinate, ury = upper right y coordinate. To get easily coordinates, you could use this tool : placeit.yousign.fr



24
25
26
# File 'lib/yousign_client/models/file_object_input.rb', line 24

def position
  @position
end

#reasonObject

type=signature

The reason they are signing the agreement



39
40
41
# File 'lib/yousign_client/models/file_object_input.rb', line 39

def reason
  @reason
end

#typeObject

The type of the file object



42
43
44
# File 'lib/yousign_client/models/file_object_input.rb', line 42

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/yousign_client/models/file_object_input.rb', line 82

def self.attribute_map
  {
    :'file' => :'file',
    :'page' => :'page',
    :'position' => :'position',
    :'field_name' => :'fieldName',
    :'mention' => :'mention',
    :'mention2' => :'mention2',
    :'member' => :'member',
    :'reason' => :'reason',
    :'type' => :'type',
    :'content_required' => :'contentRequired',
    :'content' => :'content',
    :'font_family' => :'fontFamily',
    :'font_size' => :'fontSize',
    :'font_color' => :'fontColor'
  }
end

.swagger_typesObject

Attribute type mapping.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/yousign_client/models/file_object_input.rb', line 102

def self.swagger_types
  {
    :'file' => :'String',
    :'page' => :'Integer',
    :'position' => :'String',
    :'field_name' => :'String',
    :'mention' => :'String',
    :'mention2' => :'String',
    :'member' => :'String',
    :'reason' => :'String',
    :'type' => :'String',
    :'content_required' => :'BOOLEAN',
    :'content' => :'String',
    :'font_family' => :'String',
    :'font_size' => :'Integer',
    :'font_color' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/yousign_client/models/file_object_input.rb', line 294

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      file == o.file &&
      page == o.page &&
      position == o.position &&
      field_name == o.field_name &&
      mention == o.mention &&
      mention2 == o.mention2 &&
      member == o.member &&
      reason == o.reason &&
      type == o.type &&
      content_required == o.content_required &&
      content == o.content &&
      font_family == o.font_family &&
      font_size == o.font_size &&
      font_color == o.font_color
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/yousign_client/models/file_object_input.rb', line 349

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = YousignClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/yousign_client/models/file_object_input.rb', line 415

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/yousign_client/models/file_object_input.rb', line 328

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


315
316
317
# File 'lib/yousign_client/models/file_object_input.rb', line 315

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



321
322
323
# File 'lib/yousign_client/models/file_object_input.rb', line 321

def hash
  [file, page, position, field_name, mention, mention2, member, reason, type, content_required, content, font_family, font_size, font_color].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/yousign_client/models/file_object_input.rb', line 198

def list_invalid_properties
  invalid_properties = Array.new
  if @file.nil?
    invalid_properties.push('invalid value for "file", file cannot be nil.')
  end

  if !@content.nil? && @content.to_s.length > 255
    invalid_properties.push('invalid value for "content", the character length must be smaller than or equal to 255.')
  end

  if !@font_size.nil? && @font_size > 20
    invalid_properties.push('invalid value for "font_size", must be smaller than or equal to 20.')
  end

  if !@font_size.nil? && @font_size < 6
    invalid_properties.push('invalid value for "font_size", must be greater than or equal to 6.')
  end

  if !@font_color.nil? && @font_color !~ Regexp.new(/^(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d)$/)
    invalid_properties.push('invalid value for "font_color", must conform to the pattern /^(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d)$/.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



395
396
397
# File 'lib/yousign_client/models/file_object_input.rb', line 395

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



401
402
403
404
405
406
407
408
409
# File 'lib/yousign_client/models/file_object_input.rb', line 401

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



389
390
391
# File 'lib/yousign_client/models/file_object_input.rb', line 389

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/yousign_client/models/file_object_input.rb', line 225

def valid?
  return false if @file.nil?
  type_validator = EnumAttributeValidator.new('String', ['signature', 'text'])
  return false unless type_validator.valid?(@type)
  return false if !@content.nil? && @content.to_s.length > 255
  font_family_validator = EnumAttributeValidator.new('String', ['raleway'])
  return false unless font_family_validator.valid?(@font_family)
  return false if !@font_size.nil? && @font_size > 20
  return false if !@font_size.nil? && @font_size < 6
  return false if !@font_color.nil? && @font_color !~ Regexp.new(/^(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d),(0|255|25[0-4]|2[0-4]\\d|1\\d\\d|0?\\d?\\d)$/)
  true
end