Class: Ipiranga::PF

Inherits:
Client show all
Defined in:
lib/ipiranga/clients/pf.rb

Instance Attribute Summary

Attributes inherited from Client

#password, #soap, #username, #wsdl

Instance Method Summary collapse

Methods inherited from Client

#has_credentials?, #initialize, #operation, #operations, #post

Constructor Details

This class inherits a constructor from Ipiranga::Client

Instance Method Details

#cadastrar(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ipiranga/clients/pf.rb', line 13

def cadastrar(&block)
  result = post_cadastrar(&block).body_hash["cadastrarResult"]

  raise_exception(result) if result["status"].nil? || result["status"] == "false"

  if result["status"] == "true" && result["statusMimetica"] == "2"
    raise UserAlreadyExists.new(result)
  end

  return result["statusMimetica"] == "0"
end

#wsdl_urlObject



5
6
7
8
9
10
11
# File 'lib/ipiranga/clients/pf.rb', line 5

def wsdl_url
  if defined?(RAILS_ENV) && RAILS_ENV == "production"
    "https://b2b.ipiranga.com.br/csp/ensb2cws/cbpi.bs.participantePF.Service.CLS?WSDL=1"
  else
    "https://b2bdv.ipiranga.com.br/csp/ensb2cws/cbpi.bs.participantePF.Service.CLS?WSDL=1"
  end
end