Sha256: 5955c3d7403d518e026b2b4ded506df4b59925f97d76cf91b89e00bb6027486a

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

class Valvat
  module Lookup
    class Request
      def initialize(vat)
        @vat = vat
      end
      
      def perform(client)
        client.request("n1", action) do
          soap.body = body
          soap.namespaces["xmlns:n1"] = "urn:ec.europa.eu:taxud:vies:services:checkVat:types"    
        end.to_hash[response_key]
      end
      
      private
      
      def body
        {"n1:countryCode" => @vat.vat_country_code, "n1:vatNumber" => @vat.to_s_wo_country}
      end
      
      def action
        "checkVat"
      end
      
      def response_key
        :check_vat_response
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valvat-0.4.1 lib/valvat/lookup/request.rb
valvat-0.4.0 lib/valvat/lookup/request.rb