class VIISP::Auth::Client
Public Instance Methods
post(document)
click to toggle source
# File lib/viisp/auth/client.rb, line 8 def post(document) with_error_handling do request = Signing.sign(document) response = connection.post('', request) xml = Nokogiri::XML(response.body) Signing.validate!(xml) xml end end
Private Instance Methods
configuration()
click to toggle source
# File lib/viisp/auth/client.rb, line 39 def configuration VIISP::Auth.configuration end
connection()
click to toggle source
# File lib/viisp/auth/client.rb, line 26 def connection @connection ||= Faraday.new(url: configuration.endpoint) do |builder| builder.options[:timeout] = configuration.read_timeout builder.options[:open_timeout] = configuration.open_timeout builder.headers['Accept'] = 'application/xml' builder.response :raise_error builder.adapter Faraday.default_adapter end end
with_error_handling() { || ... }
click to toggle source
# File lib/viisp/auth/client.rb, line 20 def with_error_handling yield rescue Faraday::ClientError => e raise(RequestError, "#{e.message}. #{e.response}") end