class RocketGate::Connection

Public Class Methods

new(server, port, path) click to toggle source
# File lib/rocketgate/connection.rb, line 5
def initialize(server, port, path)
  @server, @port, @path = server, port, path
  @client               = Net::HTTP.new(server, port)

  @client.open_timeout  = RocketGate.configuration.request_timeout
  @client.read_timeout  = RocketGate.configuration.request_timeout

  if RocketGate.configuration.require_ssl
    @client.use_ssl     = true
    @client.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
end

Public Instance Methods

make_request!(request_body) click to toggle source
# File lib/rocketgate/connection.rb, line 18
def make_request!(request_body)
  request          = Net::HTTP::Post.new(@path, {
    'Accept'       => 'text/xml',
    'Content-Type' => 'text/xml',
    'User-Agent'   => "rocketgate-ruby/#{RocketGate::VERSION}"
  })

  request.body     = request_body

  @client.request(request)
end