millennium 0.0.3 → 0.0.4
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 +4 -4
- data/README.md +1 -16
- data/lib/millennium/clientes/clientes.rb +7 -22
- data/lib/millennium/crm/crm.rb +8 -1
- data/lib/millennium/crm_chamados/crm_chamados.rb +7 -24
- data/lib/millennium/helpers.rb +6 -0
- data/lib/millennium/modulo/modulo.rb +7 -16
- data/lib/millennium/pedido_venda/pedido_venda.rb +7 -29
- data/lib/millennium/produtos/produtos.rb +8 -26
- data/lib/millennium/request.rb +21 -25
- data/lib/millennium/transportadoras/transportadoras.rb +8 -20
- data/lib/millennium/troca_devolucao/troca_devolucao.rb +7 -21
- data/lib/millennium/version.rb +1 -1
- data/lib/millennium/vitrine/vitrine.rb +7 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9500716a164644123f709a410faddf429dbcb64
|
4
|
+
data.tar.gz: 6dc6a152008b99a00afb7a1a9d59768e92a53e91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c3c56307851f2b47ad9bb8eb02142e8874111fa619177f08600a57af5e913cdf43d19c6ebe0579f88be702c6bb84abb33335b4723bdbfc6ce2ff9d284ffee9
|
7
|
+
data.tar.gz: 596d5c7a3382ce00ce3d696634c714372524244a3b28254c98d73badaa67d70e6f769ad8f6520b170ab59ab64ba4e9b3ee92b17949e10d073345b934f7c5ee46
|
data/README.md
CHANGED
@@ -36,23 +36,8 @@ end
|
|
36
36
|
|
37
37
|
### Buscando uma compra faturada
|
38
38
|
|
39
|
-
**Parâmetros**
|
40
|
-
|
41
|
-
| Parâmetro | Obrigatório | Tipo | Descrição |
|
42
|
-
| ------------------------ | :---------: | :--------------------------------: | ---------------------------------- |
|
43
|
-
| data_atualizacao | Não | String (formato: YYYY-mm-dd-H-M-S) | Data de atualização |
|
44
|
-
| vitrine | Não | Integer | Id da vitrine |
|
45
|
-
| saida_inicial | Não | Integer | Id da saida ou entrada que será usado como ponto de partida |
|
46
|
-
| trans_id | Não | Integer | Trans_id para a listagem das notas fiscais, as notas fiscais serão listadas a partir desse trans_id. Trans_id é um campo numérico que indica quando um item foi alterado |
|
47
|
-
| aprovado | Não | Boolean | Listar somente notas aprovadas |
|
48
|
-
| cancelada | Não | Boolean | Listar somente as notas canceladas |
|
49
|
-
| data_atualizacao_inicial | Não | String (formato: YYYY-mm-dd-H-M-S) | Data inicial do período desejado |
|
50
|
-
| data_atualizacao_final | Não | String (formato: YYYY-mm-dd-H-M-S) | Data final do período desejado |
|
51
|
-
|
52
|
-
**Exemplo:**
|
53
|
-
|
54
39
|
```ruby
|
55
|
-
|
40
|
+
Millennium::PedidoVenda.lista_faturamentos({
|
56
41
|
data_atualizacao_inicial: '2016-01-01-00-00-00',
|
57
42
|
data_atualizacao_final: '2016-10-26-23-59-59',
|
58
43
|
})
|
@@ -2,29 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/clientes/clientes.rb
|
4
4
|
class Clientes
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
incluir_ou_alterar: 'IncluirOuAlterar',
|
11
|
-
consulta_endereco: 'ConsultaEndereco',
|
12
|
-
consulta_credito: 'ConsultaCredito',
|
13
|
-
reserva_credito: 'ReservaCredito',
|
14
|
-
lista: 'Lista'
|
15
|
-
}.freeze
|
16
|
-
private_constant :ENDPOINTS_NAMES
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Clientes'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
17
10
|
|
18
|
-
|
19
|
-
|
20
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
21
|
-
unless params.empty?
|
22
|
-
query = Millennium::Helpers.mount_query(params)
|
23
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
24
|
-
end
|
25
|
-
Millennium::Request.run(url)
|
26
|
-
end
|
27
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
28
13
|
end
|
29
14
|
end
|
30
15
|
end
|
data/lib/millennium/crm/crm.rb
CHANGED
@@ -2,7 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/crm/crm.rb
|
4
4
|
class CRM
|
5
|
-
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'CRM'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
6
13
|
end
|
7
14
|
end
|
8
15
|
end
|
@@ -2,31 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/crm_chamados/crm_chamados.rb
|
4
4
|
class CRMChamados
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
lista_origens_chamado: 'ListaOrigensChamado',
|
11
|
-
lista_tipos_chamado: 'ListaTiposChamado',
|
12
|
-
inclui_comentario: 'IncluiComentario',
|
13
|
-
lista_sub_motivos: 'ListaSubMotivos',
|
14
|
-
lista_motivos: 'ListaMotivos',
|
15
|
-
inclui: 'Inclui',
|
16
|
-
fecha: 'Fecha'
|
17
|
-
}.freeze
|
18
|
-
private_constant :ENDPOINTS_NAMES
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Crm.Chamados'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
19
10
|
|
20
|
-
|
21
|
-
|
22
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
23
|
-
unless params.empty?
|
24
|
-
query = Millennium::Helpers.mount_query(params)
|
25
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
26
|
-
end
|
27
|
-
Millennium::Request.run(url)
|
28
|
-
end
|
29
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
30
13
|
end
|
31
14
|
end
|
32
15
|
end
|
data/lib/millennium/helpers.rb
CHANGED
@@ -7,5 +7,11 @@ module Millennium
|
|
7
7
|
query << "#{key}=#{value}&"
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
def self.full_endpoint(object, endpoint, params)
|
12
|
+
return "#{object}/#{endpoint}?$format=json" if params.empty?
|
13
|
+
query = mount_query(params)
|
14
|
+
"#{object}/#{endpoint}?#{query}$format=json"
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
@@ -2,23 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/modulo/modulo.rb
|
4
4
|
class Modulo
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
private_constant :ENDPOINTS_NAMES
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Module'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
15
|
-
unless params.empty?
|
16
|
-
query = Millennium::Helpers.mount_query(params)
|
17
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
18
|
-
end
|
19
|
-
Millennium::Request.run(url)
|
20
|
-
end
|
21
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
22
13
|
end
|
23
14
|
end
|
24
15
|
end
|
@@ -2,36 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/pedido_venda/pedido_venda.rb
|
4
4
|
class PedidoVenda
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
consulta_status_wf: 'ConsultaStatusWF',
|
11
|
-
lista_operadoras: 'ListaOperadoras',
|
12
|
-
consulta_simples: 'ConsultaSimples',
|
13
|
-
consulta_produto: 'ConsultaProduto',
|
14
|
-
consulta_xml_nfe: 'ConsultaXmlNFe',
|
15
|
-
lista_bandeiras: 'ListaBandeiras',
|
16
|
-
consulta_status: 'ConsultaStatus',
|
17
|
-
lista_tipo_pgto: 'ListaTipoPgto',
|
18
|
-
consulta_itens: 'Consulta_Itens',
|
19
|
-
lista_pedidos: 'ListaPedidos',
|
20
|
-
consulta: 'Consulta',
|
21
|
-
lista: 'Lista'
|
22
|
-
}.freeze
|
23
|
-
private_constant :ENDPOINTS_NAMES
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Pedido_Venda'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
24
10
|
|
25
|
-
|
26
|
-
|
27
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
28
|
-
unless params.empty?
|
29
|
-
query = Millennium::Helpers.mount_query(params)
|
30
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
31
|
-
end
|
32
|
-
Millennium::Request.run(url)
|
33
|
-
end
|
34
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
35
13
|
end
|
36
14
|
end
|
37
15
|
end
|
@@ -1,33 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/produtos/produtos.rb
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
atualiza_saldo_de_estoque: 'AtualizaSaldoDeEstoque',
|
11
|
-
atualiza_preco_de_tabela: 'AtualizaPrecoDeTabela',
|
12
|
-
lista_relacionados: 'ListaRelacionados',
|
13
|
-
saldo_de_estoque: 'SaldoDeEstoque',
|
14
|
-
preco_de_tabela: 'PrecoDeTabela',
|
15
|
-
lista_id_fotos: 'ListaIdFotos',
|
16
|
-
lista_vitrine: 'ListaVitrine',
|
17
|
-
busca_foto: 'BuscaFoto'
|
18
|
-
}.freeze
|
19
|
-
private_constant :ENDPOINTS_NAMES
|
4
|
+
class PedidoVenda
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Produtos'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
20
10
|
|
21
|
-
|
22
|
-
|
23
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
24
|
-
unless params.empty?
|
25
|
-
query = Millennium::Helpers.mount_query(params)
|
26
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
27
|
-
end
|
28
|
-
Millennium::Request.run(url)
|
29
|
-
end
|
30
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
31
13
|
end
|
32
14
|
end
|
33
15
|
end
|
data/lib/millennium/request.rb
CHANGED
@@ -2,37 +2,33 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/request.rb
|
4
4
|
class Request
|
5
|
-
|
6
|
-
|
7
|
-
url = mount_url(endpoint)
|
8
|
-
make_request(url)
|
9
|
-
end
|
5
|
+
HOSTNAME = Millennium::Config.host || 'millennium.iwise.com.br'
|
6
|
+
PORT = Millennium::Config.port || '888'
|
10
7
|
|
11
|
-
|
8
|
+
OPTIONS = {
|
9
|
+
userpwd: "#{Millennium::Config.user}:#{Millennium::Config.pass}",
|
10
|
+
httpauth: :ntlm,
|
11
|
+
verbose: true
|
12
|
+
}.freeze
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
private_constant :HOSTNAME
|
15
|
+
private_constant :PORT
|
16
|
+
private_constant :OPTIONS
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def initialize(object, endpoint, params)
|
19
|
+
@full_endpoint = Millennium::Helpers.full_endpoint(
|
20
|
+
object, endpoint, params
|
21
|
+
)
|
22
|
+
end
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
def run
|
25
|
+
Typhoeus::Request.new(url, OPTIONS).run
|
26
|
+
end
|
23
27
|
|
24
|
-
|
25
|
-
{
|
26
|
-
userpwd: userpwd,
|
27
|
-
httpauth: :ntlm,
|
28
|
-
verbose: true
|
29
|
-
}
|
30
|
-
end
|
28
|
+
private
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
"#{config.user}:#{config.pass}"
|
35
|
-
end
|
30
|
+
def url
|
31
|
+
"http://#{HOSTNAME}:#{PORT}/api/millenium_eco/#{@full_endpoint}"
|
36
32
|
end
|
37
33
|
end
|
38
34
|
end
|
@@ -1,27 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/transportadoras/transportadoras.rb
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
atualiza_preco_de_tabela: 'IncluirOuAlterar',
|
11
|
-
atualiza_produtos_vitrine: 'CalculaFrete'
|
12
|
-
}.freeze
|
13
|
-
private_constant :ENDPOINTS_NAMES
|
4
|
+
class PedidoVenda
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Transportadoras'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
18
|
-
unless params.empty?
|
19
|
-
query = Millennium::Helpers.mount_query(params)
|
20
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
21
|
-
end
|
22
|
-
Millennium::Request.run(url)
|
23
|
-
end
|
24
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
25
13
|
end
|
26
14
|
end
|
27
15
|
end
|
@@ -2,28 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/troca_devolucao/troca_devolucao.rb
|
4
4
|
class TrocaDevolucao
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
consulta_credito: 'ConsultaCredito',
|
11
|
-
reserva_credito: 'ReservaCredito',
|
12
|
-
inclui: 'Inclui',
|
13
|
-
lista: 'Lista'
|
14
|
-
}.freeze
|
15
|
-
private_constant :ENDPOINTS_NAMES
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'TrocaDevolucao'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
20
|
-
unless params.empty?
|
21
|
-
query = Millennium::Helpers.mount_query(params)
|
22
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
23
|
-
end
|
24
|
-
Millennium::Request.run(url)
|
25
|
-
end
|
26
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
27
13
|
end
|
28
14
|
end
|
29
15
|
end
|
data/lib/millennium/version.rb
CHANGED
@@ -2,29 +2,14 @@
|
|
2
2
|
module Millennium
|
3
3
|
# lib/millennium/vitrine/vitrine.rb
|
4
4
|
class Vitrine
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
atualiza_classificacoes: 'Atualiza_Classificacoes',
|
11
|
-
lista_classificacoes: 'Lista_Classificacoes',
|
12
|
-
atualiza_status: 'Atualiza_Status',
|
13
|
-
atualiza_log: 'Atualiza_Log',
|
14
|
-
lista_status: 'Lista_Status'
|
15
|
-
}.freeze
|
16
|
-
private_constant :ENDPOINTS_NAMES
|
5
|
+
def initialize(endpoint, params)
|
6
|
+
@object = 'Vitrine'
|
7
|
+
@endpoint = endpoint
|
8
|
+
@params = params
|
9
|
+
end
|
17
10
|
|
18
|
-
|
19
|
-
|
20
|
-
url = "#{OBJECT}/#{endpoint}?$format=json"
|
21
|
-
unless params.empty?
|
22
|
-
query = Millennium::Helpers.mount_query(params)
|
23
|
-
url = "#{OBJECT}/#{endpoint}?#{query}$format=json"
|
24
|
-
end
|
25
|
-
Millennium::Request.run(url)
|
26
|
-
end
|
27
|
-
end
|
11
|
+
def run
|
12
|
+
Millennium::Request.new(@object, @endpoint, @params).run
|
28
13
|
end
|
29
14
|
end
|
30
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: millennium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Henrique Bruce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|