pagseguro 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pagseguro.rb CHANGED
@@ -2,6 +2,7 @@ require "net/https"
2
2
  require "uri"
3
3
  require "time"
4
4
 
5
+ require "pagseguro/base"
5
6
  require "pagseguro/faker"
6
7
  require "pagseguro/rake"
7
8
  require "pagseguro/railtie"
@@ -9,59 +10,3 @@ require "pagseguro/notification"
9
10
  require "pagseguro/order"
10
11
  require "pagseguro/action_controller"
11
12
  require "pagseguro/helper"
12
-
13
- module PagSeguro
14
- extend self
15
-
16
- # PagSeguro receives all invoices in this URL. If developer mode is enabled,
17
- # then the URL will be /pagseguro_developer/invoice
18
- GATEWAY_URL = "https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx"
19
-
20
- # Hold the config/pagseguro.yml contents
21
- @@config = nil
22
-
23
- # The path to the configuration file
24
- def config_file
25
- Rails.root.join("config/pagseguro.yml")
26
- end
27
-
28
- # Check if configuration file exists.
29
- def config?
30
- File.exist?(config_file)
31
- end
32
-
33
- # Load configuration file.
34
- def config
35
- raise MissingConfigurationError, "file not found on #{config_file.inspect}" unless config?
36
-
37
- # load file if is not loaded yet
38
- @@config ||= YAML.load_file(config_file)
39
-
40
- # raise an exception if the environment hasn't been set
41
- # or if file is empty
42
- if @@config == false || !@@config[Rails.env]
43
- raise MissingEnvironmentError, ":#{Rails.env} environment not set on #{config_file.inspect}"
44
- end
45
-
46
- # retrieve the environment settings
47
- @@config[Rails.env]
48
- end
49
-
50
- # The gateway URL will point to a local URL is
51
- # app is running in developer mode
52
- def gateway_url
53
- if developer?
54
- "/pagseguro_developer"
55
- else
56
- GATEWAY_URL
57
- end
58
- end
59
-
60
- # Reader for the `developer` configuration
61
- def developer?
62
- config? && config["developer"] == true
63
- end
64
-
65
- class MissingEnvironmentError < StandardError; end
66
- class MissingConfigurationError < StandardError; end
67
- end
@@ -0,0 +1,55 @@
1
+ module PagSeguro
2
+ extend self
3
+
4
+ # PagSeguro receives all invoices in this URL. If developer mode is enabled,
5
+ # then the URL will be /pagseguro_developer/invoice
6
+ GATEWAY_URL = "https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx"
7
+
8
+ # Hold the config/pagseguro.yml contents
9
+ @@config = nil
10
+
11
+ # The path to the configuration file
12
+ def config_file
13
+ Rails.root.join("config/pagseguro.yml")
14
+ end
15
+
16
+ # Check if configuration file exists.
17
+ def config?
18
+ File.exist?(config_file)
19
+ end
20
+
21
+ # Load configuration file.
22
+ def config
23
+ raise MissingConfigurationError, "file not found on #{config_file.inspect}" unless config?
24
+
25
+ # load file if is not loaded yet
26
+ @@config ||= YAML.load_file(config_file)
27
+
28
+ # raise an exception if the environment hasn't been set
29
+ # or if file is empty
30
+ if @@config == false || !@@config[Rails.env]
31
+ raise MissingEnvironmentError, ":#{Rails.env} environment not set on #{config_file.inspect}"
32
+ end
33
+
34
+ # retrieve the environment settings
35
+ @@config[Rails.env]
36
+ end
37
+
38
+ # The gateway URL will point to a local URL is
39
+ # app is running in developer mode
40
+ def gateway_url
41
+ if developer?
42
+ "/pagseguro_developer"
43
+ else
44
+ GATEWAY_URL
45
+ end
46
+ end
47
+
48
+ # Reader for the `developer` configuration
49
+ def developer?
50
+ config? && config["developer"] == true
51
+ end
52
+
53
+ class MissingEnvironmentError < StandardError; end
54
+ class MissingConfigurationError < StandardError; end
55
+ end
@@ -130,6 +130,11 @@ module PagSeguro
130
130
  super
131
131
  end
132
132
 
133
+ def respond_to?(method, include_private = false)
134
+ return true if MAPPING[method]
135
+ super
136
+ end
137
+
133
138
  # A wrapper to the params hash,
134
139
  # sanitizing the return to symbols
135
140
  def mapping_for(name)
@@ -2,7 +2,7 @@ module PagSeguro
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 4
5
+ PATCH = 5
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-11 00:00:00 -02:00
17
+ date: 2011-01-16 00:00:00 -02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -105,6 +105,7 @@ files:
105
105
  - Rakefile
106
106
  - lib/pagseguro.rb
107
107
  - lib/pagseguro/action_controller.rb
108
+ - lib/pagseguro/base.rb
108
109
  - lib/pagseguro/developer_controller.rb
109
110
  - lib/pagseguro/faker.rb
110
111
  - lib/pagseguro/generator.rb