search_for_plate 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/search_for_plate.rb +28 -0
- data/lib/search_for_plate/version.rb +8 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 47aaa9e878c46434ad7606951fa87b42ef0eb31f
|
|
4
|
+
data.tar.gz: bebc0e42edd078078149fbf44bb747d3392a91cb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6ee679ef1f8993406fb7d1a31a390febd0b26755941d04228ea246778bfd7c312ad689a6e81066c7b0a379b44ea026aabb8f49532ff490b765b4ccaac06d3b42
|
|
7
|
+
data.tar.gz: 820ad353043a8917b2d2abd40b40b4f281c8f251182a15100af8f7156577df4688f2667951de4068e5b06bf8f1b1c466e2d5a14833c6cb1c6b0d911e07d3e89e
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require "uri"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require 'base64'
|
|
4
|
+
require 'cgi'
|
|
5
|
+
require 'openssl'
|
|
6
|
+
require 'active_support/core_ext/hash'
|
|
7
|
+
HOST_KEY = "shienshenlhq"
|
|
8
|
+
|
|
9
|
+
module SearchForPlate
|
|
10
|
+
def self.search_plate(plate)
|
|
11
|
+
hmac = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), HOST_KEY.encode("ASCII"), plate.encode("ASCII"))
|
|
12
|
+
latitude = rand(-90.000000000...90.000000000)
|
|
13
|
+
longitude = rand(-180.000000000...180.000000000)
|
|
14
|
+
puts hmac
|
|
15
|
+
|
|
16
|
+
http = Net::HTTP.new('sinespcidadao.sinesp.gov.br', 80)
|
|
17
|
+
http.use_ssl = false
|
|
18
|
+
path = '/sinesp-cidadao/ConsultaPlacaNovo27032014'
|
|
19
|
+
data = %Q{<?xml version="1.0" encoding="utf-8" standalone="yes" ?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ><soap:Header><dispositivo>GT-S1312L</dispositivo><nomeSO>Android</nomeSO><versaoAplicativo>1.1.1</versaoAplicativo><versaoSO>4.1.4</versaoSO><aplicativo>aplicativo</aplicativo><ip>177.206.169.90</ip><token>#{hmac}</token><latitude>#{latitude}</latitude><longitude>#{longitude}</longitude></soap:Header><soap:Body><webs:getStatus xmlns:webs="http://soap.ws.placa.service.sinesp.serpro.gov.br/"><placa>#{plate}</placa></webs:getStatus></soap:Body></soap:Envelope>\n/sinesp-cidadao/ConsultaPlaca HTTP/1.1\r<br>\r\n}
|
|
20
|
+
headers = {'Host' => 'sinespcidadao.sinesp.gov.br', 'Content-Type' => "application/x-www-form-urlencoded; charset=UTF-8", "Accept" => "text/plain, */*; q=0.01", "Cache-Control" => "no-cache", "Pragma" => "no-cache", "x-wap-profile" => "http://wap.samsungmobile.com/uaprof/GT-S7562.xml", "Content-length" => data.size.to_s, "User-Agent" => "Mozilla/5.0 (Linux; U; Android 4.1.4; pt-br; GT-S1162L Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"}
|
|
21
|
+
|
|
22
|
+
resp, data = http.post(path, data, headers)
|
|
23
|
+
puts data.inspect
|
|
24
|
+
return Hash.from_xml(resp.body).inspect
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: search_for_plate
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jose Aureliano
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-07-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple gem for search cars details from car plate
|
|
14
|
+
email:
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/search_for_plate.rb
|
|
20
|
+
- lib/search_for_plate/version.rb
|
|
21
|
+
homepage:
|
|
22
|
+
licenses: []
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.4.6
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: Search car details in Brazil
|
|
44
|
+
test_files: []
|