Class: FakeUpdater
- Inherits:
-
Object
- Object
- FakeUpdater
- Defined in:
- bin/finexclub_updater
Instance Method Summary collapse
-
#initialize(host, port) ⇒ FakeUpdater
constructor
A new instance of FakeUpdater.
- #join_params(params) ⇒ Object
- #send(generator, options = {}) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ FakeUpdater
Returns a new instance of FakeUpdater.
121 122 123 124 |
# File 'bin/finexclub_updater', line 121 def initialize(host, port) @host = host @port = port end |
Instance Method Details
#join_params(params) ⇒ Object
139 140 141 |
# File 'bin/finexclub_updater', line 139 def join_params(params) params.map {|k,v| "#{CGI::escape(k)}=#{CGI::escape(v.to_s)}"}.join('&') end |
#send(generator, options = {}) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'bin/finexclub_updater', line 126 def send(generator, = {}) puts "Sending '#{generator.name}' to #{@host}:#{@port}" begin data = join_params(generator.generate()) http = Net::HTTP.new(@host, @port) response = http.post("/#{generator.name}", data) puts "Done... #{response.value}" rescue Exception => e puts "...Failed!" puts e. end end |