Sha256: 23026e481287ec1d0e52c96b7fc78876ca19011e49f1949fb535bd06338cf78a
Contents?: true
Size: 679 Bytes
Versions: 3
Compression:
Stored size: 679 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
housecanary-ruby-0.2.2 | lib/housecanary/connection.rb |
housecanary-ruby-0.2.1 | lib/housecanary/connection.rb |
housecanary-ruby-0.2.0 | lib/housecanary/connection.rb |