Class: YousignClient::FileObjectOutput

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FileObjectOutput

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/yousign_client/models/file_object_output.rb', line 137

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?(:'id')
    self.id = attributes[:'id']
  end

  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 (internal)')
    self.mention2__internal = attributes[:'mention2 (internal)']
  end

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

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

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

  if attributes.has_key?(:'reason')
    self.reason = attributes[:'reason']
  else
    self.reason = 'Signed by Firstname Lastname'
  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



56
57
58
# File 'lib/yousign_client/models/file_object_output.rb', line 56

def content
  @content
end

#content_requiredObject

type=text

Indicate if the member must fill or not the field



53
54
55
# File 'lib/yousign_client/models/file_object_output.rb', line 53

def content_required
  @content_required
end

#created_atObject

Created date of the object



38
39
40
# File 'lib/yousign_client/models/file_object_output.rb', line 38

def created_at
  @created_at
end

#executed_atObject

Date of signature or validation



44
45
46
# File 'lib/yousign_client/models/file_object_output.rb', line 44

def executed_at
  @executed_at
end

#field_nameObject

type=signature

Name of the signature field existing in the document



29
30
31
# File 'lib/yousign_client/models/file_object_output.rb', line 29

def field_name
  @field_name
end

#fileObject

Returns the value of attribute file.



20
21
22
# File 'lib/yousign_client/models/file_object_output.rb', line 20

def file
  @file
end

#font_colorObject

type=text

The font color used to render the field.



65
66
67
# File 'lib/yousign_client/models/file_object_output.rb', line 65

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.



59
60
61
# File 'lib/yousign_client/models/file_object_output.rb', line 59

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.



62
63
64
# File 'lib/yousign_client/models/file_object_output.rb', line 62

def font_size
  @font_size
end

#idObject

Id of the object



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

def id
  @id
end

#mentionObject

type=signature

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



32
33
34
# File 'lib/yousign_client/models/file_object_output.rb', line 32

def mention
  @mention
end

#mention2__internalObject

type=signature

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



35
36
37
# File 'lib/yousign_client/models/file_object_output.rb', line 35

def mention2__internal
  @mention2__internal
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.



23
24
25
# File 'lib/yousign_client/models/file_object_output.rb', line 23

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



26
27
28
# File 'lib/yousign_client/models/file_object_output.rb', line 26

def position
  @position
end

#reasonObject

type=signature

The reason they are signing the agreement



47
48
49
# File 'lib/yousign_client/models/file_object_output.rb', line 47

def reason
  @reason
end

#typeObject

The type of the file object



50
51
52
# File 'lib/yousign_client/models/file_object_output.rb', line 50

def type
  @type
end

#updated_atObject

Updated date of the object



41
42
43
# File 'lib/yousign_client/models/file_object_output.rb', line 41

def updated_at
  @updated_at
end

Class Method Details

.attribute_mapObject

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



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/yousign_client/models/file_object_output.rb', line 90

def self.attribute_map
  {
    :'id' => :'id',
    :'file' => :'file',
    :'page' => :'page',
    :'position' => :'position',
    :'field_name' => :'fieldName',
    :'mention' => :'mention',
    :'mention2__internal' => :'mention2 (internal)',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt',
    :'executed_at' => :'executedAt',
    :'reason' => :'reason',
    :'type' => :'type',
    :'content_required' => :'contentRequired',
    :'content' => :'content',
    :'font_family' => :'fontFamily',
    :'font_size' => :'fontSize',
    :'font_color' => :'fontColor'
  }
end

.swagger_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/yousign_client/models/file_object_output.rb', line 113

def self.swagger_types
  {
    :'id' => :'String',
    :'file' => :'FileOutput',
    :'page' => :'Integer',
    :'position' => :'String',
    :'field_name' => :'String',
    :'mention' => :'String',
    :'mention2__internal' => :'String',
    :'created_at' => :'DateTime',
    :'updated_at' => :'DateTime',
    :'executed_at' => :'DateTime',
    :'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



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/yousign_client/models/file_object_output.rb', line 320

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      file == o.file &&
      page == o.page &&
      position == o.position &&
      field_name == o.field_name &&
      mention == o.mention &&
      mention2__internal == o.mention2__internal &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      executed_at == o.executed_at &&
      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



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/yousign_client/models/file_object_output.rb', line 378

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



444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/yousign_client/models/file_object_output.rb', line 444

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



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/yousign_client/models/file_object_output.rb', line 357

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


344
345
346
# File 'lib/yousign_client/models/file_object_output.rb', line 344

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



350
351
352
# File 'lib/yousign_client/models/file_object_output.rb', line 350

def hash
  [id, file, page, position, field_name, mention, mention2__internal, created_at, updated_at, executed_at, 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



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/yousign_client/models/file_object_output.rb', line 224

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



424
425
426
# File 'lib/yousign_client/models/file_object_output.rb', line 424

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



430
431
432
433
434
435
436
437
438
# File 'lib/yousign_client/models/file_object_output.rb', line 430

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



418
419
420
# File 'lib/yousign_client/models/file_object_output.rb', line 418

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



251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/yousign_client/models/file_object_output.rb', line 251

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