veritrans 2.1.0 → 2.1.1

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: b793647405fbf0445648ea2ea9def74ed8396c0a
4
- data.tar.gz: d40b25e0abe559a4d2a2314d3b46ef8efefa97df
3
+ metadata.gz: 3772728efdb7722410aa5bc7d7c71363d7fd23c3
4
+ data.tar.gz: 8601a01d82d8078bd7ebbb95b4913d082712365f
5
5
  SHA512:
6
- metadata.gz: 17c8354877faa0b5e75df829c59fdd2a8e2c05a3256d07d710589338a157c8b03f64410e36b4f51b6eb2f5a25aa600b12ff5f7c33204f849852a9008ce4be846
7
- data.tar.gz: cf8a7fa7afcc7082c23cf8f6ac4db13f0a48dc92d9b5a15d86bcce36b23bac9903f3b33052e79161c9551027ca47876f2087068bfb032e0be1eea59f4fd47286
6
+ metadata.gz: d943b4cc62c01e9862d15fff9c368ad06029338eede2e33b022b011ad87918974e6b7192dde9cbe68665dc42210aefc30de77f5030d9863d1bebf5441ed940ee
7
+ data.tar.gz: a286cee861d1bf8534d4c4e09ace9db52ce4d5ead9c7fbe0d954fda6e523dc333e7f12448cd500f7620a9dd35a45aaa8b4ba24ec697f49d0dbbeaeaf9bd5b217
@@ -1,3 +1,7 @@
1
+ ### Version 2.1.1 (date 15 Sep 2016)
2
+
3
+ * Allow use ENV variables in config
4
+
1
5
  ### Version 2.1.0 (date 12 Aug 2016)
2
6
 
3
7
  * Add support for rails 5
data/Gemfile CHANGED
@@ -4,9 +4,8 @@ gem 'rake'
4
4
  gem 'rspec'
5
5
 
6
6
  gem 'rails', '< 6'
7
- # For example app
8
- gem 'sinatra', github: 'sinatra/sinatra'
9
- gem 'rack-protection', github: 'sinatra/rack-protection'
7
+
8
+ gem 'sinatra', git: 'https://github.com/sinatra/sinatra.git'
10
9
  gem 'puma'
11
10
  gem 'tilt'
12
11
 
@@ -1,24 +1,19 @@
1
1
  GIT
2
- remote: git://github.com/sinatra/rack-protection.git
3
- revision: 7e723a74763bb83989d1249cdceb9cceb2ee6f01
2
+ remote: https://github.com/sinatra/sinatra.git
3
+ revision: 1b0edc0aeaaf4839cadfcec1b21da86e6af1d4c0
4
4
  specs:
5
- rack-protection (2.0.0)
5
+ rack-protection (2.0.0.beta2)
6
6
  rack
7
-
8
- GIT
9
- remote: git://github.com/sinatra/sinatra.git
10
- revision: 285275b42fa1bf096a5c9559b6cead2f31b65b66
11
- specs:
12
- sinatra (2.0.0.pre.alpha)
13
- mustermann (~> 0.4)
7
+ sinatra (2.0.0.beta2)
8
+ mustermann (= 1.0.0.beta2)
14
9
  rack (~> 2.0)
15
- rack-protection (~> 2.0)
10
+ rack-protection (= 2.0.0.beta2)
16
11
  tilt (~> 2.0)
17
12
 
18
13
  PATH
19
14
  remote: .
20
15
  specs:
21
- veritrans (2.0.4)
16
+ veritrans (2.1.1)
22
17
  excon (~> 0.20)
23
18
 
24
19
  GEM
@@ -77,7 +72,7 @@ GEM
77
72
  safe_yaml (~> 1.0.0)
78
73
  diff-lcs (1.2.5)
79
74
  erubis (2.7.0)
80
- excon (0.51.0)
75
+ excon (0.52.0)
81
76
  globalid (0.3.7)
82
77
  activesupport (>= 4.1.0)
83
78
  hashdiff (0.3.0)
@@ -92,8 +87,7 @@ GEM
92
87
  mime-types-data (3.2016.0521)
93
88
  mini_portile2 (2.1.0)
94
89
  minitest (5.9.0)
95
- mustermann (0.4.0)
96
- tool (~> 0.2)
90
+ mustermann (1.0.0.beta2)
97
91
  nio4r (1.2.1)
98
92
  nokogiri (1.6.8)
99
93
  mini_portile2 (~> 2.1.0)
@@ -155,7 +149,6 @@ GEM
155
149
  thor (0.19.1)
156
150
  thread_safe (0.3.5)
157
151
  tilt (2.0.5)
158
- tool (0.2.3)
159
152
  tzinfo (1.2.2)
160
153
  thread_safe (~> 0.1)
161
154
  vcr (3.0.3)
@@ -175,7 +168,6 @@ PLATFORMS
175
168
  DEPENDENCIES
176
169
  poltergeist (~> 1.8)
177
170
  puma
178
- rack-protection!
179
171
  rails (< 6)
180
172
  rake
181
173
  rspec
@@ -186,4 +178,4 @@ DEPENDENCIES
186
178
  webmock (>= 1.20)
187
179
 
188
180
  BUNDLED WITH
189
- 1.12.5
181
+ 1.13.1
@@ -20,7 +20,7 @@
20
20
 
21
21
  <code>
22
22
  <pre>
23
- <%= @result.response.body %>
23
+ <%= JSON.pretty_generate(JSON.parse(@result.response.body)) %>
24
24
  </pre>
25
25
  </code>
26
26
 
@@ -12,7 +12,7 @@ rescue LoadError => error
12
12
  end
13
13
 
14
14
  Veritrans.setup do
15
- config.load_yml "./veritrans.yml#development"
15
+ config.load_yml File.dirname(__FILE__) + "/veritrans.yml#development"
16
16
 
17
17
  # config.server_key = "..."
18
18
  # config.client_key = "..."
@@ -23,8 +23,8 @@ end
23
23
  # Veritrans.config.client_key
24
24
  # Veritrans.config.api_host
25
25
 
26
- set :public_folder, "."
27
- set :views, "."
26
+ set :public_folder, File.dirname(__FILE__)
27
+ set :views, File.dirname(__FILE__)
28
28
 
29
29
  set :run, $0 == __FILE__
30
30
 
@@ -8,6 +8,11 @@ development:
8
8
  production:
9
9
  # Register and get your keys here:
10
10
  # https://my.veritrans.co.id/settings/config_info
11
- client_key: ""
12
- server_key: ""
11
+ client_key: <%= ENV['VERITRANS_CLIENT_KEY'] %>
12
+ server_key: <%= ENV['VERITRANS_SERVER_KEY'] %>
13
13
  api_host: https://api.veritrans.co.id
14
+
15
+ staging:
16
+ client_key: <%= ENV['VT_SANDBOX_CLIENT_KEY'] %>
17
+ server_key: <%= ENV['VT_SANDBOX_SERVER_KEY'] %>
18
+ api_host: https://api.sandbox.veritrans.co.id
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'excon'
3
+ require 'erb'
3
4
 
4
5
  class Veritrans
5
6
 
@@ -96,7 +97,7 @@ class Veritrans
96
97
  #
97
98
  def load_config(filename, yml_section = nil)
98
99
  yml_file, file_yml_section = filename.to_s.split('#')
99
- config_data = YAML.load(File.read(yml_file))
100
+ config_data = YAML.load(ERB.new(File.read(yml_file)).result)
100
101
 
101
102
  yml_section ||= file_yml_section
102
103
  if defined?(Rails) && !yml_section
@@ -1,3 +1,3 @@
1
1
  class Veritrans
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -0,0 +1,2 @@
1
+ client_key: <%= ENV['CLIENT_KEY'] %>
2
+ server_key: <%= ENV['SERVER_KEY'] %>
@@ -2,6 +2,7 @@ describe Veritrans::Config do
2
2
 
3
3
  before do
4
4
  hide_const("Rails")
5
+ hide_const("ENV")
5
6
  end
6
7
 
7
8
  it "should set Veritras as self inside config block" do
@@ -45,6 +46,16 @@ describe Veritrans::Config do
45
46
  data.should == {"client_key" => "test_client_key", "server_key" => "test_server_key"}
46
47
  end
47
48
 
49
+ it "should load config and render erb lines" do
50
+ stub_const('ENV', {
51
+ 'CLIENT_KEY' => 'test_client_key',
52
+ 'SERVER_KEY' => 'test_server_key'
53
+ })
54
+
55
+ data = Veritrans.config.load_config("./spec/configs/veritrans_with_erb.yml")
56
+ data.should == {"client_key" => "test_client_key", "server_key" => "test_server_key"}
57
+ end
58
+
48
59
  it "should validate http_params type" do
49
60
  expect {
50
61
  Veritrans.config.http_options = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veritrans
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veritrans Dev Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -154,6 +154,7 @@ files:
154
154
  - spec/configs/real_key.yml
155
155
  - spec/configs/veritrans.yml
156
156
  - spec/configs/veritrans_flat.yml
157
+ - spec/configs/veritrans_with_erb.yml
157
158
  - spec/fixtures/approve_failed.yml
158
159
  - spec/fixtures/cancel_failed.yml
159
160
  - spec/fixtures/cancel_success.yml
@@ -199,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
200
  version: '0'
200
201
  requirements: []
201
202
  rubyforge_project:
202
- rubygems_version: 2.4.5.1
203
+ rubygems_version: 2.6.6
203
204
  signing_key:
204
205
  specification_version: 4
205
206
  summary: Veritrans ruby library