millennium 0.0.5 → 0.0.6

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
2
  SHA1:
3
- metadata.gz: a632e46fa969b40e2a60873910436cebbd9b283f
4
- data.tar.gz: 0e7cb20084811ae90f0eb476331d2e06a9c5b079
3
+ metadata.gz: 3e79311fef9b818566d4634696bc87c611d756cc
4
+ data.tar.gz: 38b42f039d09cdfece3e6ea06cd31e105ca572ac
5
5
  SHA512:
6
- metadata.gz: 7eaf5c8131751d5b827f190e1f317bb83e73b1571499d4c89fe5a487cf213da765d29d7d416790ea83bcab42ffa577644bca1acf7247db31cc067e8e5cec71fa
7
- data.tar.gz: 3245129460de7a8137cf1bac400d7b38922fa54489e104fb65cda08a4382e825ae839d098102ee7d615da4727aac8fbf3f52658c35d1fea77d64e49def055180
6
+ metadata.gz: ef0561188d61266abaf9ad48b166218ea587c87659db9b147cb14940560fae48da427e64793c868561b28192e393f4333685ea18bd625bd2e94142a0c614651c
7
+ data.tar.gz: 2369c453fd45727cf50e05310450fbb8fce9eac6e2f74c353bac2836726a28595a3aa229b0d1c15d0b721575eaad5ccae17b2e93954fbcfe72c4b8b3cd3fccf3
@@ -4,18 +4,8 @@ require 'typhoeus'
4
4
  require 'json'
5
5
 
6
6
  require 'millennium/config'
7
- require 'millennium/clientes/clientes'
8
- require 'millennium/crm_chamados/crm_chamados'
9
- require 'millennium/crm/crm'
10
7
  require 'millennium/errors'
11
- require 'millennium/helpers'
12
- require 'millennium/modulo/modulo'
13
- require 'millennium/pedido_venda/pedido_venda'
14
- require 'millennium/produtos/produtos'
15
8
  require 'millennium/request'
16
- require 'millennium/transportadoras/transportadoras'
17
- require 'millennium/troca_devolucao/troca_devolucao'
18
- require 'millennium/vitrine/vitrine'
19
9
  require 'millennium/version'
20
10
 
21
11
  # lib/millennium
@@ -2,27 +2,26 @@
2
2
  module Millennium
3
3
  # lib/millennium/request.rb
4
4
  class Request
5
- HOSTNAME = Millennium::Config.host || 'millennium.iwise.com.br'
6
- PORT = Millennium::Config.port || '888'
7
-
8
- private_constant :HOSTNAME
9
- private_constant :PORT
10
-
11
5
  def initialize(object, endpoint, params)
12
- @full_endpoint = Millennium::Helpers.full_endpoint(
13
- object, endpoint, params
14
- )
6
+ @object = object
7
+ @endpoint = endpoint
8
+ @params = params
15
9
  end
16
10
 
17
11
  def run
18
12
  options = Millennium::Config.options
19
- Typhoeus::Request.new(url, options).run
13
+ format = {}
14
+ format['$format'] = 'json'
15
+ params = @params.merge(format)
16
+ Typhoeus::Request.new(url, options.merge(params: params)).run
20
17
  end
21
18
 
22
19
  private
23
20
 
24
21
  def url
25
- "http://#{HOSTNAME}:#{PORT}/api/millenium_eco/#{@full_endpoint}"
22
+ hostname = Millennium::Config.host
23
+ port = Millennium::Config.port
24
+ "http://#{hostname}:#{port}/api/millenium_eco/#{@object}/#{@endpoint}"
26
25
  end
27
26
  end
28
27
  end
@@ -1,4 +1,4 @@
1
1
  # lib/millennium/version.rb
2
2
  module Millennium
3
- VERSION = '0.0.5'.freeze
3
+ VERSION = '0.0.6'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: millennium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Henrique Bruce
@@ -90,21 +90,11 @@ files:
90
90
  - Gemfile
91
91
  - README.md
92
92
  - lib/millennium.rb
93
- - lib/millennium/clientes/clientes.rb
94
93
  - lib/millennium/config.rb
95
- - lib/millennium/crm/crm.rb
96
- - lib/millennium/crm_chamados/crm_chamados.rb
97
94
  - lib/millennium/errors.rb
98
95
  - lib/millennium/errors/millennium_error.rb
99
- - lib/millennium/helpers.rb
100
- - lib/millennium/modulo/modulo.rb
101
- - lib/millennium/pedido_venda/pedido_venda.rb
102
- - lib/millennium/produtos/produtos.rb
103
96
  - lib/millennium/request.rb
104
- - lib/millennium/transportadoras/transportadoras.rb
105
- - lib/millennium/troca_devolucao/troca_devolucao.rb
106
97
  - lib/millennium/version.rb
107
- - lib/millennium/vitrine/vitrine.rb
108
98
  - spec/millennium_spec.rb
109
99
  - spec/spec_helper.rb
110
100
  homepage: https://github.com/phbruce/millennium
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/clientes/clientes.rb
4
- class Clientes
5
- def initialize(endpoint, params)
6
- @object = 'Clientes'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/crm/crm.rb
4
- class CRM
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
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/crm_chamados/crm_chamados.rb
4
- class CRMChamados
5
- def initialize(endpoint, params)
6
- @object = 'Crm.Chamados'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,17 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millenium/errors.rb
4
- module Helpers
5
- def self.mount_query(params)
6
- params.each_with_object('') do |(key, value), query|
7
- query << "#{key}=#{value}&"
8
- end
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
16
- end
17
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/modulo/modulo.rb
4
- class Modulo
5
- def initialize(endpoint, params)
6
- @object = 'Module'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/pedido_venda/pedido_venda.rb
4
- class PedidoVenda
5
- def initialize(endpoint, params)
6
- @object = 'Pedido_Venda'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/produtos/produtos.rb
4
- class Produtos
5
- def initialize(endpoint, params)
6
- @object = 'Produtos'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/transportadoras/transportadoras.rb
4
- class Transportadoras
5
- def initialize(endpoint, params)
6
- @object = 'Transportadoras'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/troca_devolucao/troca_devolucao.rb
4
- class TrocaDevolucao
5
- def initialize(endpoint, params)
6
- @object = 'TrocaDevolucao'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
- module Millennium
3
- # lib/millennium/vitrine/vitrine.rb
4
- class Vitrine
5
- def initialize(endpoint, params)
6
- @object = 'Vitrine'
7
- @endpoint = endpoint
8
- @params = params
9
- end
10
-
11
- def run
12
- Millennium::Request.new(@object, @endpoint, @params).run
13
- end
14
- end
15
- end