Class: Seam::Clients::Spaces

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/clients/spaces.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ Spaces

Returns a new instance of Spaces.



6
7
8
9
# File 'lib/seam/routes/clients/spaces.rb', line 6

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#add_acs_entrances(acs_entrance_ids:, space_id:) ⇒ Object



11
12
13
14
15
# File 'lib/seam/routes/clients/spaces.rb', line 11

def add_acs_entrances(acs_entrance_ids:, space_id:)
  @client.post("/spaces/add_acs_entrances", {acs_entrance_ids: acs_entrance_ids, space_id: space_id}.compact)

  nil
end

#add_devices(device_ids:, space_id:) ⇒ Object



17
18
19
20
21
# File 'lib/seam/routes/clients/spaces.rb', line 17

def add_devices(device_ids:, space_id:)
  @client.post("/spaces/add_devices", {device_ids: device_ids, space_id: space_id}.compact)

  nil
end

#create(name:, acs_entrance_ids: nil, customer_key: nil, device_ids: nil, space_key: nil) ⇒ Object



23
24
25
26
27
# File 'lib/seam/routes/clients/spaces.rb', line 23

def create(name:, acs_entrance_ids: nil, customer_key: nil, device_ids: nil, space_key: nil)
  res = @client.post("/spaces/create", {name: name, acs_entrance_ids: acs_entrance_ids, customer_key: customer_key, device_ids: device_ids, space_key: space_key}.compact)

  Seam::Resources::Space.load_from_response(res.body["space"])
end

#delete(space_id:) ⇒ Object



29
30
31
32
33
# File 'lib/seam/routes/clients/spaces.rb', line 29

def delete(space_id:)
  @client.post("/spaces/delete", {space_id: space_id}.compact)

  nil
end

#get(space_id: nil, space_key: nil) ⇒ Object



35
36
37
38
39
# File 'lib/seam/routes/clients/spaces.rb', line 35

def get(space_id: nil, space_key: nil)
  res = @client.post("/spaces/get", {space_id: space_id, space_key: space_key}.compact)

  Seam::Resources::Space.load_from_response(res.body["space"])
end


41
42
43
44
45
# File 'lib/seam/routes/clients/spaces.rb', line 41

def get_related(exclude: nil, include: nil, space_ids: nil, space_keys: nil)
  res = @client.post("/spaces/get_related", {exclude: exclude, include: include, space_ids: space_ids, space_keys: space_keys}.compact)

  Seam::Resources::Batch.load_from_response(res.body["batch"])
end

#list(connected_account_id: nil, customer_key: nil, search: nil, space_key: nil) ⇒ Object



47
48
49
50
51
# File 'lib/seam/routes/clients/spaces.rb', line 47

def list(connected_account_id: nil, customer_key: nil, search: nil, space_key: nil)
  res = @client.post("/spaces/list", {connected_account_id: , customer_key: customer_key, search: search, space_key: space_key}.compact)

  Seam::Resources::Space.load_from_response(res.body["spaces"])
end

#remove_acs_entrances(acs_entrance_ids:, space_id:) ⇒ Object



53
54
55
56
57
# File 'lib/seam/routes/clients/spaces.rb', line 53

def remove_acs_entrances(acs_entrance_ids:, space_id:)
  @client.post("/spaces/remove_acs_entrances", {acs_entrance_ids: acs_entrance_ids, space_id: space_id}.compact)

  nil
end

#remove_devices(device_ids:, space_id:) ⇒ Object



59
60
61
62
63
# File 'lib/seam/routes/clients/spaces.rb', line 59

def remove_devices(device_ids:, space_id:)
  @client.post("/spaces/remove_devices", {device_ids: device_ids, space_id: space_id}.compact)

  nil
end

#update(acs_entrance_ids: nil, customer_key: nil, device_ids: nil, name: nil, space_id: nil, space_key: nil) ⇒ Object



65
66
67
68
69
# File 'lib/seam/routes/clients/spaces.rb', line 65

def update(acs_entrance_ids: nil, customer_key: nil, device_ids: nil, name: nil, space_id: nil, space_key: nil)
  res = @client.post("/spaces/update", {acs_entrance_ids: acs_entrance_ids, customer_key: customer_key, device_ids: device_ids, name: name, space_id: space_id, space_key: space_key}.compact)

  Seam::Resources::Space.load_from_response(res.body["space"])
end