Sha256: 0093fc1cc35a0c7907e87d7392935cda19b5e70def00c0cd40fa552e844fe77f

Contents?: true

Size: 413 Bytes

Versions: 5

Compression:

Stored size: 413 Bytes

Contents

module ActiveAdmin
  module CepAutoComplete
    class Query
      def self.search(cep)
        address = PostmonRuby::Client.search(:cep, cep)

        unless address.not_found
          {
            cep: cep,
            state: address.estado,
            city: address.cidade,
            neighborhood: address.bairro,
            street: address.logradouro
          }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_admin-cep_auto_complete-0.2.3 lib/active_admin/cep_auto_complete/query.rb
active_admin-cep_auto_complete-0.2.2 lib/active_admin/cep_auto_complete/query.rb
active_admin-cep_auto_complete-0.2.1 lib/active_admin/cep_auto_complete/query.rb
active_admin-cep_auto_complete-0.2.0 lib/active_admin/cep_auto_complete/query.rb
active_admin-cep_auto_complete-0.1.0 lib/active_admin/cep_auto_complete/query.rb