Class: Seam::Clients::Phones

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

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ Phones

Returns a new instance of Phones.



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

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

Instance Method Details

#deactivate(device_id:) ⇒ nil

Deactivates a phone, which is useful, for example, if a user has lost their phone. For more information, see App User Lost Phone Process.

Parameters:

  • device_id

    Device ID of the phone that you want to deactivate.

Returns:

  • (nil)

    OK



18
19
20
21
22
# File 'lib/seam/routes/phones.rb', line 18

def deactivate(device_id:)
  @client.post("/phones/deactivate", {device_id: device_id}.compact)

  nil
end

#get(device_id:) ⇒ Seam::Resources::Phone

Returns a specified phone.

Parameters:

  • device_id

    Device ID of the phone that you want to get.

Returns:



27
28
29
30
31
# File 'lib/seam/routes/phones.rb', line 27

def get(device_id:)
  res = @client.post("/phones/get", {device_id: device_id}.compact)

  Seam::Resources::Phone.load_from_response(res.body["phone"])
end

#list(acs_credential_id: nil, owner_user_identity_id: nil) ⇒ Seam::Resources::Phone

Returns a list of all phones. To filter the list of returned phones by a specific owner user identity or credential, include the owner_user_identity_id or acs_credential_id, respectively, in the request body.

Parameters:

  • acs_credential_id (defaults to: nil)

    ID of the credential by which you want to filter the list of returned phones.

  • owner_user_identity_id (defaults to: nil)

    ID of the user identity that represents the owner by which you want to filter the list of returned phones.

Returns:



37
38
39
40
41
# File 'lib/seam/routes/phones.rb', line 37

def list(acs_credential_id: nil, owner_user_identity_id: nil)
  res = @client.post("/phones/list", {acs_credential_id: acs_credential_id, owner_user_identity_id: owner_user_identity_id}.compact)

  Seam::Resources::Phone.load_from_response(res.body["phones"])
end

#simulateObject



11
12
13
# File 'lib/seam/routes/phones.rb', line 11

def simulate
  @simulate ||= Seam::Clients::PhonesSimulate.new(client: @client, defaults: @defaults)
end