pagseguro 0.1.5 → 0.1.6

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.
@@ -1,69 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagseguro (0.1.4)
4
+ pagseguro (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  abstract (1.0.0)
10
- actionmailer (3.0.3)
11
- actionpack (= 3.0.3)
12
- mail (~> 2.2.9)
13
- actionpack (3.0.3)
14
- activemodel (= 3.0.3)
15
- activesupport (= 3.0.3)
10
+ actionmailer (3.0.5)
11
+ actionpack (= 3.0.5)
12
+ mail (~> 2.2.15)
13
+ actionpack (3.0.5)
14
+ activemodel (= 3.0.5)
15
+ activesupport (= 3.0.5)
16
16
  builder (~> 2.1.2)
17
17
  erubis (~> 2.6.6)
18
18
  i18n (~> 0.4)
19
19
  rack (~> 1.2.1)
20
20
  rack-mount (~> 0.6.13)
21
- rack-test (~> 0.5.6)
21
+ rack-test (~> 0.5.7)
22
22
  tzinfo (~> 0.3.23)
23
- activemodel (3.0.3)
24
- activesupport (= 3.0.3)
23
+ activemodel (3.0.5)
24
+ activesupport (= 3.0.5)
25
25
  builder (~> 2.1.2)
26
26
  i18n (~> 0.4)
27
- activerecord (3.0.3)
28
- activemodel (= 3.0.3)
29
- activesupport (= 3.0.3)
27
+ activerecord (3.0.5)
28
+ activemodel (= 3.0.5)
29
+ activesupport (= 3.0.5)
30
30
  arel (~> 2.0.2)
31
31
  tzinfo (~> 0.3.23)
32
- activeresource (3.0.3)
33
- activemodel (= 3.0.3)
34
- activesupport (= 3.0.3)
35
- activesupport (3.0.3)
36
- arel (2.0.6)
32
+ activeresource (3.0.5)
33
+ activemodel (= 3.0.5)
34
+ activesupport (= 3.0.5)
35
+ activesupport (3.0.5)
36
+ archive-tar-minitar (0.5.2)
37
+ arel (2.0.9)
37
38
  builder (2.1.2)
39
+ columnize (0.3.2)
38
40
  diff-lcs (1.1.2)
39
41
  erubis (2.6.6)
40
42
  abstract (>= 1.0.0)
41
43
  fakeweb (1.3.0)
42
44
  i18n (0.5.0)
43
- mail (2.2.14)
45
+ linecache19 (0.5.11)
46
+ ruby_core_source (>= 0.1.4)
47
+ mail (2.2.15)
44
48
  activesupport (>= 2.3.6)
45
49
  i18n (>= 0.4.0)
46
50
  mime-types (~> 1.16)
47
51
  treetop (~> 1.4.8)
48
52
  mime-types (1.16)
49
- nokogiri (1.4.3.1)
53
+ nokogiri (1.4.4)
50
54
  polyglot (0.3.1)
51
55
  rack (1.2.1)
52
56
  rack-mount (0.6.13)
53
57
  rack (>= 1.0.0)
54
58
  rack-test (0.5.7)
55
59
  rack (>= 1.0)
56
- rails (3.0.3)
57
- actionmailer (= 3.0.3)
58
- actionpack (= 3.0.3)
59
- activerecord (= 3.0.3)
60
- activeresource (= 3.0.3)
61
- activesupport (= 3.0.3)
60
+ rails (3.0.5)
61
+ actionmailer (= 3.0.5)
62
+ actionpack (= 3.0.5)
63
+ activerecord (= 3.0.5)
64
+ activeresource (= 3.0.5)
65
+ activesupport (= 3.0.5)
62
66
  bundler (~> 1.0)
63
- railties (= 3.0.3)
64
- railties (3.0.3)
65
- actionpack (= 3.0.3)
66
- activesupport (= 3.0.3)
67
+ railties (= 3.0.5)
68
+ railties (3.0.5)
69
+ actionpack (= 3.0.5)
70
+ activesupport (= 3.0.5)
67
71
  rake (>= 0.8.7)
68
72
  thor (~> 0.14.4)
69
73
  rake (0.8.7)
@@ -80,11 +84,23 @@ GEM
80
84
  activesupport (~> 3.0)
81
85
  railties (~> 3.0)
82
86
  rspec (~> 2.4.0)
83
- sqlite3-ruby (1.3.1)
87
+ ruby-debug-base19 (0.11.24)
88
+ columnize (>= 0.3.1)
89
+ linecache19 (>= 0.5.11)
90
+ ruby_core_source (>= 0.1.4)
91
+ ruby-debug19 (0.11.6)
92
+ columnize (>= 0.3.1)
93
+ linecache19 (>= 0.5.11)
94
+ ruby-debug-base19 (>= 0.11.19)
95
+ ruby_core_source (0.1.4)
96
+ archive-tar-minitar (>= 0.5.2)
97
+ sqlite3 (1.3.3)
98
+ sqlite3-ruby (1.3.3)
99
+ sqlite3 (>= 1.3.3)
84
100
  thor (0.14.6)
85
101
  treetop (1.4.9)
86
102
  polyglot (>= 0.3.1)
87
- tzinfo (0.3.23)
103
+ tzinfo (0.3.24)
88
104
 
89
105
  PLATFORMS
90
106
  ruby
@@ -95,4 +111,5 @@ DEPENDENCIES
95
111
  pagseguro!
96
112
  rails (~> 3.0.3)
97
113
  rspec-rails (~> 2.4.1)
114
+ ruby-debug19
98
115
  sqlite3-ruby
@@ -1,6 +1,7 @@
1
1
  require "net/https"
2
2
  require "uri"
3
3
  require "time"
4
+ require "bigdecimal"
4
5
 
5
6
  require "pagseguro/base"
6
7
  require "pagseguro/faker"
@@ -66,7 +66,7 @@ module PagSeguro
66
66
 
67
67
  private
68
68
  def convert_unit(number, unit)
69
- number = (number * unit).to_i unless number.nil? || number.kind_of?(Integer)
69
+ number = (BigDecimal("#{number}") * unit).to_i unless number.nil? || number.kind_of?(Integer)
70
70
  number
71
71
  end
72
72
  end
@@ -19,7 +19,7 @@ module PagSeguro
19
19
  ::ActionController::Base.send(:include, PagSeguro::ActionController)
20
20
  end
21
21
 
22
- ::ActiveSupport.on_load(:action_controller) do
22
+ config.after_initialize do
23
23
  require "pagseguro/developer_controller" if PagSeguro.developer?
24
24
  end
25
25
  end
@@ -5,6 +5,11 @@ module PagSeguro
5
5
  def run
6
6
  require "digest/md5"
7
7
 
8
+ env = ENV.inject({}) do |buffer, (name, value)|
9
+ value = value.respond_to?(:force_encoding) ? value.dup.force_encoding("UTF-8") : value
10
+ buffer.merge(name => value)
11
+ end
12
+
8
13
  # Not running in developer mode? Exit!
9
14
  unless PagSeguro.developer?
10
15
  puts "=> [PagSeguro] Can only notify development URLs"
@@ -28,17 +33,17 @@ module PagSeguro
28
33
  end
29
34
 
30
35
  # Get the specified order
31
- order = orders[ENV["ID"]]
36
+ order = orders[env["ID"]]
32
37
 
33
38
  # Not again! No order! Exit!
34
39
  unless order
35
- puts "=> [PagSeguro] The order #{ENV['ID'].inspect} could not be found. Exiting now!"
40
+ puts "=> [PagSeguro] The order #{env['ID'].inspect} could not be found. Exiting now!"
36
41
  exit 1
37
42
  end
38
43
 
39
44
  # Set the client's info
40
- name = ENV["NAME"] || Faker.name
41
- email = ENV["EMAIL"] || Faker.email(name)
45
+ name = env.fetch("NAME", Faker.name)
46
+ email = env.fetch("EMAIL", Faker.email)
42
47
 
43
48
  order["CliNome"] = name
44
49
  order["CliEmail"] = email
@@ -80,16 +85,16 @@ module PagSeguro
80
85
  end
81
86
 
82
87
  # Retrieve the specified status or default to :completed
83
- status = (ENV["STATUS"] || :completed).to_sym
88
+ status = env.fetch("STATUS", :completed).to_sym
84
89
 
85
90
  # Retrieve the specified payment method or default to :credit_card
86
- payment_method = (ENV["PAYMENT_METHOD"] || :credit_card).to_sym
91
+ payment_method = env.fetch("PAYMENT_METHOD", :credit_card).to_sym
87
92
 
88
93
  # Set a random transaction id
89
94
  order["TransacaoID"] = Digest::MD5.hexdigest(Time.now.to_s)
90
95
 
91
96
  # Set note
92
- order["Anotacao"] = ENV["NOTE"].to_s
97
+ order["Anotacao"] = env["NOTE"].to_s
93
98
 
94
99
  # Retrieve index
95
100
  index = proc do |hash, value|
@@ -2,7 +2,7 @@ module PagSeguro
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 5
5
+ PATCH = 6
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency "rspec-rails", "~> 2.4.1"
23
23
  s.add_development_dependency "nokogiri"
24
24
  s.add_development_dependency "sqlite3-ruby"
25
+ s.add_development_dependency "ruby-debug19" if RUBY_VERSION >= "1.9"
25
26
  end
@@ -64,6 +64,13 @@ describe PagSeguro::Order do
64
64
  p[:shipping].should == 367
65
65
  end
66
66
 
67
+ specify "bug fix: should convert 1.15 correctly" do
68
+ @order << @product.merge(:price => 1.15)
69
+
70
+ p = @order.products.first
71
+ p[:price].should == 115
72
+ end
73
+
67
74
  it "should convert big decimal to cents" do
68
75
  @product.merge!(:price => BigDecimal.new("199.00"))
69
76
  @order << @product
@@ -2,7 +2,6 @@ ENV["RAILS_ENV"] = "test"
2
2
  require "rails"
3
3
  require "fakeweb"
4
4
  require "pagseguro"
5
- require "bigdecimal"
6
5
  require "support/config/boot"
7
6
  require "rspec/rails"
8
7
  require "nokogiri"
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagseguro
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 5
9
- version: 0.1.5
4
+ prerelease:
5
+ version: 0.1.6
10
6
  platform: ruby
11
7
  authors:
12
8
  - Nando Vieira
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-16 00:00:00 -02:00
13
+ date: 2011-02-28 00:00:00 -03:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ~>
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 0
31
- - 3
32
24
  version: 3.0.3
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -40,8 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
35
  version: "0"
46
36
  type: :development
47
37
  version_requirements: *id002
@@ -53,10 +43,6 @@ dependencies:
53
43
  requirements:
54
44
  - - ~>
55
45
  - !ruby/object:Gem::Version
56
- segments:
57
- - 2
58
- - 4
59
- - 1
60
46
  version: 2.4.1
61
47
  type: :development
62
48
  version_requirements: *id003
@@ -68,8 +54,6 @@ dependencies:
68
54
  requirements:
69
55
  - - ">="
70
56
  - !ruby/object:Gem::Version
71
- segments:
72
- - 0
73
57
  version: "0"
74
58
  type: :development
75
59
  version_requirements: *id004
@@ -81,11 +65,20 @@ dependencies:
81
65
  requirements:
82
66
  - - ">="
83
67
  - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
68
  version: "0"
87
69
  type: :development
88
70
  version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: ruby-debug19
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ type: :development
81
+ version_requirements: *id006
89
82
  description: The official PagSeguro library
90
83
  email:
91
84
  - fnando.vieira@gmail.com
@@ -156,21 +149,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
149
  requirements:
157
150
  - - ">="
158
151
  - !ruby/object:Gem::Version
159
- segments:
160
- - 0
161
152
  version: "0"
162
153
  required_rubygems_version: !ruby/object:Gem::Requirement
163
154
  none: false
164
155
  requirements:
165
156
  - - ">="
166
157
  - !ruby/object:Gem::Version
167
- segments:
168
- - 0
169
158
  version: "0"
170
159
  requirements: []
171
160
 
172
161
  rubyforge_project:
173
- rubygems_version: 1.3.7
162
+ rubygems_version: 1.5.2
174
163
  signing_key:
175
164
  specification_version: 3
176
165
  summary: The official PagSeguro library