Class: VoiceVault::Claimant

Inherits:
Object
  • Object
show all
Defined in:
lib/voice_vault/claimant.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, connection) ⇒ Claimant

Returns a new instance of Claimant.



20
21
22
23
# File 'lib/voice_vault/claimant.rb', line 20

def initialize(id, connection)
  @id = id
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



18
19
20
# File 'lib/voice_vault/claimant.rb', line 18

def connection
  @connection
end

#idObject (readonly)

Returns the value of attribute id.



18
19
20
# File 'lib/voice_vault/claimant.rb', line 18

def id
  @id
end

Class Method Details

.create(connection, app_id) ⇒ Object

Register a new “claimant” to be enrolled within VoiceVault Fusion The organisation unit ID (GUID) representing the customer for this instance In email from VoiceVault it’s named “VIGO_APP_ID”

Raises:



7
8
9
10
11
12
13
14
15
16
# File 'lib/voice_vault/claimant.rb', line 7

def self.create(connection, app_id)
  params = {
    organisation_unit: app_id
  }
  result = connection.post "RegisterClaimant.ashx", params

  raise VoiceVault::Error.new("Failed to register claimant: #{result["message"]}") if result["status_code"] != "0"

  new(result["claimant_id"], connection)
end

Instance Method Details

#destroyObject

Remove all data from VoiceVault servers

Raises:



26
27
28
29
30
31
32
33
34
35
# File 'lib/voice_vault/claimant.rb', line 26

def destroy
  params = {
    claimant_id: @id
  }
  result = @connection.post "DeleteClaiamant.ashx", params

  raise VoiceVault::Error.new("Failed to register claimant: #{result["message"]}") if result["status_code"] != "0"

  result["request_status"]
end