Class: TotalVoice::Fila

Inherits:
Object
  • Object
show all
Defined in:
lib/api/fila.rb

Overview

Inicializa o HTTP client

Constant Summary collapse

ROTA_FILA =
"/fila"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Fila

Returns a new instance of Fila.



9
10
11
# File 'lib/api/fila.rb', line 9

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/api/fila.rb', line 6

def client
  @client
end

Instance Method Details

#adiciona_ramal(id, ramal_id) ⇒ json

Adiciona um ramal na fila

Parameters:

  • nome (String)
  • estrategia_ring (String)
  • timeout_ring (String)

Returns:

  • (json)


48
49
50
51
52
53
# File 'lib/api/fila.rb', line 48

def adiciona_ramal(id, ramal_id)
  data = {
    ramal_id: ramal_id
  }
  @client.post(Route.new([ROTA_FILA, id.to_s]), data)
end

#atualizar(id, data) ⇒ json

Atualiza as informações da fila

Parameters:

  • id (Integer)
  • data (Hash)

Returns:

  • (json)


72
73
74
# File 'lib/api/fila.rb', line 72

def atualizar(id, data)
  @client.put(Route.new([ROTA_FILA, id.to_s]), data)
end

#buscar(id) ⇒ json

Busca as informações da Fila de Atendimento

Parameters:

  • id (Integer)

Returns:

  • (json)


19
20
21
# File 'lib/api/fila.rb', line 19

def buscar(id)
  @client.get(Route.new([ROTA_FILA, id.to_s]))
end

#buscar_ramal(id, ramal_id) ⇒ json

Busca as informações de um ramal da Fila de Atendimento

Parameters:

  • id (Integer)

Returns:

  • (json)


61
62
63
# File 'lib/api/fila.rb', line 61

def buscar_ramal(id, ramal_id)
  @client.get(Route.new([ROTA_FILA, id.to_s, ramal_id.to_s]))
end

#criar(nome, estrategia_ring, timeout_ring = nil) ⇒ json

Criar fila

Parameters:

  • nome (String)
  • estrategia_ring (String)
  • timeout_ring (String) (defaults to: nil)

Returns:

  • (json)


31
32
33
34
35
36
37
38
# File 'lib/api/fila.rb', line 31

def criar(nome, estrategia_ring, timeout_ring = nil)
  data = {
    nome: nome,
    estrategia_ring: estrategia_ring,
    timeout_ring: timeout_ring
  }
  @client.post(Route.new([ROTA_FILA]), data)
end

#excluir_ramal(id, ramal_id) ⇒ json

Remove um ramal da fila

Parameters:

  • id (Integer)
  • ramal_id (Integer)

Returns:

  • (json)


83
84
85
# File 'lib/api/fila.rb', line 83

def excluir_ramal(id, ramal_id)
  @client.delete(Route.new([ROTA_RAMAL, id.to_s, ramal_id.to_s]))
end