Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit bf6b4b2

Browse files
feat: Add unmanaged_devices.get method, add is_managed and capabilities_supported props to unmanaged device object (#62)
1 parent 1442680 commit bf6b4b2

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

lib/seam/clients/unmanaged_devices.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
module Seam
44
module Clients
55
class UnmanagedDevices < BaseClient
6+
def get(device_id = nil, name: nil)
7+
request_seam_object(
8+
:get,
9+
"/devices/unmanaged/get",
10+
Seam::UnmanagedDevice,
11+
"device",
12+
params: {
13+
device_id: device_id,
14+
name: name
15+
}.compact
16+
)
17+
end
18+
619
def list(params = {})
720
request_seam_object(
821
:get,

lib/seam/resources/unmanaged_device.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Seam
44
class UnmanagedDevice < BaseResource
5-
attr_accessor :device_id, :device_type, :properties, :connected_account_id, :workspace_id
5+
attr_accessor :device_id, :device_type, :properties, :connected_account_id, :workspace_id, :capabilities_supported, :is_managed
66

77
date_accessor :created_at
88

spec/clients/unmanaged_devices_spec.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,46 @@
33
RSpec.describe Seam::Clients::UnmanagedDevices do
44
let(:client) { Seam::Client.new(api_key: "some_api_key") }
55

6+
describe "#get" do
7+
context "'device_id' param" do
8+
let(:device_id) { "123" }
9+
let(:device_hash) { {device_id: device_id} }
10+
11+
before do
12+
stub_seam_request(
13+
:get, "/devices/unmanaged/get", {device: device_hash}
14+
).with(
15+
query: {device_id: device_id}
16+
)
17+
end
18+
19+
let(:result) { client.unmanaged_devices.get(device_id) }
20+
21+
it "returns an unmanaged Device" do
22+
expect(result).to be_a(Seam::UnmanagedDevice)
23+
end
24+
end
25+
26+
context "'name' param" do
27+
let(:name) { "name 123" }
28+
let(:device_hash) { {name: name} }
29+
30+
before do
31+
stub_seam_request(
32+
:get, "/devices/unmanaged/get", {device: device_hash}
33+
).with(
34+
query: {name: name}
35+
)
36+
end
37+
38+
let(:result) { client.unmanaged_devices.get(name: name) }
39+
40+
it "returns an unmanaged Device" do
41+
expect(result).to be_a(Seam::UnmanagedDevice)
42+
end
43+
end
44+
end
45+
646
describe "#list" do
747
let(:device_hash) { {device_id: "123"} }
848

0 commit comments

Comments
 (0)