Sha256: d1601f80bf42da38db4b44e8adb0ff36e86dd9d02d25da173b9492f5736938c2
Contents?: true
Size: 560 Bytes
Versions: 2
Compression:
Stored size: 560 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 = {}) HTTP.basic_auth(user: api_key, pass: api_secret).get(url(path), 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.1 | lib/housecanary/connection.rb |
housecanary-ruby-0.1.0 | lib/housecanary/connection.rb |