fastshop_catalog 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastshop_catalog/base_entity.rb +11 -6
- data/lib/fastshop_catalog/version.rb +1 -1
- data/spec/fastshop_catalog/check_availability_service_spec.rb +2 -2
- data/spec/fastshop_catalog/integration/check_availability_service_integration_spec.rb +1 -1
- data/spec/fastshop_catalog/integration/participant_service_integration_spec.rb +8 -6
- data/spec/fastshop_catalog/participant_factory.rb +2 -2
- 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: ac4d5b427a4ee7fa498940e1ad54d9615178e27d
|
4
|
+
data.tar.gz: f28263822113c954590a3d338e128f91819c0d66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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({})
|
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)
|
@@ -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:
|
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(
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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 = '
|
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@
|
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.
|
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-
|
11
|
+
date: 2013-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|