class YousignClient::FileObjectOutput

Attributes

content[RW]
type=text

The content of the field. Could be used for placeholder

content_required[RW]
type=text

Indicate if the member must fill or not the field

created_at[RW]

Created date of the object

executed_at[RW]

Date of signature or validation

field_name[RW]
type=signature

Name of the signature field existing in the document

file[RW]
font_color[RW]
type=text

The font color used to render the field.

font_family[RW]
type=text

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

font_size[RW]
type=text

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

id[RW]

Id of the object

mention[RW]
type=signature

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

mention2__internal[RW]
type=signature

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

page[RW]

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.

position[RW]

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

reason[RW]
type=signature

The reason they are signing the agreement

type[RW]

The type of the file object

updated_at[RW]

Updated date of the object

Public Class Methods

attribute_map() click to toggle source

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

# 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
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# 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
swagger_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# 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) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# 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) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# 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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# 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
content=(content) click to toggle source

Custom attribute writer method with validation @param [Object] content Value to be assigned

# File lib/yousign_client/models/file_object_output.rb, line 276
def content=(content)
  if !content.nil? && content.to_s.length > 255
    fail ArgumentError, 'invalid value for "content", the character length must be smaller than or equal to 255.'
  end

  @content = content
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/yousign_client/models/file_object_output.rb, line 344
def eql?(o)
  self == o
end
font_color=(font_color) click to toggle source

Custom attribute writer method with validation @param [Object] font_color Value to be assigned

# File lib/yousign_client/models/file_object_output.rb, line 310
def font_color=(font_color)
  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)$/)
    fail ArgumentError, '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

  @font_color = font_color
end
font_family=(font_family) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] font_family Object to be assigned

# File lib/yousign_client/models/file_object_output.rb, line 286
def font_family=(font_family)
  validator = EnumAttributeValidator.new('String', ['raleway'])
  unless validator.valid?(font_family)
    fail ArgumentError, 'invalid value for "font_family", must be one of #{validator.allowable_values}.'
  end
  @font_family = font_family
end
font_size=(font_size) click to toggle source

Custom attribute writer method with validation @param [Object] font_size Value to be assigned

# File lib/yousign_client/models/file_object_output.rb, line 296
def font_size=(font_size)
  if !font_size.nil? && font_size > 20
    fail ArgumentError, 'invalid value for "font_size", must be smaller than or equal to 20.'
  end

  if !font_size.nil? && font_size < 6
    fail ArgumentError, 'invalid value for "font_size", must be greater than or equal to 6.'
  end

  @font_size = font_size
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# 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_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# 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_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/yousign_client/models/file_object_output.rb, line 424
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# 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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/yousign_client/models/file_object_output.rb, line 418
def to_s
  to_hash.to_s
end
type=(type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] type Object to be assigned

# File lib/yousign_client/models/file_object_output.rb, line 266
def type=(type)
  validator = EnumAttributeValidator.new('String', ['signature', 'text'])
  unless validator.valid?(type)
    fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
  end
  @type = type
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# 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