Sha256: 18bb0683f2c3718341ca3ac273bde38af35e63a8c048e18f1dab0cd44f2b4823

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

require 'cnh/version'
require 'open-uri'
require 'net/http'

# Validates the Brazilian Transit Driver's License
class CNH
  class << self
    def valid?(cnh)
      data = { acao: 'validar_cnh', txt_cnh: cnh }
      url = URI.parse('https://www.4devs.com.br/ferramentas_online.php')
      http = Net::HTTP.new(url.host, url.port)
      http.use_ssl = (url.scheme == 'https')
      resp = http.send_request('POST', data)
      resp.body.downcase.include? 'falso'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cnh-0.1.0 lib/cnh.rb