Sha256: c6daa56af01d34b44da8f93d4bc321eb7cc939145849aa2f73e5859207f9c1c9

Contents?: true

Size: 987 Bytes

Versions: 7

Compression:

Stored size: 987 Bytes

Contents

module Afipws
  class PersonaServiceA4
    WSDL = {
      development: 'https://awshomo.afip.gov.ar/sr-padron/webservices/personaServiceA4?WSDL',
      production: 'https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA4?WSDL',
      test: Root + '/spec/fixtures/ws_sr_padron_a4.wsdl'
    }.freeze

    attr_reader :wsaa

    def initialize options = {}
      @cuit = options[:cuit]
      @wsaa = WSAA.new options.merge(service: 'ws_sr_padron_a4')
      @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][:persona]
    end

    private

    def request action, body = nil
      @client.request(action, body).to_hash[:"#{action}_response"]
    rescue Savon::SOAPFault => f
      raise WSError, f.message
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
afipws-1.3.2 lib/afipws/persona_service_a4.rb
afipws-1.3.1 lib/afipws/persona_service_a4.rb
afipws-1.3.0 lib/afipws/persona_service_a4.rb
afipws-1.2.3 lib/afipws/persona_service_a4.rb
afipws-1.2.2 lib/afipws/persona_service_a4.rb
afipws-1.2.1 lib/afipws/persona_service_a4.rb
afipws-1.2.0 lib/afipws/persona_service_a4.rb