totalvoice-ruby 1.5.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 42de3c22f84f079f2e6ed307a7d665b57ff492dd
4
- data.tar.gz: 63dd6321eed5272f885867b1878b38f08530d9dd
2
+ SHA256:
3
+ metadata.gz: 1eb177c2e6a598cf62587ad49e0a17f598f50557a05f665b1443f7b97f0796cb
4
+ data.tar.gz: a253cc28e5ebed331e5d1ae0ec206ce14095778fd330dddf1e1478778dfcfb38
5
5
  SHA512:
6
- metadata.gz: 355d1c010cc396c12a761edb80a7a73a26ec6128b6b63b7b74803a5f293fe8b9281ff4e8caa816663e19c76fd912a03cfc636207dd2eca29d3953ab88cf1e473
7
- data.tar.gz: da8c62a81fe2b53150a5ea0bd5158cce711e2c3cab7c3400a0bada49ac180e19ed68b989bef50a32cabfcc9f64b30520c6f0984e790b5a59c0ff4fd9014f8faf
6
+ metadata.gz: 96e1f00c880476d03e6378bf833e101747778d9a50e06466639cda0187cfaa35e117ccb3b3e58e1c543eaa32e81d23dbbd23174e66edc93f14f387351540ec20
7
+ data.tar.gz: 88d158aa0142efcefd9b014b0d59c3b047bffb22bbbe9baa93058f2738a641b79d42d15b59eb6807b49dc9effdad2a1d06728250d6038e650c0d3c42e2a784c6
data/README.md CHANGED
@@ -12,7 +12,6 @@ Client em Ruby para a API da TotalVoice
12
12
  - [X] Gerenciamento de Ramais
13
13
  - [X] URL do Webphone
14
14
  - [X] Gerenciamento de DID
15
- - [X] Validação de Número
16
15
  - [X] Verificação[Two Dactor Authentication]
17
16
 
18
17
  > ### Requisitos
data/lib/api/conta.rb CHANGED
@@ -6,6 +6,7 @@ module TotalVoice
6
6
  class Conta
7
7
  attr_reader :client
8
8
  ROTA_CONTA = "/conta"
9
+ ROTA_WEBHOOK_DEFAULT = "/webhook-default"
9
10
 
10
11
  def initialize(client)
11
12
  @client = client
@@ -82,6 +83,37 @@ module TotalVoice
82
83
  #
83
84
  def recarga_bonus(id, nome, valor)
84
85
  @client.post(Route.new([ROTA_CONTA, id.to_s, 'bonus']), { nome: nome, valor:valor })
86
+ end
87
+
88
+ ##
89
+ # Retorna a lista de webhooks default configurados para esta conta
90
+ # @return [json]
91
+ #
92
+ def webhooks_default()
93
+ @client.get(Route.new([ROTA_CONTA, ROTA_WEBHOOK_DEFAULT]))
94
+ end
95
+
96
+ ##
97
+ # Apaga um webhook default
98
+ #
99
+ # @param [String] nome
100
+ # @return [json]
101
+ #
102
+ def excluir_webhook_default(nome)
103
+ @client.delete(Route.new([ROTA_CONTA, ROTA_WEBHOOK_DEFAULT, nome]))
104
+ end
105
+
106
+ ##
107
+ # Cadastra ou atualiza um webhook default
108
+ #
109
+ # @param [String] nome
110
+ # @param [String] url
111
+ # @return [json]
112
+ #
113
+ def salvar_webhook_default(nome, url)
114
+ @client.put(Route.new([ROTA_CONTA, ROTA_WEBHOOK_DEFAULT, nome]), {
115
+ url: url
116
+ })
85
117
  end
86
118
  end
87
119
  end
data/lib/api/ramal.rb CHANGED
@@ -6,6 +6,7 @@ module TotalVoice
6
6
  class Ramal
7
7
  attr_reader :client
8
8
  ROTA_RAMAL = "/ramal"
9
+ ROTA_FILA = "/fila"
9
10
 
10
11
  def initialize(client)
11
12
  @client = client
@@ -52,6 +53,17 @@ module TotalVoice
52
53
  @client.put(Route.new([ROTA_RAMAL, id.to_s]), data)
53
54
  end
54
55
 
56
+ ##
57
+ # Atualiza as informações do Ramal
58
+ #
59
+ # @param [Integer] id
60
+ # @param [Hash] data
61
+ # @return [json]
62
+ #
63
+ def atualizar_ramal_fila(id, data)
64
+ @client.put(Route.new([ROTA_RAMAL, id.to_s, ROTA_FILA]), data)
65
+ end
66
+
55
67
  ##
56
68
  # Gera relatório de ramais criados
57
69
  #
data/lib/client.rb CHANGED
@@ -16,29 +16,30 @@ require_relative 'api/sms'
16
16
  require_relative 'api/tts'
17
17
  require_relative 'api/ura'
18
18
  require_relative 'api/webphone'
19
- require_relative 'api/valida_numero'
20
19
  require_relative 'api/verificacao'
20
+ require_relative 'totalvoice/version'
21
21
 
22
22
 
23
23
  module TotalVoice
24
24
  # Inicializa o HTTP client
25
25
  class API
26
26
  include HTTParty
27
- ENDPOINT = 'https://api2.totalvoice.com.br'
27
+ ENDPOINT = 'https://voice-api.zenvia.com'
28
28
  # * *Args* :
29
29
  # - +Access-Token+ -> Access-Token TotalVoice
30
30
  # - +host+ -> Base URL para API
31
31
  #
32
- def initialize(access_token, host = nil)
32
+ def initialize(access_token, host = nil, options = {})
33
33
  @access_token = access_token
34
34
  @host = host ? host : ENDPOINT
35
35
  @options = {
36
36
  headers: {
37
- "Access-Token" => @access_token,
38
- "Content-Type" => "application/json",
39
- "Accept" => "application/json"
37
+ 'Access-Token' => @access_token,
38
+ 'Content-Type' => 'application/json',
39
+ 'Accept' => 'application/json',
40
+ 'User-Agent' => 'lib-ruby/' + VERSION
40
41
  }
41
- }
42
+ }.merge(options)
42
43
 
43
44
  @audio = nil
44
45
  @bina = nil
@@ -54,7 +55,6 @@ module TotalVoice
54
55
  @tts = nil
55
56
  @ura = nil
56
57
  @webphone = nil
57
- @valida_numero = nil
58
58
  @verificacao = nil
59
59
  end
60
60
 
@@ -114,10 +114,6 @@ module TotalVoice
114
114
  @webphone ||= Webphone.new self
115
115
  end
116
116
 
117
- def valida_numero
118
- @valida_numero ||= ValidaNumero.new self
119
- end
120
-
121
117
  def verificacao
122
118
  @verificacao ||= Verificacao.new self
123
119
  end
@@ -1,3 +1,3 @@
1
1
  module TotalVoice
2
- VERSION = '1.5.1'
2
+ VERSION = '1.10.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totalvoice-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DiloWagner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-04 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -54,7 +54,6 @@ files:
54
54
  - lib/api/sms.rb
55
55
  - lib/api/tts.rb
56
56
  - lib/api/ura.rb
57
- - lib/api/valida_numero.rb
58
57
  - lib/api/verificacao.rb
59
58
  - lib/api/webphone.rb
60
59
  - lib/client.rb
@@ -82,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
81
  - !ruby/object:Gem::Version
83
82
  version: '0'
84
83
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.6.14.1
84
+ rubygems_version: 3.1.2
87
85
  signing_key:
88
86
  specification_version: 4
89
87
  summary: Official TotalVoice Gem
@@ -1,52 +0,0 @@
1
- require 'date'
2
-
3
- require_relative '../route'
4
- require_relative '../query'
5
-
6
- module TotalVoice
7
- # Inicializa o HTTP client
8
- class ValidaNumero
9
- attr_reader :client
10
- ROTA_VALIDA_NUMERO = "/valida_numero"
11
-
12
- def initialize(client)
13
- @client = client
14
- end
15
-
16
- ##
17
- # Envia um Numeoro para verificação
18
- #
19
- # @param [String] numero_destino
20
- # @return [json]
21
- #
22
- def enviar(numero_destino)
23
- @client.post(Route.new([ROTA_VALIDA_NUMERO]), {
24
- numero_destino: numero_destino
25
- })
26
- end
27
-
28
- ##
29
- # Busca as informações de um número validado
30
- #
31
- # @param [Integer] id
32
- # @return [json]
33
- #
34
- def buscar(id)
35
- @client.get(Route.new([ROTA_VALIDA_NUMERO, id.to_s]))
36
- end
37
-
38
- ##
39
- # Gera relatório de números validados
40
- #
41
- # @param [DateTime|String] data_inicio
42
- # @param [DateTime|String] data_fim
43
- # @return [json]
44
- #
45
- def relatorio(data_inicio, data_fim)
46
- @client.get(
47
- Route.new([ROTA_VALIDA_NUMERO, 'relatorio']),
48
- Query.new({ 'data_inicio': Time.parse(data_inicio.to_s).utc, 'data_fim': Time.parse(data_fim.to_s).utc })
49
- )
50
- end
51
- end
52
- end