Sha256: ee13c8d9ea70ff98c582583347ecddbbde693c29c7b15420c53205f686c00c6c
Contents?: true
Size: 811 Bytes
Versions: 1
Compression:
Stored size: 811 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;charset=UTF-8') request.add_field('Authorization', token) http.request(request) end def post url, payload, token = nil 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;charset=UTF-8') request.add_field('Authorization', token) if token 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.3 | lib/arlo/network_helper.rb |