cieloloja 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/cieloloja.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "cieloloja"
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["TByte Consultoria", "Giulliano Bueno"]
12
- s.date = "2012-07-20"
12
+ s.date = "2012-07-21"
13
13
  s.description = "Integra\u{e7}\u{e3}o com a cielo"
14
14
  s.email = "giulliano@e-processamento.com"
15
15
  s.extra_rdoc_files = [
@@ -30,8 +30,8 @@ Gem::Specification.new do |s|
30
30
  "lib/cieloloja/version.rb",
31
31
  "lib/generators/cielo/install_generator.rb",
32
32
  "lib/generators/templates/cieloloja.rb",
33
- "spec/cielo/connection_spec.rb",
34
- "spec/cielo/transaction_spec.rb",
33
+ "spec/cieloloja/connection_spec.rb",
34
+ "spec/cieloloja/transaction_spec.rb",
35
35
  "spec/spec_helper.rb"
36
36
  ]
37
37
  s.homepage = "http://github.com/giubueno/cieloloja"
@@ -6,6 +6,14 @@ module Cieloloja
6
6
  port = 443
7
7
  @http = Net::HTTP.new(@environment::BASE_URL,port)
8
8
  @http.use_ssl = true
9
+ if @environment.ssl_verify_mode == nil
10
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
11
+ else
12
+ @http.verify_mode = @environment.ssl_verify_mode
13
+ end
14
+ https.ca_path = '/etc/ssl/certs' if File.exists?('/etc/ssl/certs') # Ubuntu
15
+ https.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' if File.exists?('/opt/local/share/curl/curl-ca-bundle.crt') # Mac OS X
16
+
9
17
  @http.open_timeout = 10*1000
10
18
  @http.read_timeout = 40*1000
11
19
  end
@@ -16,6 +24,8 @@ module Cieloloja
16
24
  str_params+="&" unless str_params.empty?
17
25
  str_params+="#{key}=#{value}"
18
26
  end
27
+
28
+ Rails.logger.info "Enviando XML para Cielo: #{str_params}"
19
29
  @http.request_post(self.environment::WS_PATH, str_params)
20
30
  end
21
31
  end
@@ -2,7 +2,7 @@ module Cieloloja
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 2
5
+ PATCH = 3
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/lib/cieloloja.rb CHANGED
@@ -12,11 +12,13 @@ module Cieloloja
12
12
  class Production
13
13
  BASE_URL = "ecommerce.cbmp.com.br"
14
14
  WS_PATH = "/servicos/ecommwsec.do"
15
+ ssl_verify_mode = OpenSSL::SSL::VERIFY_NONE
15
16
  end
16
17
 
17
18
  class Test
18
19
  BASE_URL = "qasecommerce.cielo.com.br"
19
20
  WS_PATH = "/servicos/ecommwsec.do"
21
+ ssl_verify_mode = OpenSSL::SSL::VERIFY_NONE
20
22
  end
21
23
 
22
24
  @@environment = :test
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Cielo::Connection do
3
+ describe Cieloloja::Connection do
4
4
  before do
5
- @connection = Cielo::Connection.new
5
+ @connection = Cieloloja::Connection.new
6
6
  end
7
7
  it "should estabilish connection when was created" do
8
8
  @connection.environment.should_not be_nil
@@ -1,9 +1,9 @@
1
1
  #encoding: utf-8
2
2
  require 'spec_helper'
3
3
 
4
- describe Cielo::Transaction do
4
+ describe Cieloloja::Transaction do
5
5
  before do
6
- @transaction = Cielo::Transaction.new
6
+ @transaction = Cieloloja::Transaction.new
7
7
  end
8
8
 
9
9
  describe "create a transaction" do
@@ -12,7 +12,7 @@ describe Cielo::Transaction do
12
12
  end
13
13
  [:numero, :valor, :bandeira, :"url-retorno"].each do |parameter|
14
14
  it "raises an error when #{parameter} isn't informed" do
15
- lambda { @transaction.create! @params.except!(parameter) }.should raise_error(Cielo::MissingArgumentError)
15
+ lambda { @transaction.create! @params.except!(parameter) }.should raise_error(Cieloloja::MissingArgumentError)
16
16
  end
17
17
  end
18
18
  it "delivers an successful message" do
@@ -78,15 +78,16 @@ describe Cielo::Transaction do
78
78
 
79
79
  describe "Using a production environment" do
80
80
  before do
81
- Cielo.setup do |config|
81
+ Cieloloja.setup do |config|
82
82
  config.environment = :production
83
83
  config.numero_afiliacao = "1001734891"
84
84
  config.chave_acesso="e84827130b9837473681c2787007da5914d6359947015a5cdb2b8843db0fa832"
85
+ ssl_verify_mode = OpenSSL::SSL::VERIFY_NONE
85
86
  end
86
87
  end
87
88
 
88
89
  it "must use the production environment" do
89
- Cielo.numero_afiliacao.should be_eql "1001734891"
90
+ Cieloloja.numero_afiliacao.should be_eql "1001734891"
90
91
  end
91
92
 
92
93
  end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,2 @@
1
- require 'cielo'
1
+ require 'cieloloja'
2
2
  require 'fakeweb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cieloloja
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-20 00:00:00.000000000 Z
13
+ date: 2012-07-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -167,8 +167,8 @@ files:
167
167
  - lib/cieloloja/version.rb
168
168
  - lib/generators/cielo/install_generator.rb
169
169
  - lib/generators/templates/cieloloja.rb
170
- - spec/cielo/connection_spec.rb
171
- - spec/cielo/transaction_spec.rb
170
+ - spec/cieloloja/connection_spec.rb
171
+ - spec/cieloloja/transaction_spec.rb
172
172
  - spec/spec_helper.rb
173
173
  homepage: http://github.com/giubueno/cieloloja
174
174
  licenses:
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  segments:
187
187
  - 0
188
- hash: 3993648690705813056
188
+ hash: -3512193458132830300
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  none: false
191
191
  requirements: