Created
July 25, 2016 22:16
-
-
Save paulopatto/e4747ad730e657637ff9393992da64e1 to your computer and use it in GitHub Desktop.
Try access webmotors api with Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'savon' # savon 2.11 | |
WEB_MOTORS_WSDL = 'http://www.webmotors.com.br/integracaoRevendedor/wsEstoqueRevendedorWebMotors.asmx' | |
client = Savon.client do | |
wsdl WEB_MOTORS_WSDL | |
end | |
client.operations | |
# => [:autenticar] | |
CNPJ = "[omitido]" | |
email = "[omitido]" | |
password = "[omitido]" | |
auth_message = { | |
cnpj: CNPJ, | |
email: email, | |
senha: password | |
} | |
response = client.call(:autenticar, message: auth_message) | |
response.body | |
# => { | |
# :autenticar_response=> { | |
# :autenticar_result=>{ | |
# :hash_autenticacao=>"Erro na Autenticacao", | |
# :codigo_retorno=>"400" | |
# }, | |
# :@xmlns=>"www.webmotors.com.br/wsLoginSistemaRevendedor" | |
# } | |
# } | |
# HEADERS | |
# ======= | |
# cache-control: ["private, max-age=0", no-cache="set-cookie"] | |
# content-type: text/xml; charset=utf-8 | |
# date: Mon, 25 Jul 2016 22:08:14 GMT | |
# set-cookie: "AWSELB=FBEB4F8D0A4EA85DD70F4AB212E2DE8B1D243194C870B3DF93387A2E810A96FDFA2428DDCD0F7C4B9A62A0B075E632600B22B46736A56B690D5DBDE98FFB9F739A96EB63B8;PATH=/;MAX-AGE=3600" | |
# vary: Accept-Encoding | |
# x-powered-by: ASP.NET | |
# x-ua-compatible: IE=Edge | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment