veritrans 2.1.0 → 2.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -3
- data/Gemfile.lock +10 -18
- data/example/response.erb +1 -1
- data/example/sinatra.rb +3 -3
- data/lib/generators/templates/veritrans.yml +7 -2
- data/lib/veritrans/config.rb +2 -1
- data/lib/veritrans/version.rb +1 -1
- data/spec/configs/veritrans_with_erb.yml +2 -0
- data/spec/veritrans_config_spec.rb +11 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3772728efdb7722410aa5bc7d7c71363d7fd23c3
|
|
4
|
+
data.tar.gz: 8601a01d82d8078bd7ebbb95b4913d082712365f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d943b4cc62c01e9862d15fff9c368ad06029338eede2e33b022b011ad87918974e6b7192dde9cbe68665dc42210aefc30de77f5030d9863d1bebf5441ed940ee
|
|
7
|
+
data.tar.gz: a286cee861d1bf8534d4c4e09ace9db52ce4d5ead9c7fbe0d954fda6e523dc333e7f12448cd500f7620a9dd35a45aaa8b4ba24ec697f49d0dbbeaeaf9bd5b217
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -4,9 +4,8 @@ gem 'rake'
|
|
|
4
4
|
gem 'rspec'
|
|
5
5
|
|
|
6
6
|
gem 'rails', '< 6'
|
|
7
|
-
|
|
8
|
-
gem '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
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
GIT
|
|
2
|
-
remote:
|
|
3
|
-
revision:
|
|
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
|
-
|
|
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 (
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
181
|
+
1.13.1
|
data/example/response.erb
CHANGED
data/example/sinatra.rb
CHANGED
|
@@ -12,7 +12,7 @@ rescue LoadError => error
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
Veritrans.setup do
|
|
15
|
-
config.load_yml "
|
|
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
|
data/lib/veritrans/config.rb
CHANGED
|
@@ -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
|
data/lib/veritrans/version.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
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.
|
|
203
|
+
rubygems_version: 2.6.6
|
|
203
204
|
signing_key:
|
|
204
205
|
specification_version: 4
|
|
205
206
|
summary: Veritrans ruby library
|