pagarme 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pagarme/object.rb +18 -6
- data/pagarme.gemspec +1 -1
- data/test/pagarme/transfer.rb +13 -0
- 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: 4e0e40625da7745cbbe9dde088d8b65940c1488a
|
4
|
+
data.tar.gz: 09f46eb1f7a1111cb54c26d3fb4d1e0b7bb8bdd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33084c34f78b9b799907d164c149fe7712af76daa7ff74423b97d0189bab0d6c34be295a8a72faa0b3e4d4a97013cb1ded00bff96f09e24536dfc38737fdc866
|
7
|
+
data.tar.gz: 938a986ef3c6c3e5f62180e6bf0d207b3dc25db52b65ef4071a2d4ba48a3368b999e46249fb24ff621365f8fc41845466fc9a106e448772c50c40f8ced83155e
|
data/lib/pagarme/object.rb
CHANGED
@@ -22,11 +22,17 @@ module PagarMe
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def update(attributes)
|
25
|
+
removed_attributes = @attributes.keys - attributes.keys
|
26
|
+
|
27
|
+
removed_attributes.each do |key|
|
28
|
+
@attributes.delete key
|
29
|
+
end
|
30
|
+
|
25
31
|
attributes.each do |key, value|
|
26
32
|
key = key.to_s
|
27
33
|
|
28
34
|
@attributes[key] = Util.convert_to_pagarme_object(value)
|
29
|
-
@unsaved_values.delete
|
35
|
+
@unsaved_values.delete key
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
@@ -36,10 +42,11 @@ module PagarMe
|
|
36
42
|
|
37
43
|
def []=(key,value)
|
38
44
|
@attributes[key] = value
|
45
|
+
@unsaved_values.add key
|
39
46
|
end
|
40
47
|
|
41
48
|
def [](key)
|
42
|
-
@attributes[key
|
49
|
+
@attributes[key]
|
43
50
|
end
|
44
51
|
|
45
52
|
def to_hash_value(value, type)
|
@@ -63,18 +70,23 @@ module PagarMe
|
|
63
70
|
Hash[@attributes.map { |k, v| [k, to_hash_value(v, 'to_hash')] }]
|
64
71
|
end
|
65
72
|
|
73
|
+
def respond_to?(name, include_all = false)
|
74
|
+
return true if name.to_s.end_with? '='
|
75
|
+
|
76
|
+
@attributes.has_key?(name.to_s) || super
|
77
|
+
end
|
78
|
+
|
66
79
|
protected
|
67
80
|
|
68
81
|
def method_missing(name, *args)
|
69
82
|
name = name.to_s
|
70
83
|
|
71
|
-
if name.end_with?
|
84
|
+
if name.end_with? '='
|
72
85
|
attribute_name = name[0...-1]
|
73
86
|
|
74
|
-
|
75
|
-
@unsaved_values.add(attribute_name)
|
87
|
+
self[attribute_name] = args[0]
|
76
88
|
else
|
77
|
-
|
89
|
+
self[name]
|
78
90
|
end
|
79
91
|
end
|
80
92
|
end
|
data/pagarme.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "pagarme"
|
7
|
-
spec.version = "2.0.
|
7
|
+
spec.version = "2.0.2"
|
8
8
|
spec.authors = ["Pedro Franceschi", "Henrique Dubugras"]
|
9
9
|
spec.email = ["pedrohfranceschi@gmail.com", "henrique@pagar.me"]
|
10
10
|
spec.description = %q{Pagar.me's ruby gem}
|
data/test/pagarme/transfer.rb
CHANGED
@@ -3,6 +3,19 @@ require_relative '../test_helper'
|
|
3
3
|
|
4
4
|
module PagarMe
|
5
5
|
class TransferTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
|
9
|
+
t = PagarMe::Transaction.new({
|
10
|
+
:payment_method => 'boleto',
|
11
|
+
:amount => 10000
|
12
|
+
})
|
13
|
+
|
14
|
+
t.charge
|
15
|
+
t.status = 'paid'
|
16
|
+
t.save
|
17
|
+
end
|
18
|
+
|
6
19
|
should 'be able to create a transfer' do
|
7
20
|
transfer = test_transfer
|
8
21
|
transfer.create
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagarme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Franceschi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|