Module: Mtbb::NetThings
- Defined in:
- lib/mtbb.rb
Instance Method Summary collapse
- #delete_request(options = {}) ⇒ Object
- #get_request(options = {}) ⇒ Object
- #http(method_name, path, options = {}) ⇒ Object
- #post_request(options = {}) ⇒ Object
Instance Method Details
#delete_request(options = {}) ⇒ Object
281 282 283 284 285 286 |
# File 'lib/mtbb.rb', line 281 def delete_request( = {}) perform_request( Net::HTTP::Delete.new([:path] || '/'), .fetch(:port) ) end |
#get_request(options = {}) ⇒ Object
274 275 276 277 278 279 |
# File 'lib/mtbb.rb', line 274 def get_request( = {}) perform_request( Net::HTTP::Get.new([:path] || '/'), .fetch(:port) ) end |
#http(method_name, path, options = {}) ⇒ Object
262 263 264 265 |
# File 'lib/mtbb.rb', line 262 def http(method_name, path, = {}) [:path] ||= path send("#{method_name.downcase}_request", ) end |
#post_request(options = {}) ⇒ Object
267 268 269 270 271 272 |
# File 'lib/mtbb.rb', line 267 def post_request( = {}) request = Net::HTTP::Post.new([:path] || '/') request.content_type = 'application/x-www-form-urlencoded' request.body = .fetch(:body) perform_request(request, .fetch(:port)) end |