paypal-frete-facil 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +18 -10
- data/lib/paypal/fretefacil/version.rb +2 -2
- data/lib/paypal/fretefacil/web_service.rb +14 -8
- data/paypal-frete-facil.gemspec +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@ Cálculo de frete através do PayPal Frete Fácil (http://www.paypal-brasil.com.
|
|
5
5
|
== Instalando
|
6
6
|
|
7
7
|
=== Gemfile
|
8
|
-
gem 'paypal-frete-facil', '~> 0.
|
8
|
+
gem 'paypal-frete-facil', '~> 0.2.0'
|
9
9
|
|
10
10
|
=== Instalação direta
|
11
11
|
$ gem install paypal-frete-facil
|
@@ -28,17 +28,18 @@ Cálculo de frete através do PayPal Frete Fácil (http://www.paypal-brasil.com.
|
|
28
28
|
|
29
29
|
== Log
|
30
30
|
|
31
|
-
Por padrão, cada chamada ao Web Service do PayPal Frete Fácil é logada em STDOUT, usando a gem {LogMe}[http://github.com/prodis/log-me].
|
31
|
+
Por padrão, cada chamada ao Web Service do PayPal Frete Fácil é logada em STDOUT, com nível de log :info, usando a gem {LogMe}[http://github.com/prodis/log-me].
|
32
32
|
|
33
|
-
|
33
|
+
Exemplo de log:
|
34
|
+
I, [2011-08-29T22:00:52.624430 #2186] INFO -- : PayPal-Frete-Facil Request:
|
35
|
+
https://ff.paypal-brasil.com.br/FretesPayPalWS/WSFretesPayPal
|
36
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:frete="https://ff.paypal-brasil.com.br/FretesPayPalWS"><soapenv:Header /><soapenv:Body><frete:getPreco><cepOrigem>04094-050</cepOrigem><cepDestino>90619-900</cepDestino><largura>15</largura><altura>2</altura><profundidade>30</profundidade><peso>0.3</peso></frete:getPreco></soapenv:Body></soapenv:Envelope>
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
config.logger = Rails.logger # Usa o logger do Rails
|
39
|
-
end
|
38
|
+
I, [2011-08-29T22:00:53.917895 #2186] INFO -- : PayPal-Frete-Facil Response:
|
39
|
+
HTTP/1.1 200 OK
|
40
|
+
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getPrecoResponse xmlns:ns2="https://ff.paypal-brasil.com.br/FretesPayPalWS"><return>13.873999999999999</return></ns2:getPrecoResponse></S:Body></S:Envelope>
|
40
41
|
|
41
|
-
|
42
|
+
Se você configurar o nível de log como :debug, serão logados também todos os cabeçalhos HTTP da requisição e da resposta:
|
42
43
|
I, [2011-08-29T22:00:52.624430 #2186] INFO -- : PayPal-Frete-Facil Request:
|
43
44
|
https://ff.paypal-brasil.com.br/FretesPayPalWS/WSFretesPayPal
|
44
45
|
accept: */*
|
@@ -57,10 +58,17 @@ Exemplo de log:
|
|
57
58
|
connection: close
|
58
59
|
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getPrecoResponse xmlns:ns2="https://ff.paypal-brasil.com.br/FretesPayPalWS"><return>13.873999999999999</return></ns2:getPrecoResponse></S:Body></S:Envelope>
|
59
60
|
|
61
|
+
Para desabilitar o log, mudar o nível do log ou configurar um outro mecanismo de log, use o módulo PayPal::FreteFacil.
|
62
|
+
|
63
|
+
PayPal::FreteFacil.configure do |config|
|
64
|
+
config.log_enabled = false # Desabilita o log
|
65
|
+
config.log_level = :debug # Altera o nível do log
|
66
|
+
config.logger = Rails.logger # Usa o logger do Rails
|
67
|
+
end
|
60
68
|
|
61
69
|
== Informações adicionais
|
62
70
|
|
63
|
-
=== Maneiras de configurar atributos no construtor de
|
71
|
+
=== Maneiras de configurar atributos no construtor de PayPal::FreteFacil::Frete
|
64
72
|
|
65
73
|
==== Com um hash
|
66
74
|
frete = PayPal::FreteFacil::Frete.new :cep_origem => "04094-050",
|
@@ -50,17 +50,23 @@ module PayPal
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def format_request_message(request)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
format_message(request) do |message|
|
54
|
+
message = with_line_break { "PayPal-Frete-Facil Request:" }
|
55
|
+
message << with_line_break { URL }
|
56
|
+
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def format_response_message(response)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
format_message(response) do |message|
|
61
|
+
message = with_line_break { "PayPal-Frete-Facil Response:" }
|
62
|
+
message << with_line_break { "HTTP/#{response.http_version} #{response.code} #{response.message}" }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def format_message(http)
|
67
|
+
message = yield
|
68
|
+
message << with_line_break { format_headers_for(http) } if PayPal::FreteFacil.log_level == :debug
|
69
|
+
message << with_line_break { http.body }
|
64
70
|
end
|
65
71
|
|
66
72
|
def format_headers_for(http)
|
data/paypal-frete-facil.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{paypal-frete-facil}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Prodis a.k.a. Fernando Hamasaki"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-02}
|
13
13
|
s.description = %q{Cálculo de frete através do PayPal Frete Fácil (http://www.paypal-brasil.com.br/fretefacil).}
|
14
14
|
s.email = %q{prodis@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: paypal-frete-facil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Prodis a.k.a. Fernando Hamasaki
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-09-02 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|