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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6e36ef4830f648c47b317abce9664ab3de2ebfa
4
- data.tar.gz: 3374729244ff9b5e795071bd81f0e76f88c4738b
3
+ metadata.gz: 4e0e40625da7745cbbe9dde088d8b65940c1488a
4
+ data.tar.gz: 09f46eb1f7a1111cb54c26d3fb4d1e0b7bb8bdd9
5
5
  SHA512:
6
- metadata.gz: 07568f8f6bd486c9263970ed0ce0c3de27af4a7ed8c590311bd34a1875db22ad307fe2020495a6f125b97406d62c65fe92633195bfc6f481efb1316d686a337b
7
- data.tar.gz: 09f5d8c2733a232dcb1e5be374fc97ad000b62034b613112345cecc091c1c26e02f4984e05553b6d6b124cd67529ba318ea84f9d19357f96d48262f58b8a2cdb
6
+ metadata.gz: 33084c34f78b9b799907d164c149fe7712af76daa7ff74423b97d0189bab0d6c34be295a8a72faa0b3e4d4a97013cb1ded00bff96f09e24536dfc38737fdc866
7
+ data.tar.gz: 938a986ef3c6c3e5f62180e6bf0d207b3dc25db52b65ef4071a2d4ba48a3368b999e46249fb24ff621365f8fc41845466fc9a106e448772c50c40f8ced83155e
@@ -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(key)
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.to_sym]
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
- @attributes[attribute_name] = args[0]
75
- @unsaved_values.add(attribute_name)
87
+ self[attribute_name] = args[0]
76
88
  else
77
- @attributes[name] || nil
89
+ self[name]
78
90
  end
79
91
  end
80
92
  end
@@ -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.1"
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}
@@ -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.1
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-20 00:00:00.000000000 Z
12
+ date: 2015-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler