pagseguro-transparente 0.2.2 → 0.2.3

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: 8b8088b8877906203d00cc2294f9c7f8edacb523
4
- data.tar.gz: e3046f46a0826f0f95e92737676add99d85c1b90
3
+ metadata.gz: 82ce78e0821dd9736276cc6eb93c7797b41ddf66
4
+ data.tar.gz: 8ac2777db76a2fcb7a932368887c94a92116dcbb
5
5
  SHA512:
6
- metadata.gz: 4266606973370c28dd3851364c7aaa8ddf39efcc0e74d260814c68d57cb1b8beed2d77265e0b5f87824c15cf2022fbf222965f02769ee40e89dc6d413d196421
7
- data.tar.gz: 7d5f884876144040e9a9c7d2dbc081e029c514db07ff15cc62418e3a7296efd90a8d5c335859f93c818d3d92035f23c1bf8435d029633329183d5142981947c3
6
+ metadata.gz: 217b25a873ee12e50ccfef614d6d323e449af41c9ea7ab55f5118d589ae1bb409bc5e5d7ec0a168aec4197903d5d2920ff7a6ca6f392eb1531f650b28bdf3ef9
7
+ data.tar.gz: eb6d1049b728d6b89911faa8b2b9051ce8a4b90a1a4ce30822bdfa1c549f2e14c3c28be887781b505ea15a01fa58af2bfecdc89953723a1a441270a0125e04de
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ pagseguro-tranparente
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagseguro-transparente (0.2.1)
4
+ pagseguro-transparente (0.2.3)
5
5
  activemodel
6
6
  httparty (~> 0.13)
7
7
  i18n (~> 0.6)
@@ -42,7 +42,7 @@ GEM
42
42
  minitest (5.3.4)
43
43
  multi_json (1.10.0)
44
44
  multi_xml (0.5.5)
45
- nokogiri (1.6.4.1)
45
+ nokogiri (1.6.5)
46
46
  mini_portile (~> 0.6.0)
47
47
  rake (10.3.2)
48
48
  rest-client (1.6.7)
data/README.md CHANGED
@@ -21,7 +21,7 @@ Rails >= 3.0
21
21
 
22
22
  Adicione a biblioteca ao arquivo Gemfile:
23
23
  ~~~.ruby
24
- gem "pagseguro-transparente", "~> 0.0.2"
24
+ gem "pagseguro-transparente", "~> 0.2.3"
25
25
  ~~~
26
26
  * Ainda não publicada, é preciso baixar direto do Github.
27
27
 
@@ -42,7 +42,7 @@ pagseguro_session = PagSeguro::Session.new
42
42
  ##Criando uma transação
43
43
  ~~~.ruby
44
44
  payment = PagSeguro::Payment.new(notification_url: 'www.eventick.com.br', payment_method: 'boleto', reference: '1')
45
- items = [PagSeguro::Item.new(1, 'Ingresso Teste', 2, 1)]
45
+ items = [PagSeguro::Item.new(id: 1, description: 'Ingresso Teste', amount: 2, quantity: 1)]
46
46
  payment.items = items
47
47
 
48
48
 
data/lib/pagseguro.rb CHANGED
@@ -51,6 +51,18 @@ module PagSeguro
51
51
 
52
52
  # Timeout value in seconds for requests.
53
53
  attr_accessor :timeout
54
+
55
+ def api_url
56
+ uris.fetch(environment)
57
+ end
58
+
59
+ private
60
+ def uris
61
+ @uris ||= {
62
+ production: 'https://ws.pagseguro.uol.com.br/v2',
63
+ sandbox: 'https://ws.sandbox.pagseguro.uol.com.br/v2'
64
+ }
65
+ end
54
66
  end
55
67
 
56
68
  self.environment = :production
@@ -60,6 +72,7 @@ module PagSeguro
60
72
  # PagSeguro.configure do |config|
61
73
  # config.email = "john@example.com"
62
74
  # config.token = "abc"
75
+ # config.environment = :sandbox
63
76
  # end
64
77
  #
65
78
  def self.configure(&block)
@@ -5,14 +5,14 @@ module PagSeguro
5
5
  include HTTParty
6
6
  debug_output $stderr
7
7
 
8
- base_uri "https://ws.pagseguro.uol.com.br/v2/"
9
-
10
8
  def get(path, account = "default")
9
+ self.class.base_uri PagSeguro.api_url
11
10
  options = { query: add_credencials(account) }
12
11
  self.class.get(path, options)
13
12
  end
14
13
 
15
14
  def post(path, account = "default", params = {})
15
+ self.class.base_uri PagSeguro.api_url
16
16
  options = { body: add_credencials(account) }
17
17
  options[:body].merge!(params)
18
18
  options[:timeout] = PagSeguro.timeout unless PagSeguro.timeout.blank?
@@ -1,3 +1,3 @@
1
1
  module PagSeguro
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -22,4 +22,15 @@ describe PagSeguro do
22
22
  context "default settings" do
23
23
  it { expect(PagSeguro.environment).to eql(:production) }
24
24
  end
25
+
26
+ describe ".api_url" do
27
+ context "production" do
28
+ it { expect(PagSeguro.api_url).to eq('https://ws.pagseguro.uol.com.br/v2') }
29
+ end
30
+
31
+ context "sandbox" do
32
+ before { PagSeguro.environment = :sandbox }
33
+ it { expect(PagSeguro.api_url).to eq('https://ws.sandbox.pagseguro.uol.com.br/v2') }
34
+ end
35
+ end
25
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagseguro-transparente
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cirdes Henrique
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-26 00:00:00.000000000 Z
12
+ date: 2015-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -189,6 +189,8 @@ extra_rdoc_files: []
189
189
  files:
190
190
  - ".DS_Store"
191
191
  - ".gitignore"
192
+ - ".ruby-gemset"
193
+ - ".ruby-version"
192
194
  - ".travis.yml"
193
195
  - Gemfile
194
196
  - Gemfile.lock