Class: Seam::Clients::Spaces

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/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/spaces.rb', line 6

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

Instance Method Details

#add_acs_entrances(acs_entrance_ids:, space_id:) ⇒ nil

Adds entrances to a specific space.

Parameters:

  • acs_entrance_ids

    IDs of the entrances that you want to add to the space.

  • space_id

    ID of the space to which you want to add entrances.

Returns:

  • (nil)

    OK



15
16
17
18
19
# File 'lib/seam/routes/spaces.rb', line 15

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_connected_account(connected_account_id:, space_id:) ⇒ nil

Adds a connected account to a specific space.

Parameters:

  • connected_account_id

    ID of the connected account that you want to add to the space.

  • space_id

    ID of the space to which you want to add the connected account.

Returns:

  • (nil)

    OK



25
26
27
28
29
# File 'lib/seam/routes/spaces.rb', line 25

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

  nil
end

#add_devices(device_ids:, space_id:) ⇒ nil

Adds devices to a specific space.

Parameters:

  • device_ids

    IDs of the devices that you want to add to the space.

  • space_id

    ID of the space to which you want to add devices.

Returns:

  • (nil)

    OK



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

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, connected_account_ids: nil, customer_data: nil, customer_key: nil, device_ids: nil, space_key: nil) ⇒ Seam::Resources::Space

Creates a new space.

Parameters:

  • name

    Name of the space that you want to create.

  • acs_entrance_ids (defaults to: nil)

    IDs of the entrances that you want to add to the new space.

  • connected_account_ids (defaults to: nil)

    IDs of connected accounts to associate with the new space. Persisted on seam.location_third_party_account so the UI can show which provider account(s) a space came from.

  • customer_data (defaults to: nil)

    Reservation/stay-related defaults for the space.

  • customer_key (defaults to: nil)

    Customer key for which you want to create the space.

  • device_ids (defaults to: nil)

    IDs of the devices that you want to add to the new space.

  • space_key (defaults to: nil)

    Unique key for the space within the workspace.

Returns:



50
51
52
53
54
# File 'lib/seam/routes/spaces.rb', line 50

def create(name:, acs_entrance_ids: nil, connected_account_ids: nil, customer_data: nil, customer_key: nil, device_ids: nil, space_key: nil)
  res = @client.post("/spaces/create", {name: name, acs_entrance_ids: acs_entrance_ids, connected_account_ids: , customer_data: customer_data, 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:) ⇒ nil

Deletes a space.

Parameters:

  • space_id

    ID of the space that you want to delete.

Returns:

  • (nil)

    OK



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

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

  nil
end

#get(space_id: nil, space_key: nil) ⇒ Seam::Resources::Space

Gets a space.

Parameters:

  • space_id (defaults to: nil)

    ID of the space that you want to get.

  • space_key (defaults to: nil)

    Unique key of the space that you want to get.

Returns:



69
70
71
72
73
# File 'lib/seam/routes/spaces.rb', line 69

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

Gets all related resources for one or more Spaces.

Parameters:

  • exclude (defaults to: nil)
  • include (defaults to: nil)
  • space_ids (defaults to: nil)

    IDs of the spaces that you want to get along with their related resources.

  • space_keys (defaults to: nil)

    Keys of the spaces that you want to get along with their related resources.

Returns:



81
82
83
84
85
# File 'lib/seam/routes/spaces.rb', line 81

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(customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_key: nil) ⇒ Seam::Resources::Space

Returns a list of all spaces.

Parameters:

  • customer_key (defaults to: nil)

    Customer key for which you want to list spaces.

  • limit (defaults to: nil)

    Maximum number of records to return per page.

  • page_cursor (defaults to: nil)

    Identifies the specific page of results to return, obtained from the previous page's next_page_cursor.

  • search (defaults to: nil)

    String for which to search. Filters returned spaces to include all records that satisfy a partial match using name, space_key, or customer_key.

  • space_key (defaults to: nil)

    Filter spaces by space_key.

Returns:



94
95
96
97
98
# File 'lib/seam/routes/spaces.rb', line 94

def list(customer_key: nil, limit: nil, page_cursor: nil, search: nil, space_key: nil)
  res = @client.post("/spaces/list", {customer_key: customer_key, limit: limit, page_cursor: page_cursor, 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:) ⇒ nil

Removes entrances from a specific space.

Parameters:

  • acs_entrance_ids

    IDs of the entrances that you want to remove from the space.

  • space_id

    ID of the space from which you want to remove entrances.

Returns:

  • (nil)

    OK



104
105
106
107
108
# File 'lib/seam/routes/spaces.rb', line 104

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_connected_account(connected_account_id:, space_id:) ⇒ nil

Removes a connected account from a specific space.

Parameters:

  • connected_account_id

    ID of the connected account that you want to remove from the space.

  • space_id

    ID of the space from which you want to remove the connected account.

Returns:

  • (nil)

    OK



114
115
116
117
118
# File 'lib/seam/routes/spaces.rb', line 114

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

  nil
end

#remove_devices(device_ids:, space_id:) ⇒ nil

Removes devices from a specific space.

Parameters:

  • device_ids

    IDs of the devices that you want to remove from the space.

  • space_id

    ID of the space from which you want to remove devices.

Returns:

  • (nil)

    OK



124
125
126
127
128
# File 'lib/seam/routes/spaces.rb', line 124

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_data: nil, device_ids: nil, name: nil, space_id: nil, space_key: nil) ⇒ Seam::Resources::Space

Updates an existing space.

Parameters:

  • acs_entrance_ids (defaults to: nil)

    IDs of the entrances that you want to set for the space. If specified, this will replace all existing entrances.

  • customer_data (defaults to: nil)

    Reservation/stay-related defaults for the space. Only the keys you provide are updated; omit a key to leave it unchanged. Pass null on a key to clear it.

  • device_ids (defaults to: nil)

    IDs of the devices that you want to set for the space. If specified, this will replace all existing devices.

  • name (defaults to: nil)

    Name of the space.

  • space_id (defaults to: nil)

    ID of the space that you want to update.

  • space_key (defaults to: nil)

    Unique key of the space that you want to update.

Returns:



138
139
140
141
142
# File 'lib/seam/routes/spaces.rb', line 138

def update(acs_entrance_ids: nil, customer_data: nil, device_ids: nil, name: nil, space_id: nil, space_key: nil)
  res = @client.post("/spaces/update", {acs_entrance_ids: acs_entrance_ids, customer_data: customer_data, 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