Sha256: 577866534a8ae4feea7cf0c9d1fa0a1deb6cb3f666af5d035f59086758272550

Contents?: true

Size: 1019 Bytes

Versions: 8

Compression:

Stored size: 1019 Bytes

Contents

module FastshopCatalog
  module Entity
    class Address < BaseEntity

      HOME_TYPE_HOUSE = '1'
      HOME_TYPE_APARTMENT = '2'
      HOME_TYPE_CONDO = '3'
      HOME_TYPE_COMPANY = '4'

      HOME_TYPE_DESCRIPTION_MAP = {'1' => 'CASA', '2' => 'APARTAMENTO',
        '3' => 'CONDOMINIO', '4' => 'EMPRESA'}

      translate :description => 'Descricao', 
      :address_type => 'TipoEndereco', :document => 'CPF', :registry => 'RG',
      :birth_date => 'DataNascimento', :address => 'Endereco', 
      :number => 'Numero', :complement => 'Complemento',
      :neighborhood  => 'Bairro', :city => 'Cidade',
      :state => 'Estado', :zip_code => 'Cep',
      :home_type_id => 'TipoMoradiaId', 
      :home_type_description => 'TipoMoradiaDescricao'
      
      def home_type=(home_type)
        raise ArgumentError.new('Invalid home type') unless (1..4).member? home_type.to_i
        self.home_type_id = home_type
        self.home_type_description = HOME_TYPE_DESCRIPTION_MAP[home_type]
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fastshop_catalog-0.0.8 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.7 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.6 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.5 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.4 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.3 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.2 lib/fastshop_catalog/entity/address.rb
fastshop_catalog-0.0.1 lib/fastshop_catalog/entity/address.rb