Class: Biro::Spc::Request
Constant Summary
collapse
- SCORE_3_MONTHS =
77
- SCORE_12_MONTHS =
78
Instance Method Summary
collapse
#soap, #wsdl
Methods inherited from BaseRequest
#initialize, #url
Instance Method Details
#development_url ⇒ Object
9
10
11
|
# File 'lib/biro/gateways/spc/request.rb', line 9
def development_url
'https://treina.spc.org.br/spc/remoting/ws/consulta/consultaWebService?wsdl'
end
|
#display_products ⇒ Object
37
38
39
40
|
# File 'lib/biro/gateways/spc/request.rb', line 37
def display_products
response = soap.call(:listar_produtos, xml: '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /><soapenv:Body /></soapenv:Envelope>')
response.body
end
|
#find(document, options = {}) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/biro/gateways/spc/request.rb', line 21
def find(document, options = {})
begin
params = {}
add_basic_info(params, document, options[:kind] || 'F', options[:product_code])
add_score_info(params) if options[:include_score]
response = soap.call(:consultar, message: params)
Response.new(response)
rescue => e
Biro.log(:warn, "Unable to process SPC request")
raise AuthenticationError.new("Error at SPC request: #{e.message}") if e.message.include?("CS_AUT")
raise DocumentNotFoundError.new("Error at SPC request: #{e.message}") if e.message.include?("CPF inválido") || e.message.include?("(7)")
raise StandardError.new("Error at SPC request: #{e.message}")
end
end
|
#production_url ⇒ Object
13
14
15
|
# File 'lib/biro/gateways/spc/request.rb', line 13
def production_url
'https://servicos.spc.org.br/spc/remoting/ws/consulta/consultaWebService?wsdl'
end
|
#required_params ⇒ Object
17
18
19
|
# File 'lib/biro/gateways/spc/request.rb', line 17
def required_params
[:username, :password]
end
|