Class: FMS::HTTPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/fms/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ HTTPClient

Returns a new instance of HTTPClient.



60
61
62
63
# File 'lib/fms/client.rb', line 60

def initialize(host, port)
  @host = host
  @port = port
end

Instance Method Details

#get(url, timeout) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/fms/client.rb', line 65

def get(url, timeout)
  http = Net::HTTP.new @host, @port
  unless timeout.nil?
    http.read_timeout = timeout
    http.open_timeout = timeout
  end
  http.request Net::HTTP::Get.new(url)
end