Class: Seam::Client
- Inherits:
-
Object
- Object
- Seam::Client
- Defined in:
- lib/seam/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
- #access_codes ⇒ Object
- #action_attempts ⇒ Object
- #connect_webviews ⇒ Object
- #connected_accounts ⇒ Object
- #devices ⇒ Object
- #events ⇒ Object
- #health ⇒ Object
-
#initialize(api_key: nil, base_uri: "https://connect.getseam.com", debug: false) ⇒ Client
constructor
A new instance of Client.
- #locks ⇒ Object
- #request_seam(method, path, config = {}) ⇒ Object
- #request_seam_object(method, path, klass, inner_object, config = {}) ⇒ Object
- #unmanaged_access_codes ⇒ Object
- #unmanaged_devices ⇒ Object
- #workspaces ⇒ Object
Constructor Details
#initialize(api_key: nil, base_uri: "https://connect.getseam.com", debug: false) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 |
# File 'lib/seam/client.rb', line 7 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 |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/seam/client.rb', line 5 def api_key @api_key end |
#base_uri ⇒ Object
Returns the value of attribute base_uri.
5 6 7 |
# File 'lib/seam/client.rb', line 5 def base_uri @base_uri end |
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/seam/client.rb', line 5 def debug @debug end |
Instance Method Details
#access_codes ⇒ Object
35 36 37 |
# File 'lib/seam/client.rb', line 35 def access_codes @access_codes ||= Seam::Clients::AccessCodes.new(self) end |
#action_attempts ⇒ Object
31 32 33 |
# File 'lib/seam/client.rb', line 31 def action_attempts @action_attempts ||= Seam::Clients::ActionAttempts.new(self) end |
#connect_webviews ⇒ Object
43 44 45 |
# File 'lib/seam/client.rb', line 43 def connect_webviews @connect_webviews ||= Seam::Clients::ConnectWebviews.new(self) end |
#connected_accounts ⇒ Object
47 48 49 |
# File 'lib/seam/client.rb', line 47 def connected_accounts @connected_accounts ||= Seam::Clients::ConnectedAccounts.new(self) end |
#devices ⇒ Object
23 24 25 |
# File 'lib/seam/client.rb', line 23 def devices @devices ||= Seam::Clients::Devices.new(self) end |
#events ⇒ Object
55 56 57 |
# File 'lib/seam/client.rb', line 55 def events @events ||= Seam::Clients::Events.new(self) end |
#health ⇒ Object
15 16 17 |
# File 'lib/seam/client.rb', line 15 def health request_seam(:get, "/health") end |
#locks ⇒ Object
19 20 21 |
# File 'lib/seam/client.rb', line 19 def locks @locks ||= Seam::Clients::Locks.new(self) end |
#request_seam(method, path, config = {}) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/seam/client.rb', line 67 def request_seam(method, path, config = {}) Seam::Request.new( api_key: api_key, base_uri: base_uri, debug: debug ).perform( method, path, config ) end |
#request_seam_object(method, path, klass, inner_object, config = {}) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/seam/client.rb', line 59 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 |
#unmanaged_access_codes ⇒ Object
39 40 41 |
# File 'lib/seam/client.rb', line 39 def unmanaged_access_codes @unmanaged_access_codes ||= Seam::Clients::UnmanagedAccessCodes.new(self) end |
#unmanaged_devices ⇒ Object
27 28 29 |
# File 'lib/seam/client.rb', line 27 def unmanaged_devices @unmanaged_devices ||= Seam::Clients::UnmanagedDevices.new(self) end |
#workspaces ⇒ Object
51 52 53 |
# File 'lib/seam/client.rb', line 51 def workspaces @workspaces ||= Seam::Clients::Workspaces.new(self) end |