Sha256: d43d6f613658585bc03cb7ab12438da5ce8694bf32a4f83c1391736a291b9a5a
Contents?: true
Size: 1.88 KB
Versions: 4
Compression:
Stored size: 1.88 KB
Contents
module Biro module Ph3a class Request < BaseRequest include Utils::Soap def development_url 'https://ws.databusca.com.br/DataHistory.svc?wsdl' end def production_url 'https://ws.databusca.com.br/DataHistory.svc?wsdl' end def required_params [:username, :password, :domain] end def find(document) raise AuthenticationError.new('Invalid authentication credentials') if token.blank? begin params = {} get_parameters params, document response = soap.call(:get_person_data, message: params) Response.new(response) rescue => e Biro.log(:warn, "Unable to process Ph3a request") raise StandardError.new("Error at PH3A request: #{e.message}") end end private def token @token ||= get_token end def get_token login_params = {} get_login_parameters login_params begin response = soap.call(:login, message: login_params) rescue raise AuthenticationError.new('Authentication Error') end LoginBuilder.new(response).token end def get_login_parameters login_params login_params['tns:user'] = {} login_params['tns:user']['ph3a:DomainId'] = @domain login_params['tns:user']['ph3a:Password'] = @password login_params['tns:user']['ph3a:UserName'] = @username end def get_parameters params, document params['tns:token'] = token params['tns:document'] = document end def savon_options { namespaces: { "xmlns:soapenv"=>"http://schemas.xmlsoap.org/soap/envelope/", "xmlns:tem"=>"http://tempuri.org/", "xmlns:ph3a"=>"http://schemas.datacontract.org/2004/07/PH3A.Viper.Web.PortalService.Models" }} end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
biro-0.6.2 | lib/biro/gateways/ph3a/request.rb |
biro-0.6.1 | lib/biro/gateways/ph3a/request.rb |
biro-0.3.0 | lib/biro/gateways/ph3a/request.rb |
biro-0.2.0 | lib/biro/gateways/ph3a/request.rb |