fastshop_catalog 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: 76b73dee01bf883aae1781b9abc17e38d965fdc0
4
- data.tar.gz: 10613c0eaaeeabd3d8da64710b152ebd9d433ecf
3
+ metadata.gz: ac4d5b427a4ee7fa498940e1ad54d9615178e27d
4
+ data.tar.gz: f28263822113c954590a3d338e128f91819c0d66
5
5
  SHA512:
6
- metadata.gz: c5ab5fc0db22ea41101ca361109d72dfa8c94e432322f6dca926ecad4f8744422c79ebff5b12c38fb7a4588e7e36e54d52b06d1f242931b854e00496f225a907
7
- data.tar.gz: df150ff96aef2d0cd366e0ba6e2437fa1e52164c8784710a3078ced6cda4fa09a1af09f1694a6ea4d71d440a0f5983f9c26149f3839e0c3fc76cba4f02e2b674
6
+ metadata.gz: 4fa067fe67fa784f594eb3b34e1dab041b1a2c4056aa3f41257b113df02369de34ec7059fc54d1e65d285c14d815a26caa095b364b0a75b43d47903e89b64466
7
+ data.tar.gz: cbfe71e70db5fe9d7090af6b7d7aafdcfde2d7bf4b69cd7d20b57e0a2b62464c486233b7ea6e5f233f34652e117d23b033aba3b64aa6fe5e90581fa7f2c0278a
@@ -1,26 +1,31 @@
1
1
  module FastshopCatalog
2
2
  class BaseEntity
3
-
3
+
4
4
  def self.translate(map)
5
- #instantiates the translation map and creates accessors
5
+ #instantiates the translation map and creates accessors
6
6
  @translate_map = map
7
7
  self.instance_eval do
8
8
  map.each_key{|k| attr_accessor k}
9
9
  end
10
10
  end
11
-
11
+
12
12
  def self.translate_symbol(symbol)
13
13
  @translate_map[symbol]
14
14
  end
15
-
15
+
16
16
  def to_map
17
17
  map = {}
18
18
  #translates the variables to it's synonyms
19
- self.class.public_instance_methods(optional=false).grep(/.*[^\=]$/).each do |m|
19
+ self.class.public_instance_methods(optional=false).grep(/.*[^\=]$/).each do |m|
20
20
  map[self.class.translate_symbol(m.to_sym)] = self.send(m) if self.send(m)
21
21
  end
22
22
  #orders the map by the synonym
23
- map.keys.sort.inject({}){|o, k| o[k] = map[k]; o}
23
+ map.keys.sort.inject({}) do |o, k|
24
+ content = map[k]
25
+ content = content.to_map if content.respond_to? :to_map
26
+ o[k] = content
27
+ o
28
+ end
24
29
  end
25
30
 
26
31
  def to_json(*a)
@@ -1,3 +1,3 @@
1
1
  module FastshopCatalog
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -21,9 +21,9 @@ describe FastshopCatalog::CheckAvailabilityService do
21
21
  order.items = [order_item]
22
22
  order
23
23
  end
24
-
24
+
25
25
  let(:order_fixture) do
26
- {"tns:dadosPedido"=>{"fas:Cep"=>"02029001", "fas:Contrato"=>"1234567890", "fas:Cpf"=>"73978898160", "fas:Itens"=>[{"fas:ColocacaoPedidoItensEntity"=>{"fas:Quantidade"=>1, "fas:Sku"=>"SODPFC70A", "fas:ValorUnitario"=>"249.00"}}], "fas:Numero"=>"1560", "fas:ValorTotal"=>"249.00"}}
26
+ {"tns:dadosPedido"=>{"fas:Cep"=>"02029001", "fas:Contrato"=>"1234567890", "fas:Cpf"=>"73978898160", "fas:Itens"=>[{"fas:PedidoItensEntity"=>{"fas:Quantidade"=>1, "fas:Sku"=>"SODPFC70A", "fas:ValorUnitario"=>"249.00"}}], "fas:Numero"=>"1560", "fas:ValorTotal"=>"249.00"}}
27
27
  end
28
28
 
29
29
  let(:fixture) do
@@ -27,7 +27,7 @@ describe FastshopCatalog::CheckAvailabilityService do
27
27
  service = FastshopCatalog::CheckAvailabilityService.new
28
28
  result = service.check(order)
29
29
  rescue FastshopCatalog::ServiceException => e
30
- expect(e.code).to eq(11)
30
+ expect(e.code).to eq(15)
31
31
  end
32
32
  end
33
33
  end
@@ -6,7 +6,7 @@ describe FastshopCatalog::ParticipantService do
6
6
  let(:contract_number) do
7
7
  "1234567890"
8
8
  end
9
-
9
+
10
10
  let(:participant) do
11
11
  ParticipantFactory.build
12
12
  end
@@ -18,12 +18,14 @@ describe FastshopCatalog::ParticipantService do
18
18
  describe "insert integration", :integration => true do
19
19
 
20
20
  it "should insert the participant and return a null token" do
21
- expect{service.insert(participant)}.to raise_error(FastshopCatalog::ServiceException) do |e|
22
- expect(e.code).to eq(45)
23
- expect(e.description).to eq('Email cadastrado')
24
- end
21
+ response = service.insert(participant)
22
+ expect(response).to eql(nil)
23
+ # expect{service.insert(participant)}.to raise_error(FastshopCatalog::ServiceException) do |e|
24
+ # expect(e.code).to eq(45)
25
+ # expect(e.description).to eq('Email já cadastrado')
26
+ # end
25
27
  end
26
-
28
+
27
29
  it "should raise incompatible address exception" do
28
30
  participant.address.neighborhood = 'Moema'
29
31
  expect{service.insert(participant)}.to raise_error(FastshopCatalog::ServiceException) do |e|
@@ -2,7 +2,7 @@ class ParticipantFactory
2
2
  def self.build
3
3
  participant = FastshopCatalog::Entity::Participant.new
4
4
  participant.contract_code = '1234567890'
5
- participant.document = '73978898160'
5
+ participant.document = '37276636348'
6
6
  participant.registry = '11111111'
7
7
  participant.name = 'TESTE PARTICIPANTE'
8
8
  #year, month, day
@@ -15,7 +15,7 @@ class ParticipantFactory
15
15
  participant.work_phone = '11111111'
16
16
  participant.mobile_phone_prefix = '11'
17
17
  participant.mobile_phone = '11111111'
18
- participant.email = 'teste@teste.com.br'
18
+ participant.email = 'teste@testemaroto.com.br'
19
19
  participant.status = 'A'
20
20
  participant.operation_type = '0'
21
21
  participant.address = FastshopCatalog::Entity::Address.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastshop_catalog
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
  - Thiago Ganzarolli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2013-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler