totalvoice-ruby 1.4.1 → 1.9.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: e740edc8f10179158280c756a69f802795acbb2f
4
- data.tar.gz: 8ca52033f4170eb2cdf4145f611e26eed7736240
2
+ SHA256:
3
+ metadata.gz: 0f65a94052ea2978c181fdca055ef05d361817f44d143eae0115bdd6bbd9b985
4
+ data.tar.gz: 1ca6e17551401d18a0d70aa20bf079f55db155aaaee8b33e6a9b4d0d061e074d
5
5
  SHA512:
6
- metadata.gz: f9800fadcae27343057c79669850cb564bb68ff6ff0c8d5c84c1e322c0f8c398749ec6e9b5e86e7a1c75d721902b8af625e876cdf839b83b496d8f544d728de3
7
- data.tar.gz: 025b5a7dc725847eca6ebfae192c480979ab002eebfc935caa0c7983e4b416d0c3a2e2021536b535b8e4cf43c1152836383c8ae5df89f1e22c86e97cd112c543
6
+ metadata.gz: 54917ac348d50697131a718a82929215387f7091395709e5b46f941ae4f24c92d18fdbcec6238e4a95330e198555f769cb7eaffb8081f7e4128653fa20643134
7
+ data.tar.gz: 3ce8fe21c1aba76adf951f4fc983983c70236f3e4a819751dfa73a70b7fe97b3f5951f720ad696fd92942553d463bc49a0b06a600115a1b91163560dd97e749c
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
@@ -1,10 +1,12 @@
1
1
  require_relative '../route'
2
+ require_relative '../query'
2
3
 
3
4
  module TotalVoice
4
5
  # Inicializa o HTTP client
5
6
  class Conta
6
7
  attr_reader :client
7
8
  ROTA_CONTA = "/conta"
9
+ ROTA_WEBHOOK_DEFAULT = "/webhook-default"
8
10
 
9
11
  def initialize(client)
10
12
  @client = client
@@ -58,15 +60,60 @@ module TotalVoice
58
60
  def relatorio()
59
61
  @client.get(Route.new([ROTA_CONTA, 'relatorio']))
60
62
  end
63
+
64
+ ##
65
+ # Gera uma URL para recarga de créditos
66
+ #
67
+ # @param [String] url
68
+ # @return [json]
69
+ #
70
+ def url_recarga(url)
71
+ @client.get(
72
+ Route.new([ROTA_CONTA, 'urlrecarga']),
73
+ Query.new({ 'url_retorno': url })
74
+ )
75
+ end
61
76
 
62
77
  ##
63
78
  # Adiciona crédito bônus nas contas criadas por mim
64
79
  # @param [Integer] id da conta filha
80
+ # @param [String] nome do plano
65
81
  # @param [Float] valor
66
82
  # @return [json]
67
83
  #
68
- def recarga_bonus(id, valor)
69
- @client.post(Route.new([ROTA_CONTA, id.to_s, 'bonus']), { valor:valor })
84
+ def recarga_bonus(id, nome, valor)
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
+ })
70
117
  end
71
118
  end
72
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,7 +16,6 @@ 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'
21
20
 
22
21
 
@@ -29,16 +28,16 @@ module TotalVoice
29
28
  # - +Access-Token+ -> Access-Token TotalVoice
30
29
  # - +host+ -> Base URL para API
31
30
  #
32
- def initialize(access_token, host = nil)
31
+ def initialize(access_token, host = nil, options = {})
33
32
  @access_token = access_token
34
33
  @host = host ? host : ENDPOINT
35
34
  @options = {
36
35
  headers: {
37
- "Access-Token" => @access_token,
38
- "Content-Type" => "application/json",
39
- "Accept" => "application/json"
36
+ 'Access-Token' => @access_token,
37
+ 'Content-Type' => 'application/json',
38
+ 'Accept' => 'application/json'
40
39
  }
41
- }
40
+ }.merge(options)
42
41
 
43
42
  @audio = nil
44
43
  @bina = nil
@@ -54,7 +53,6 @@ module TotalVoice
54
53
  @tts = nil
55
54
  @ura = nil
56
55
  @webphone = nil
57
- @valida_numero = nil
58
56
  @verificacao = nil
59
57
  end
60
58
 
@@ -114,10 +112,6 @@ module TotalVoice
114
112
  @webphone ||= Webphone.new self
115
113
  end
116
114
 
117
- def valida_numero
118
- @valida_numero ||= ValidaNumero.new self
119
- end
120
-
121
115
  def verificacao
122
116
  @verificacao ||= Verificacao.new self
123
117
  end
@@ -1,3 +1,3 @@
1
1
  module TotalVoice
2
- VERSION = '1.4.1'
2
+ VERSION = '1.9.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.4.1
4
+ version: 1.9.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-10-03 00:00:00.000000000 Z
11
+ date: 2021-04-17 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
@@ -83,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
82
  version: '0'
84
83
  requirements: []
85
84
  rubyforge_project:
86
- rubygems_version: 2.6.14.1
85
+ rubygems_version: 2.7.6
87
86
  signing_key:
88
87
  specification_version: 4
89
88
  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