Class: Arca::PersonaServiceA5
- Inherits:
-
Object
- Object
- Arca::PersonaServiceA5
- Defined in:
- lib/arca/persona_service_a5.rb
Constant Summary collapse
- WSDL =
{ development: "https://awshomo.afip.gov.ar/sr-padron/webservices/personaServiceA5?WSDL", production: "https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA5?WSDL", test: "#{Root}/test/fixtures/ws_sr_padron_a5.wsdl" }.freeze
Instance Attribute Summary collapse
-
#wsaa ⇒ Object
readonly
Returns the value of attribute wsaa.
Instance Method Summary collapse
- #dummy ⇒ Object
- #get_persona(id) ⇒ Object
-
#get_persona_list(ids) ⇒ Object
Request many personas in one SOAP call.
-
#initialize(options = {}) ⇒ PersonaServiceA5
constructor
A new instance of PersonaServiceA5.
Constructor Details
#initialize(options = {}) ⇒ PersonaServiceA5
Returns a new instance of PersonaServiceA5.
13 14 15 16 17 |
# File 'lib/arca/persona_service_a5.rb', line 13 def initialize( = {}) @cuit = [:cuit] @wsaa = WSAA.new .merge(service: "ws_sr_padron_a5") @client = Client.new Hash([:savon]).reverse_merge(wsdl: WSDL[@wsaa.env], soap_version: 1) end |
Instance Attribute Details
#wsaa ⇒ Object (readonly)
Returns the value of attribute wsaa.
11 12 13 |
# File 'lib/arca/persona_service_a5.rb', line 11 def wsaa @wsaa end |
Instance Method Details
#dummy ⇒ Object
19 20 21 |
# File 'lib/arca/persona_service_a5.rb', line 19 def dummy request(:dummy)[:return] end |
#get_persona(id) ⇒ Object
23 24 25 26 |
# File 'lib/arca/persona_service_a5.rb', line 23 def get_persona(id) = @wsaa.auth.merge(cuitRepresentada: @cuit, idPersona: id) request(:get_persona, )[:persona_return] end |
#get_persona_list(ids) ⇒ Object
Request many personas in one SOAP call. ids: array of CUIT/id_persona. Returns array of persona_return hashes (same shape as get_persona per element).
30 31 32 33 34 35 36 37 38 |
# File 'lib/arca/persona_service_a5.rb', line 30 def get_persona_list(ids) ids = Array(ids) return [] if ids.empty? = @wsaa.auth.merge(cuitRepresentada: @cuit, idPersona: ids.map(&:to_s)) raw = request(:get_persona_list, )[:persona_list_return] personas = raw[:persona] Array.wrap(personas).compact end |