Module: SinespClientV2

Includes:
HTTParty
Defined in:
lib/sinesp_client_v2.rb,
lib/sinesp_client_v2/version.rb

Constant Summary collapse

BASE_URL =
'189.9.194.154'.freeze
ANDROID_VERSION =
'8.1.0'.freeze
KEYBASE =
'Mw6HqdLgQsX41xAGZgsF'.freeze
SECRET_KEY =
"##{ANDROID_VERSION}##{KEYBASE}".freeze
VERSION =
"0.1.7"

Class Method Summary collapse

Class Method Details

.search(plate, proxy = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sinesp_client_v2.rb', line 14

def self.search(plate, proxy = {})
  unless proxy.empty?
    configure_proxy(proxy[:host], proxy[:port], proxy[:user], proxy[:password])
  end

  @plate = plate.gsub(/\W+/, '')
  
  response = post(
    "https://#{BASE_URL}/sinesp-cidadao/mobile/consultar-placa/v3",
    body: body,
    headers: header,
    timeout: 10,
    cookies: captcha_cookie,
    verify: false
  )
  
  response["Envelope"]["Body"]["getStatusResponse"]["return"].to_h
end