paypal_adaptive 0.2.1 → 0.2.2

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.
@@ -35,6 +35,9 @@ Create paypal_adaptive.yml to your config folder:
35
35
  application_id: "my_production_app_id"
36
36
  ssl_cert_file:
37
37
 
38
+ You can also use ENV variables when specifying your configuration. eg.
39
+ ```<%= ENV[''paypal.username'] %>```
40
+
38
41
  Make the payment request:
39
42
 
40
43
  pay_request = PaypalAdaptive::Request.new
@@ -89,6 +92,12 @@ If you don't set ssl_cert_file then paypal_adaptive will check for certificates
89
92
  this location exists, otherwise falling back to the cacert.pem file included with paypal_adaptive.
90
93
 
91
94
  ## Changelog
95
+ 0.2.2
96
+ Added support for ERB in the config file. Thanks DanielVartanov.
97
+
98
+ 0.2.1
99
+ Fixed SSL bug. Thanks gaelian.
100
+
92
101
  0.2.0
93
102
  Thanks to seangaffney for set payment option support.
94
103
  Thanks to gaelian for ssl cert support.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -21,3 +21,11 @@ production:
21
21
  signature: "my_production_signature"
22
22
  application_id: "my_production_app_id"
23
23
  ssl_cert_file:
24
+
25
+ with_erb_tags:
26
+ environment: "sandbox"
27
+ username: <%= ENV['paypal.username'] %>
28
+ password: <%= ENV['paypal.password'] %>
29
+ signature: "signupforuseratsandboxpaypal"
30
+ application_id: "APP-TEST"
31
+ ssl_cert_file:
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'erb'
2
3
 
3
4
  module PaypalAdaptive
4
5
  class Config
@@ -27,8 +28,8 @@ module PaypalAdaptive
27
28
  end
28
29
  end
29
30
 
30
- def load(rails_env, config_override)
31
- config = YAML.load_file(@config_filepath)[rails_env]
31
+ def load(environment, config_override)
32
+ config = YAML.load(ERB.new(File.new(@config_filepath).read).result)[environment]
32
33
  config.merge!(config_override) unless config_override.nil?
33
34
 
34
35
  if config["retain_requests_for_test"] == true
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{paypal_adaptive}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tommy Chheng"]
12
- s.date = %q{2011-05-21}
12
+ s.date = %q{2011-07-22}
13
13
  s.description = %q{Lightweight wrapper for Paypal's Adaptive Payments API.}
14
14
  s.email = %q{tommy.chheng@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -12,4 +12,13 @@ class ConfigTest < Test::Unit::TestCase
12
12
  assert File.exists?(@config.ssl_cert_file)
13
13
  assert_equal nil, @config.ssl_cert_path
14
14
  end
15
+
16
+ def test_erb_tags
17
+ ENV['paypal.username'] = 'account@email.com'
18
+ ENV['paypal.password'] = 's3krit'
19
+
20
+ config = PaypalAdaptive::Config.new("with_erb_tags")
21
+ assert_equal 'account@email.com', config.headers["X-PAYPAL-SECURITY-USERID"]
22
+ assert_equal 's3krit', config.headers["X-PAYPAL-SECURITY-PASSWORD"]
23
+ end
15
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal_adaptive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-21 00:00:00.000000000 -07:00
12
+ date: 2011-07-22 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
17
- requirement: &2153461880 !ruby/object:Gem::Requirement
17
+ requirement: &2153062760 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2153461880
25
+ version_requirements: *2153062760
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jsonschema
28
- requirement: &2153461300 !ruby/object:Gem::Requirement
28
+ requirement: &2153062160 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2153461300
36
+ version_requirements: *2153062160
37
37
  description: Lightweight wrapper for Paypal's Adaptive Payments API.
38
38
  email: tommy.chheng@gmail.com
39
39
  executables: []