Class: Netting

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

Overview

A wrapper around Net::HTTP::Post and Get methods.

Constant Summary collapse

@@Timeout =

sec

4

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Netting

A full URL has to be given, starting with http:, ending in the port (if port is not the default)



13
14
15
# File 'lib/netting.rb', line 13

def initialize url
  @url = url
end

Instance Method Details

#get(*stuff) ⇒ Object

Sends HTTP GET and returns the answer



25
26
27
# File 'lib/netting.rb', line 25

def get *stuff
  send_req Net::HTTP::Get, *stuff
end

#post(*stuff) ⇒ Object

Sends HTTP POST, data as json



19
20
21
# File 'lib/netting.rb', line 19

def post *stuff
  send_req Net::HTTP::Post, *stuff
end