Sha256: bfe71fa3b3809f1e66ae652fa762c3e49394f713b4faad790b86ae0d2ad2456c
Contents?: true
Size: 1.69 KB
Versions: 9
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true module Seam class Client attr_accessor :api_key, :base_uri, :debug def initialize(api_key: nil, base_uri: "https://connect.getseam.com", debug: false) @api_key = api_key || ENV.fetch("SEAM_API_KEY", nil) @base_uri = base_uri @debug = debug raise ArgumentError, "SEAM_API_KEY not found in environment, and api_key not provided" unless @api_key end def health request_seam(:get, "/health") end def locks @locks ||= Seam::Clients::Locks.new(self) end def devices @devices ||= Seam::Clients::Devices.new(self) end def unmanaged_devices @unmanaged_devices ||= Seam::Clients::UnmanagedDevices.new(self) end def action_attempts @action_attempts ||= Seam::Clients::ActionAttempts.new(self) end def access_codes @access_codes ||= Seam::Clients::AccessCodes.new(self) end def connect_webviews @connect_webviews ||= Seam::Clients::ConnectWebviews.new(self) end def connected_accounts @connected_accounts ||= Seam::Clients::ConnectedAccounts.new(self) end def workspaces @workspaces ||= Seam::Clients::Workspaces.new(self) end def events @events ||= Seam::Clients::Events.new(self) end def request_seam_object(method, path, klass, inner_object, config = {}) response = request_seam(method, path, config) data = response[inner_object] klass.load_from_response(data, self) end def request_seam(method, path, config = {}) Seam::Request.new( api_key: api_key, base_uri: base_uri, debug: debug ).perform( method, path, config ) end end end
Version data entries
9 entries across 9 versions & 1 rubygems