Sha256: b346c55b3b4de4f3132359160789d7b5f814cc723d3b5700235701421c48793e

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

module Afipws
  class PersonaServiceA5
    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 + '/spec/fixtures/ws_sr_padron_a5.wsdl'
    }.freeze


    attr_reader :wsaa

    def initialize options = {}
      @cuit = options[:cuit]
      @wsaa = WSAA.new options.merge(service: 'ws_sr_padron_a5')
      @client = Client.new Hash(options[:savon]).reverse_merge(wsdl: WSDL[@wsaa.env], soap_version: 1)
    end

    def dummy
      request(:dummy)[:return]
    end

    def get_persona id
      message = @wsaa.auth.merge(cuitRepresentada: @cuit, idPersona: id)
      request(:get_persona, message)[:persona_return]
    end

    private

    def request action, body = nil
      @client.request(action, body).to_hash[:"#{action}_response"]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
afipws-2.3.0 lib/afipws/persona_service_a5.rb
afipws-2.2.0 lib/afipws/persona_service_a5.rb
afipws-2.1.0 lib/afipws/persona_service_a5.rb
afipws-2.0.0 lib/afipws/persona_service_a5.rb