Sha256: 90cb3e71acd985164ae31d371b6b487fb3fcf7601940b1bb613dd56a6aa05130

Contents?: true

Size: 656 Bytes

Versions: 4

Compression:

Stored size: 656 Bytes

Contents

module Afipws
  class Client
    def initialize savon_options
      @client = Savon.client savon_options.reverse_merge(soap_version: 2)
    end
    
    def request action, body = nil
      response = raw_request(action, body).to_hash[:"#{action}_response"][:"#{action}_result"]
      if response[:errors]
        raise WSError, Array.wrap(response[:errors][:err])
      else
        response
      end
    end
    
    def raw_request action, body = nil
      @client.call action, message: body
    end
    
    def operations
      @client.operations
    end
    
    def method_missing method_sym, *args
      request method_sym, *args
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
afipws-1.0.3 lib/afipws/client.rb
afipws-1.0.2 lib/afipws/client.rb
afipws-1.0.1 lib/afipws/client.rb
afipws-1.0.0 lib/afipws/client.rb