Sha256: 84f061b8dcbb3038b57bc679c764b627838147487007fd8381c773b05e4d3823
Contents?: true
Size: 680 Bytes
Versions: 2
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true require 'dry-initializer' require 'http' module Housecanary class Connection #:nodoc: extend Dry::Initializer BASE_URL = 'https://api.housecanary.com/v2/' option :api_key option :api_secret def post(path, params = {}) HTTP.basic_auth(user: api_key, pass: api_secret).post(url(path), params) end def get(path, params = {}) ctx = OpenSSL::SSL::SSLContext.new ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE HTTP.basic_auth(user: api_key, pass: api_secret).get(url(path), { ssl_context: ctx }.merge(params)) end private def url(path) URI.join(BASE_URL, path) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
housecanary-ruby-0.1.3 | lib/housecanary/connection.rb |
housecanary-ruby-0.1.2 | lib/housecanary/connection.rb |