Skip to content

Commit 050231d

Browse files
author
Aman Aalam
authored
Merge pull request #50 from PaymentRails/analytics-and-rebranding
feat: Analytics and rebranding
2 parents 974fa52 + a29fc55 commit 050231d

File tree

8 files changed

+30
-11
lines changed

8 files changed

+30
-11
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ inherit_from: .rubocop_todo.yml
22

33
# This basically enshrines existing intentional styles
44

5+
AllCops:
6+
TargetRubyVersion: 2.4
7+
58
Layout/EmptyLineAfterGuardClause:
69
Enabled: false
710

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2017 Payment Rails, Inc.
1+
Copyright (c) 2017 Trolley, Inc.
22

33
Permission is hereby granted, free of charge, to any person
44
obtaining a copy of this software and associated documentation

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Payment Rails[^1] Ruby Library
1+
# Trolley Ruby SDK (Previously Payment Rails[^1])
22

33
[![Latest Stable Version](https://poser.pugx.org/paymentrails/ruby-sdk/v/stable.png)](https://packagist.org/packages/paymentrails/ruby-sdk)
44

5-
The Payment Rails Ruby library provides integration access to the Payment Rails API.
5+
The Trolley Ruby SDK provides integration access to the Trolley API.
66

7-
[^1]: [Payment Rails is now Trolley](https://www.trolley.com/payment-rails-is-now-trolley-series-a), we'll be updating our SDKs to support the new domain during the second half of 2022.
7+
[^1]: [Payment Rails is now Trolley](https://www.trolley.com/payment-rails-is-now-trolley-series-a). We're in the process of updating our SDKs to support the new domain. In this transition phase, you might still see "PaymentRails" at some places.
88

99
## Requirements
1010

@@ -36,6 +36,17 @@ gem build paymentrails.gemspec
3636
gem install paymentrails-[version].gem
3737
```
3838

39+
### Running Tests
40+
41+
```
42+
// set keys as environment variables
43+
export SANDBOX_ACCESS_KEY="your_access_key"
44+
export SANDBOX_SECRET_KEY="your_secret_key"
45+
46+
// run a single test file, for example:
47+
bundle exec ruby spec/integration/RecipientTest.rb
48+
```
49+
3950
## Getting Started
4051

4152
```Ruby

lib/paymentrails/Client.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require 'openssl'
55
require 'uri'
66
require 'json'
7+
require "rubygems"
78

89
module PaymentRails
910
class Client
@@ -39,11 +40,14 @@ def send_request(endPoint, method, body = '')
3940
)
4041
http.use_ssl = @config.useSsl?
4142

43+
spec = Gem::Specification.load("paymentrails.gemspec")
44+
4245
time = Time.now.to_i
4346
headers = {'X-PR-Timestamp': time.to_s,
4447
'Authorization': generate_authorization(time, endPoint, method, body),
45-
'Content-Type': 'application/json'}
46-
48+
'Content-Type': 'application/json',
49+
'Trolley-Source': "ruby-sdk_#{spec.version}"}
50+
4751
if method === "GET"
4852
request = Net::HTTP::Get.new(uri.request_uri, headers)
4953
elsif method === "POST"

lib/paymentrails/Configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def initialize(publicKey, privateKey, environment = 'production', proxy_uri: nil
1919
def apiBase
2020
case environment
2121
when 'production'
22-
'https://api.paymentrails.com'
22+
'https://api.trolley.com'
2323
when 'development'
2424
'https://api.railz.io'
2525
when 'integration'
2626
'http://api.local.dev:3000'
2727
else
28-
'https://api.paymentrails.com'
28+
'https://api.trolley.com'
2929
end
3030
end
3131

paymentrails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
44
s.name = "paymentrails"
55
s.summary = "Trolley Ruby SDK"
66
s.description = "Ruby SDK for interacting with the Trolley API"
7-
s.version = '0.2.12'
7+
s.version = '0.2.13'
88
s.homepage = 'https://trolley.com/'
99
s.email = ['[email protected]']
1010
s.license = "MIT"

spec/integration/RecipientTest.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def test_account
6767
assert_equal(recipient.firstName, 'Tom')
6868
assert_equal(recipient.lastName, 'Jones')
6969
assert_not_nil(recipient.id)
70+
assert_true(recipient.routeMinimum.to_i >= 0)
7071

7172
account = @client.recipient_account.create(recipient.id, type: 'bank-transfer', currency: 'EUR', country: 'DE', iban: 'DE89 3704 0044 0532 0130 00')
7273
assert_not_nil(account)

spec/unit/ConfigurationTest.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def test_new_nonempty_string
2222

2323
def test_api_base
2424
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
25+
assert_equal 'https://api.trolley.com', PaymentRails::Configuration.new('key', 'secret', 'production').apiBase
2626
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
27+
assert_equal 'https://api.trolley.com', PaymentRails::Configuration.new('key', 'secret', 'non_standard_environment').apiBase
2828
end
2929

3030
def test_use_ssl?

0 commit comments

Comments
 (0)