class TreezorClient::InlineResponse2004Businessinformations

Attributes

address1[RW]

Business' street

city[RW]

Business' city

country[RW]

Business' country

email[RW]

Business generic email.

phone[RW]

Business phone number.

postcode[RW]

Business' postal code

state[RW]

Business' province

status[RW]

| Code | Description | | —- | ———– | | D | Deleted | | N | Company non diffusible (Insee) | | I | Inactive (Insee) | | A | Economically active | | C | Closed | | T | Transfered | | S | Economically stopped (Insee) | | L | Liquidation | | O | Dormant company |

tradename[RW]

Business trade name

users[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 96
def self.attribute_map
  {
    :'legal_name' => :'legalName',
    :'legal_registration_number' => :'legalRegistrationNumber',
    :'legal_registration_date' => :'legalRegistrationDate',
    :'legal_form' => :'legalForm',
    :'legal_share_capital' => :'legalShareCapital',
    :'legal_sector' => :'legalSector',
    :'legal_annual_turn_over' => :'legalAnnualTurnOver',
    :'legal_net_income_range' => :'legalNetIncomeRange',
    :'legal_number_of_employee_range' => :'legalNumberOfEmployeeRange',
    :'phone' => :'phone',
    :'email' => :'email',
    :'address1' => :'address1',
    :'postcode' => :'postcode',
    :'city' => :'city',
    :'state' => :'state',
    :'country' => :'country',
    :'status' => :'status',
    :'tradename' => :'tradename',
    :'users' => :'users'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 147
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?(:'legalName')
    self.legal_name = attributes[:'legalName']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'users')
    if (value = attributes[:'users']).is_a?(Array)
      self.users = value
    end
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 121
def self.swagger_types
  {
    :'legal_name' => :'String',
    :'legal_registration_number' => :'String',
    :'legal_registration_date' => :'String',
    :'legal_form' => :'String',
    :'legal_share_capital' => :'Float',
    :'legal_sector' => :'String',
    :'legal_annual_turn_over' => :'String',
    :'legal_net_income_range' => :'String',
    :'legal_number_of_employee_range' => :'String',
    :'phone' => :'String',
    :'email' => :'String',
    :'address1' => :'String',
    :'postcode' => :'String',
    :'city' => :'String',
    :'state' => :'String',
    :'country' => :'String',
    :'status' => :'String',
    :'tradename' => :'String',
    :'users' => :'Array<InlineResponse2004Users>'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 307
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      legal_name == o.legal_name &&
      legal_registration_number == o.legal_registration_number &&
      legal_registration_date == o.legal_registration_date &&
      legal_form == o.legal_form &&
      legal_share_capital == o.legal_share_capital &&
      legal_sector == o.legal_sector &&
      legal_annual_turn_over == o.legal_annual_turn_over &&
      legal_net_income_range == o.legal_net_income_range &&
      legal_number_of_employee_range == o.legal_number_of_employee_range &&
      phone == o.phone &&
      email == o.email &&
      address1 == o.address1 &&
      postcode == o.postcode &&
      city == o.city &&
      state == o.state &&
      country == o.country &&
      status == o.status &&
      tradename == o.tradename &&
      users == o.users
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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 367
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 = TreezorClient.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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 433
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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 346
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 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) click to toggle source

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

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 333
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 339
def hash
  [legal_name, legal_registration_number, legal_registration_date, legal_form, legal_share_capital, legal_sector, legal_annual_turn_over, legal_net_income_range, legal_number_of_employee_range, phone, email, address1, postcode, city, state, country, status, tradename, users].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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 234
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
status=(status) click to toggle source

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

# File lib/treezor_client/models/inline_response_200_4_businessinformations.rb, line 297
def status=(status)
  validator = EnumAttributeValidator.new('String', ['D', 'N', 'I', 'A', 'C', 'T', 'S', 'L', 'O'])
  unless validator.valid?(status)
    fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
  end
  @status = status
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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 413
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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 419
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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 407
def to_s
  to_hash.to_s
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/treezor_client/models/inline_response_200_4_businessinformations.rb, line 241
def valid?
  legal_form_validator = EnumAttributeValidator.new('String', ['1000', '1100', '1200', '1300', '1400', '1500', '1600', '1700', '1800', '1900', '2110', '2120', '2210', '2220', '2310', '2320', '2385', '2400', '2700', '2900', '3110', '3120', '3205', '3210', '3220', '3290', '4110', '4120', '4130', '4140', '4150', '4160', '5191', '5192', '5193', '5194', '5195', '5196', '5202', '5203', '5306', '5307', '5308', '5309', '5385', '5410', '5415', '5422', '5426', '5430', '5431', '5432', '5442', '5443', '5451', '5453', '5454', '5455', '5458', '5459', '5460', '5485', '5498', '5499', '5505', '5510', '5515', '5520', '5522', '5525', '5530', '5531', '5532', '5542', '5543', '5546', '5547', '5548', '5551', '5552', '5553', '5554', '5555', '5558', '5559', '5560', '5585', '5599', '5605', '5610', '5615', '5620', '5622', '5625', '5630', '5631', '5632', '5642', '5643', '5646', '5647', '5648', '5651', '5652', '5653', '5654', '5655', '5658', '5659', '5660', '5685', '5699', '5710', '5720', '5785', '5800', '6100', '6210', '6220', '6316', '6317', '6318', '6411', '6521', '6532', '6533', '6534', '6535', '6536', '6537', '6538', '6539', '6540', '6541', '6542', '6543', '6544', '6551', '6554', '6558', '6560', '6561', '6562', '6563', '6564', '6565', '6566', '6567', '6568', '6569', '6571', '6572', '6573', '6574', '6575', '6576', '6577', '6578', '6585', '6588', '6589', '6595', '6596', '6597', '6598', '6599', '6901', '7111', '7112', '7113', '7120', '7150', '7160', '7171', '7172', '7179', '7190', '7210', '7220', '7225', '7229', '7230', '7312', '7313', '7314', '7321', '7322', '7323', '7331', '7340', '7341', '7342', '7343', '7344', '7345', '7346', '7347', '7348', '7349', '7351', '7352', '7353', '7354', '7355', '7356', '7361', '7362', '7363', '7364', '7365', '7366', '7371', '7372', '7373', '7378', '7379', '7381', '7382', '7383', '7384', '7385', '7389', '7410', '7430', '7450', '7470', '7490', '8110', '8120', '8130', '8140', '8150', '8160', '8170', '8190', '8210', '8250', '8290', '8310', '8311', '8410', '8420', '8450', '8470', '8490', '8510', '8520', '9110', '9150', '9210', '9220', '9221', '9222', '9223', '9224', '9230', '9240', '9260', '9300', '9900', '9970'])
  return false unless legal_form_validator.valid?(@legal_form)
  legal_annual_turn_over_validator = EnumAttributeValidator.new('String', ['', '0-39', '40-99', '100-249', '250-999', '1000-2999', '3000-9999', '10000-99999', '100000-*'])
  return false unless legal_annual_turn_over_validator.valid?(@legal_annual_turn_over)
  legal_net_income_range_validator = EnumAttributeValidator.new('String', ['', '0-4', '5-9', '10-49', '50-149', '150-499', '500-*'])
  return false unless legal_net_income_range_validator.valid?(@legal_net_income_range)
  legal_number_of_employee_range_validator = EnumAttributeValidator.new('String', ['', '0', '1-9', '10-99', '100-249', '250-*'])
  return false unless legal_number_of_employee_range_validator.valid?(@legal_number_of_employee_range)
  status_validator = EnumAttributeValidator.new('String', ['D', 'N', 'I', 'A', 'C', 'T', 'S', 'L', 'O'])
  return false unless status_validator.valid?(@status)
  true
end