paymentrails 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paymentrails/Configuration.rb +1 -5
- data/paymentrails.gemspec +3 -1
- data/spec/unit/ConfigurationTest.rb +36 -0
- data/spec/unit/PaymentRailsTest.rb +8 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c53c6a60f6f1f794c3e9b9c00622e3784775ec4f248a533da5fa1eed7a90d6eb
|
4
|
+
data.tar.gz: 5c862b9b691ec0307978832b94b2be2d9b0ce404a1c1dc3955bacb7fc8b7c6fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '098a1fdc46f93f41d788bd1f9786c104ad352c39d541bea990021462a888fb32eb24519dcdb5f6f5939a18ac285789c26412c47e3bdcbf66c187ed88970e3849'
|
7
|
+
data.tar.gz: 7ea00ca85505bcfc89f6d75cc8408362a31ef845275c0b6231119bc10ccc2b4e302592e4399ffe5974ff84dcd240a6dc892f762e00f2e88f3e886458fd538555
|
@@ -2,11 +2,7 @@ module PaymentRails
|
|
2
2
|
class Configuration
|
3
3
|
|
4
4
|
def initialize(publicKey, privateKey, environment = 'production')
|
5
|
-
|
6
|
-
# raise ArgumentError, 'Both key/secret must be a nonempty string'
|
7
|
-
# end
|
8
|
-
|
9
|
-
raise ArgumentError, 'Both key/secret must be a nonempty string' if publicKey&.empty? || privateKey&.empty?
|
5
|
+
raise ArgumentError, 'Both key/secret must be a nonempty string' if publicKey.to_s&.empty? || privateKey.to_s&.empty?
|
10
6
|
|
11
7
|
@publicKey = publicKey
|
12
8
|
@privateKey = privateKey
|
data/paymentrails.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = "paymentrails"
|
5
5
|
s.summary = "PaymentRails Ruby SDK"
|
6
6
|
s.description = "Ruby SDK for interacting with the PaymentRails API"
|
7
|
-
s.version = '0.2.
|
7
|
+
s.version = '0.2.3'
|
8
8
|
s.homepage = 'https://www.paymentrails.com/'
|
9
9
|
s.email = ['joshua@paymentrails.com']
|
10
10
|
s.license = "MIT"
|
@@ -12,5 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
13
13
|
s.required_ruby_version = '>= 2.4'
|
14
14
|
s.add_dependency "rest-client", ">= 2.0.0"
|
15
|
+
s.add_development_dependency 'rake', '~> 12'
|
15
16
|
s.add_development_dependency "rubocop", '~> 0.77'
|
17
|
+
s.add_development_dependency 'test-unit', '~> 3'
|
16
18
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative '../../lib/paymentrails'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class ConfigurationTest < Test::Unit::TestCase
|
5
|
+
def test_new_nil
|
6
|
+
assert_raise ArgumentError.new('Both key/secret must be a nonempty string') do
|
7
|
+
PaymentRails::Configuration.new(nil, nil)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_new_empty_string
|
12
|
+
assert_raise ArgumentError.new('Both key/secret must be a nonempty string') do
|
13
|
+
PaymentRails::Configuration.new('', '')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_new_nonempty_string
|
18
|
+
assert_nothing_raised do
|
19
|
+
PaymentRails::Configuration.new('key', 'secret')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_api_base
|
24
|
+
assert_equal 'http://api.local.dev:3000', PaymentRails::Configuration.new('key', 'secret', 'integration').apiBase
|
25
|
+
assert_equal 'https://api.paymentrails.com', PaymentRails::Configuration.new('key', 'secret', 'production').apiBase
|
26
|
+
assert_equal 'https://api.railz.io', PaymentRails::Configuration.new('key', 'secret', 'development').apiBase
|
27
|
+
assert_equal 'https://api.paymentrails.com', PaymentRails::Configuration.new('key', 'secret', 'non_standard_environment').apiBase
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_use_ssl?
|
31
|
+
assert_equal false, PaymentRails::Configuration.new('key', 'secret', 'integration').useSsl?
|
32
|
+
assert_equal true, PaymentRails::Configuration.new('key', 'secret', 'production').useSsl?
|
33
|
+
assert_equal true, PaymentRails::Configuration.new('key', 'secret', 'development').useSsl?
|
34
|
+
assert_equal true, PaymentRails::Configuration.new('key', 'secret', 'non_standard_environment').useSsl?
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paymentrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PaymentRails
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubocop
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0.77'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3'
|
41
69
|
description: Ruby SDK for interacting with the PaymentRails API
|
42
70
|
email:
|
43
71
|
- joshua@paymentrails.com
|
@@ -67,6 +95,8 @@ files:
|
|
67
95
|
- paymentrails.gemspec
|
68
96
|
- spec/integration/BatchTest.rb
|
69
97
|
- spec/integration/RecipientTest.rb
|
98
|
+
- spec/unit/ConfigurationTest.rb
|
99
|
+
- spec/unit/PaymentRailsTest.rb
|
70
100
|
homepage: https://www.paymentrails.com/
|
71
101
|
licenses:
|
72
102
|
- MIT
|