Sha256: 6c6b09e8cc9a242eacd89fb0700fb6e93d2403d38169e05befc4100cac06d464
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
require 'net/http' require 'uri' require 'json' require 'openssl' module Arlo class API def get url, token uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri) request.add_field('Content-Type', 'application/json') request.add_field('Authorization', token) http.request(request) end def post url, payload uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request.add_field('Content-Type', 'application/json') request.body = payload.to_json http.request(request) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arlo-0.0.2 | lib/arlo/network_helper.rb |