Module: OBIX::Network
Defined Under Namespace
Instance Method Summary collapse
-
#get(url) ⇒ Object
Make a get request.
-
#post(url, object = nil) ⇒ Object
Make a post request.
Instance Method Details
#get(url) ⇒ Object
Make a get request.
url - A String describing where the request should be sent. object - A Objects::Object or derivative thereof describing the OBIX element to send.
13 14 15 16 17 18 |
# File 'lib/obix/network.rb', line 13 def get url url = URI url request = HTTP::Get.new url.path dispatch request, to: url end |
#post(url, object = nil) ⇒ Object
Make a post request.
url - A String describing where the request should be sent. object - A Objects::Object or derivative thereof describing the OBIX element to send.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/obix/network.rb', line 24 def post url, object = nil url = URI url request = HTTP::Post.new url.path if object request.body = object.to_xml end dispatch request, to: url end |