paymentrails 0.2.10 → 0.2.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/paymentrails/Client.rb +3 -1
- data/lib/paymentrails/Configuration.rb +2 -2
- data/lib/paymentrails/Recipient.rb +2 -0
- data/lib/paymentrails/gateways/GatewayHelper.rb +4 -1
- data/lib/paymentrails.rb +3 -1
- data/paymentrails.gemspec +5 -5
- data/spec/integration/RecipientTest.rb +3 -0
- data/spec/unit/ConfigurationTest.rb +2 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac4eac5c7989b196cf2471d066598e570023d2c8ead35c8f02cedf47fa62de14
|
4
|
+
data.tar.gz: 3b086070e1366c8a7c5a328b53e2170aa507887e2c74ecb00ed6b934707ba11b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5064610dc4c21ec8d86139fc2b2019d812e27a954bde1774856845d6a88bb2f153970f404f01f20c95c3ad3113bb2370832caf8cf466414ac57b12fd60117b30
|
7
|
+
data.tar.gz: c1347a03831334119a037239d4a6ba0a2230417c4b42ae0b9289135d07322b5f9e701abc6fa7c7c3735889e883888cdd1ba81986431eb1f035c7c7bcfac35ed8
|
data/LICENSE
CHANGED
data/lib/paymentrails/Client.rb
CHANGED
@@ -4,6 +4,7 @@ require 'net/http'
|
|
4
4
|
require 'openssl'
|
5
5
|
require 'uri'
|
6
6
|
require 'json'
|
7
|
+
require "rubygems"
|
7
8
|
|
8
9
|
module PaymentRails
|
9
10
|
class Client
|
@@ -42,7 +43,8 @@ module PaymentRails
|
|
42
43
|
time = Time.now.to_i
|
43
44
|
headers = {'X-PR-Timestamp': time.to_s,
|
44
45
|
'Authorization': generate_authorization(time, endPoint, method, body),
|
45
|
-
'Content-Type': 'application/json'
|
46
|
+
'Content-Type': 'application/json',
|
47
|
+
'Trolley-Source': "ruby-sdk_#{::PaymentRails::VERSION}"}
|
46
48
|
|
47
49
|
if method === "GET"
|
48
50
|
request = Net::HTTP::Get.new(uri.request_uri, headers)
|
@@ -19,13 +19,13 @@ module PaymentRails
|
|
19
19
|
def apiBase
|
20
20
|
case environment
|
21
21
|
when 'production'
|
22
|
-
'https://api.
|
22
|
+
'https://api.trolley.com'
|
23
23
|
when 'development'
|
24
24
|
'https://api.railz.io'
|
25
25
|
when 'integration'
|
26
26
|
'http://api.local.dev:3000'
|
27
27
|
else
|
28
|
-
'https://api.
|
28
|
+
'https://api.trolley.com'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -2,6 +2,7 @@ module PaymentRails
|
|
2
2
|
class Recipient
|
3
3
|
attr_accessor(
|
4
4
|
:id,
|
5
|
+
:routeMinimum,
|
5
6
|
:routeType,
|
6
7
|
:estimatedFees,
|
7
8
|
:referenceId,
|
@@ -15,6 +16,7 @@ module PaymentRails
|
|
15
16
|
:language,
|
16
17
|
:complianceStatus,
|
17
18
|
:dob,
|
19
|
+
:contactEmails,
|
18
20
|
:passport,
|
19
21
|
:updatedAt,
|
20
22
|
:createdAt,
|
@@ -1,15 +1,18 @@
|
|
1
1
|
module PaymentRails
|
2
2
|
module GatewayHelper
|
3
|
+
# rubocop:disable Lint/SuppressedException
|
3
4
|
def loosely_hydrate_model(klass_instance, attributes)
|
4
5
|
attributes.each do |k, v|
|
5
6
|
begin
|
6
7
|
klass_instance.send("#{k}=", v)
|
7
8
|
rescue NoMethodError
|
8
|
-
|
9
|
+
# TODO: The API is showing non-public attributes, once we remove them from the API response we can re-add this warning.
|
10
|
+
# warn "[PaymentRails] Unknown attribute #{k} for class #{klass_instance.class.name}"
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
14
|
klass_instance
|
13
15
|
end
|
16
|
+
# rubocop:enable Lint/SuppressedException
|
14
17
|
end
|
15
18
|
end
|
data/lib/paymentrails.rb
CHANGED
@@ -22,7 +22,9 @@ require 'paymentrails/Invoice'
|
|
22
22
|
require 'paymentrails/InvoicePayment'
|
23
23
|
|
24
24
|
module PaymentRails
|
25
|
+
VERSION = '0.2.14'.freeze
|
26
|
+
|
25
27
|
def self.client(key, secret, environment = 'production', **optionals)
|
26
|
-
Gateway.new(Configuration.new(key, secret, environment, optionals))
|
28
|
+
Gateway.new(Configuration.new(key, secret, environment, **optionals))
|
27
29
|
end
|
28
30
|
end
|
data/paymentrails.gemspec
CHANGED
@@ -2,11 +2,11 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "paymentrails"
|
5
|
-
s.summary = "
|
6
|
-
s.description = "Ruby SDK for interacting with the
|
7
|
-
s.version = '0.2.
|
8
|
-
s.homepage = 'https://
|
9
|
-
s.email = ['
|
5
|
+
s.summary = "Trolley Ruby SDK"
|
6
|
+
s.description = "[DEPRECATED] Ruby SDK for interacting with the Trolley API, now deprecated. New Gem: https://rubygems.org/gems/trolley"
|
7
|
+
s.version = '0.2.14.1'
|
8
|
+
s.homepage = 'https://trolley.com/'
|
9
|
+
s.email = ['developer-tools@trolley.com']
|
10
10
|
s.license = "MIT"
|
11
11
|
s.author = "PaymentRails"
|
12
12
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
@@ -49,6 +49,7 @@ class RecipientTest < Test::Unit::TestCase
|
|
49
49
|
assert_equal(recipient.status, 'archived')
|
50
50
|
end
|
51
51
|
|
52
|
+
# rubocop:disable Metrics/MethodLength
|
52
53
|
def test_account
|
53
54
|
uuid = SecureRandom.uuid.to_s
|
54
55
|
recipient = @client.recipient.create(
|
@@ -67,6 +68,7 @@ class RecipientTest < Test::Unit::TestCase
|
|
67
68
|
assert_equal(recipient.firstName, 'Tom')
|
68
69
|
assert_equal(recipient.lastName, 'Jones')
|
69
70
|
assert_not_nil(recipient.id)
|
71
|
+
assert_true(recipient.routeMinimum.to_i >= 0)
|
70
72
|
|
71
73
|
account = @client.recipient_account.create(recipient.id, type: 'bank-transfer', currency: 'EUR', country: 'DE', iban: 'DE89 3704 0044 0532 0130 00')
|
72
74
|
assert_not_nil(account)
|
@@ -87,4 +89,5 @@ class RecipientTest < Test::Unit::TestCase
|
|
87
89
|
accountList = @client.recipient_account.all(recipient.id)
|
88
90
|
assert_equal(1, accountList.count)
|
89
91
|
end
|
92
|
+
# rubocop:enable Metrics/MethodLength
|
90
93
|
end
|
@@ -22,9 +22,9 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
22
22
|
|
23
23
|
def test_api_base
|
24
24
|
assert_equal 'http://api.local.dev:3000', PaymentRails::Configuration.new('key', 'secret', 'integration').apiBase
|
25
|
-
assert_equal 'https://api.
|
25
|
+
assert_equal 'https://api.trolley.com', PaymentRails::Configuration.new('key', 'secret', 'production').apiBase
|
26
26
|
assert_equal 'https://api.railz.io', PaymentRails::Configuration.new('key', 'secret', 'development').apiBase
|
27
|
-
assert_equal 'https://api.
|
27
|
+
assert_equal 'https://api.trolley.com', PaymentRails::Configuration.new('key', 'secret', 'non_standard_environment').apiBase
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_use_ssl?
|
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.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PaymentRails
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -66,9 +66,10 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3'
|
69
|
-
description: Ruby SDK for interacting with the
|
69
|
+
description: "[DEPRECATED] Ruby SDK for interacting with the Trolley API, now deprecated.
|
70
|
+
New Gem: https://rubygems.org/gems/trolley"
|
70
71
|
email:
|
71
|
-
-
|
72
|
+
- developer-tools@trolley.com
|
72
73
|
executables: []
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
@@ -105,7 +106,7 @@ files:
|
|
105
106
|
- spec/integration/helper.rb
|
106
107
|
- spec/unit/ConfigurationTest.rb
|
107
108
|
- spec/unit/PaymentRailsTest.rb
|
108
|
-
homepage: https://
|
109
|
+
homepage: https://trolley.com/
|
109
110
|
licenses:
|
110
111
|
- MIT
|
111
112
|
metadata: {}
|
@@ -124,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
125
|
- !ruby/object:Gem::Version
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.2.3
|
128
129
|
signing_key:
|
129
130
|
specification_version: 4
|
130
|
-
summary:
|
131
|
+
summary: Trolley Ruby SDK
|
131
132
|
test_files: []
|