gera_pedido 0.0.1
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.
- data/Rakefile +7 -0
- data/gera_pedido.gemspec +8 -0
- data/lib/gera_pedido/gera_pedido.rb +39 -0
- data/lib/gera_pedido/status_pedido.rb +70 -0
- data/test/gera_pedido_test.rb +2 -0
- metadata +49 -0
data/Rakefile
ADDED
data/gera_pedido.gemspec
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "gera_pedido"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.description = "A simple gem that generate walmart request's buy for ecommerce"
|
|
5
|
+
s.summary = ""
|
|
6
|
+
s.author = "Ordilei Souza"
|
|
7
|
+
s.files = Dir["{lib/**/*.rb,README.rdoc,test/**/*.rb,Rakefile,*.gemspec}"]
|
|
8
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module CucumberServiceHelper
|
|
2
|
+
|
|
3
|
+
require HTTParty
|
|
4
|
+
def conect_service
|
|
5
|
+
@config_ped = "#{RAILS_ROOT}/config/config_ped.yml"
|
|
6
|
+
puts " config_ped => #{config_ped}"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def post_service(json_choice)
|
|
10
|
+
@conect_service_up = YAML.load_file(config_ped)[:conect_service_up]
|
|
11
|
+
|
|
12
|
+
resposta2 = HTTParty.post(conect_service_up[:host],
|
|
13
|
+
{
|
|
14
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
15
|
+
:body => File.read(File.join('features/support/fixtures/', post_service)),
|
|
16
|
+
:basic_auth => {:username => conect_service_up[:name], :password => conect_service_up[:password]}
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
puts resposta2.body, resposta2.code
|
|
20
|
+
|
|
21
|
+
res = JSON.parse(resposta2.body)
|
|
22
|
+
@idMkp = res["orderId"]
|
|
23
|
+
puts @idMkp
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def post_service_down(text)
|
|
27
|
+
|
|
28
|
+
@conect_service_fall = YAML.load_file(config_ped)[:conect_service_fall]
|
|
29
|
+
resposta = HTTParty.post(conect_service_fall[:host],
|
|
30
|
+
{
|
|
31
|
+
:headers => {'Content-Type' => 'application/json', 'Accept' => 'application/json'},
|
|
32
|
+
:body => {:id => text}.to_json,
|
|
33
|
+
:basic_auth => {:username => conect_service_fall[:name], :password => conect_service_fall[:password]}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
puts resposta.body, resposta.code
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module CucumberSigeConnectionHelpers
|
|
2
|
+
require 'oci8'
|
|
3
|
+
|
|
4
|
+
def conection_db
|
|
5
|
+
config_ped = "#{RAILS_ROOT}/config/config_ped.yml"
|
|
6
|
+
puts " config_ped => #{config_ped}"
|
|
7
|
+
|
|
8
|
+
@conect_banco = YAML.load_file(config_ped)[:conect_banco]
|
|
9
|
+
puts " @conf => #{@conf[0][:conf]}"
|
|
10
|
+
|
|
11
|
+
@conn = OCI8.new(conect_banco[:name], conect_banco[:password], conect_banco[:database])
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def proc_1(text1)
|
|
16
|
+
@conn
|
|
17
|
+
cursor = conn.parse("BEGIN pc_sige_pagto.procmarcafraude(:idpedido); END;")
|
|
18
|
+
cursor.bind_param(':idpedido', text1)
|
|
19
|
+
cursor.exec()
|
|
20
|
+
p cursor[':idpedido']
|
|
21
|
+
conn.commit
|
|
22
|
+
sleep 3;
|
|
23
|
+
conn.logoff
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def proc_2(text2)
|
|
27
|
+
@conn
|
|
28
|
+
cursor2 = conn.parse("BEGIN pc_sige_pagto.procretfraude(:idpedido,'AP'); END;")
|
|
29
|
+
cursor2.bind_param(':idpedido', text2)
|
|
30
|
+
cursor2.exec()
|
|
31
|
+
p cursor2[':idpedido']
|
|
32
|
+
conn.commit
|
|
33
|
+
sleep 3;
|
|
34
|
+
conn.logoff
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def proc_3(text3)
|
|
38
|
+
@conn
|
|
39
|
+
cursor3 = conn.parse("BEGIN pc_sige_pagto.procmarcapag(:idpedido); END;")
|
|
40
|
+
cursor3.bind_param(':idpedido', text3)
|
|
41
|
+
cursor3.exec()
|
|
42
|
+
p cursor3[':idpedido']
|
|
43
|
+
conn.commit
|
|
44
|
+
sleep 3;
|
|
45
|
+
conn.logoff
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def proc_4(text4)
|
|
49
|
+
@conn
|
|
50
|
+
cursor4 = conn.parse("BEGIN pc_sige_pagto.procretpag(:idpedido, 1, 'AP', null, null, 012, 1421, 1421, trunc(sysdate), null, null, null, null, null, null, '999.99', '999.99', 1, null); END;")
|
|
51
|
+
cursor4.bind_param(':idpedido', text4)
|
|
52
|
+
cursor4.exec()
|
|
53
|
+
p cursor4[':idpedido']
|
|
54
|
+
conn.commit
|
|
55
|
+
sleep 3;
|
|
56
|
+
conn.logoff
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def proc_5(text5)
|
|
60
|
+
@conn
|
|
61
|
+
cursor4 = conn.parse("BEGIN pc_npro_marketplace.retorno_entrega(p_id_cia => 1, p_id_pedido => :idpedido, p_status => 'S', p_in_erro => null, p_mens_erro => null); END;")
|
|
62
|
+
cursor4.bind_param(':idpedido', text4)
|
|
63
|
+
cursor4.exec()
|
|
64
|
+
p cursor4[':idpedido']
|
|
65
|
+
conn.commit
|
|
66
|
+
sleep 3;
|
|
67
|
+
conn.logoff
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gera_pedido
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Ordilei Souza
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2014-02-02 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: A simple gem that generate walmart request's buy for ecommerce
|
|
15
|
+
email:
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/gera_pedido/gera_pedido.rb
|
|
21
|
+
- lib/gera_pedido/status_pedido.rb
|
|
22
|
+
- test/gera_pedido_test.rb
|
|
23
|
+
- Rakefile
|
|
24
|
+
- gera_pedido.gemspec
|
|
25
|
+
homepage:
|
|
26
|
+
licenses: []
|
|
27
|
+
post_install_message:
|
|
28
|
+
rdoc_options: []
|
|
29
|
+
require_paths:
|
|
30
|
+
- lib
|
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
|
+
none: false
|
|
33
|
+
requirements:
|
|
34
|
+
- - ! '>='
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '0'
|
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
|
+
none: false
|
|
39
|
+
requirements:
|
|
40
|
+
- - ! '>='
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: '0'
|
|
43
|
+
requirements: []
|
|
44
|
+
rubyforge_project:
|
|
45
|
+
rubygems_version: 1.8.25
|
|
46
|
+
signing_key:
|
|
47
|
+
specification_version: 3
|
|
48
|
+
summary: ''
|
|
49
|
+
test_files: []
|