paymentrails 0.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8ceb73c0e1a331ed962206a781d889d8a7686aa27b1274e570f19e3aa073242
4
- data.tar.gz: bb4dcbe84f95705a2bfee3a7307e9faad7b8c0e128709c6f861fa3938e188b13
3
+ metadata.gz: f10dfe6a1de6364a6f4cd84fcd70379e5e82fb8a9d3deee9fe8568f98f775386
4
+ data.tar.gz: 05bb3e71ac29f285430f7713fb126347b1f60159eb62272ff1504dc80251155c
5
5
  SHA512:
6
- metadata.gz: b160375ec38307bb976d7814f25ebe20bc436122de064574089b90e75aeb307e7e244c3dc987ffee3ef0118dcf481ab3039b67923bbff3672ad72b243a9e2c96
7
- data.tar.gz: a3a9f4d4ff206893c29c89e6962bc09f5b420562343823ac003b23e5fdd76d8367a8155f5d8d9092316ece200a18dea43c8d4f4ca5844798faa3f197cd362005
6
+ metadata.gz: 86e87a2dff1c9a22b00532315b6f9ab97206afb7703ae2f81d5433a5e1769e22fe03af3182575acdc34a1c2ef9128cf287ccb36a4d622d1a614bfd8513c02d10
7
+ data.tar.gz: e78456012f1203d16b952307b5a32ce4e6c516c015bce003f18d922afc8c4937a2073b28ad4765de8351ee5467b9b3fd1c0fdb54d4265a1d5c6b7161334fe353
@@ -1,4 +1,4 @@
1
1
  class Batch
2
- attr_accessor :id, :amount, :completedAt, :createdAt, :currency, :description, :sentAt, :status, :totalPayments, :updatedAt, :quoteExpiredAt, :payments
3
- attr_writer :id, :amount, :completedAt, :createdAt, :currency, :description, :sentAt, :status, :totalPayments, :updatedAt, :quoteExpiredAt, :payments
2
+ attr_accessor :id, :amount, :completedAt, :createdAt, :currency, :description, :sentAt, :status, :totalPayments, :updatedAt, :quoteExpiredAt, :payments, :tags, :coverFees
3
+ attr_writer :id, :amount, :completedAt, :createdAt, :currency, :description, :sentAt, :status, :totalPayments, :updatedAt, :quoteExpiredAt, :payments, :tags, :coverFees
4
4
  end
@@ -90,7 +90,7 @@ class Client
90
90
  when '500'
91
91
  raise ServerError, message
92
92
  when '503'
93
- raise DownForMaintenanceErroressage, message
93
+ raise DownForMaintenanceError, message
94
94
  else
95
95
  raise UnexpectedError, message
96
96
  end
@@ -1,16 +1,17 @@
1
1
  class Configuration
2
- def initialize(publicKey, privateKey, enviroment)
2
+
3
+ def initialize(publicKey, privateKey, environment = 'production')
3
4
  @publicKey = publicKey
4
5
  @privateKey = privateKey
5
- @apiBase = set_enviroment(enviroment)
6
+ @apiBase = set_environment(environment)
6
7
  end
7
8
 
8
- def set_enviroment(apiBase)
9
+ def set_environment(apiBase)
9
10
  case apiBase
10
11
  when 'production'
11
12
  'https://api.paymentrails.com'
12
13
  when 'development'
13
- 'http://api.railz.io'
14
+ 'https://api.railz.io'
14
15
  when 'integration'
15
16
  'http://api.local.dev:3000'
16
17
  else
@@ -1,4 +1,4 @@
1
1
  class Payment
2
- attr_reader :id, :status, :isSupplyPayment, :returnedAmount, :sourceAmount, :sourceCurrency, :targetAmount, :targetCurrency, :exchangeRate, :fees, :recipientFees, :fxRate, :memo, :externalId, :processedAt, :createdAt, :updatedAt, :merchantFees, :compliance, :payoutMethod, :recipient, :withholdingAmount, :withholdingCurrency, :equivalentWithholdingAmount, :equivalentWithholdingCurrency, :methodDisplay, :batch
3
- attr_writer :id, :status, :isSupplyPayment, :returnedAmount, :sourceAmount, :sourceCurrency, :targetAmount, :targetCurrency, :exchangeRate, :fees, :recipientFees, :fxRate, :memo, :externalId, :processedAt, :createdAt, :updatedAt, :merchantFees, :compliance, :payoutMethod, :recipient, :withholdingAmount, :withholdingCurrency, :equivalentWithholdingAmount, :equivalentWithholdingCurrency, :methodDisplay, :batch
2
+ attr_writer :id, :status, :isSupplyPayment, :returnedAmount, :sourceAmount, :sourceCurrency, :targetAmount, :targetCurrency, :exchangeRate, :fees, :recipientFees, :fxRate, :memo, :externalId, :processedAt, :createdAt, :updatedAt, :merchantFees, :compliance, :payoutMethod, :recipient, :withholdingAmount, :withholdingCurrency, :equivalentWithholdingAmount, :equivalentWithholdingCurrency, :methodDisplay, :batch, :coverFees, :category, :amount, :currency, :taxReportable, :taxBasisAmount, :taxBasisCurrency, :tags, :account, :initiatedAt, :settledAt, :returnedAt, :failureMessage, :merchantId
3
+ attr_reader :id, :status, :isSupplyPayment, :returnedAmount, :sourceAmount, :sourceCurrency, :targetAmount, :targetCurrency, :exchangeRate, :fees, :recipientFees, :fxRate, :memo, :externalId, :processedAt, :createdAt, :updatedAt, :merchantFees, :compliance, :payoutMethod, :recipient, :withholdingAmount, :withholdingCurrency, :equivalentWithholdingAmount, :equivalentWithholdingCurrency, :methodDisplay, :batch, :coverFees, :category, :amount, :currency, :taxReportable, :taxBasisAmount, :taxBasisCurrency, :tags, :account, :initiatedAt, :settledAt, :returnedAt, :failureMessage, :merchantId
4
4
  end
@@ -1,4 +1,4 @@
1
1
  class RecipientAccount
2
- attr_accessor :id, :primary, :currency, :recipientAccountId, :routeType, :recipientFees, :emailAddress, :country, :type, :iban, :accountNum, :accountHolderName, :swiftBic, :branchId, :bankId, :bankName, :bankAddress, :bankCity, :bankRegionCode, :bankPostalCode, :status, :disabledAt
3
- attr_writer :id, :primary, :currency, :recipientAccountId, :routeType, :recipientFees, :emailAddress, :country, :type, :iban, :accountNum, :accountHolderName, :swiftBic, :branchId, :bankId, :bankName, :bankAddress, :bankCity, :bankRegionCode, :bankPostalCode, :status, :disabledAt
2
+ attr_accessor :id, :primary, :currency, :recipientAccountId, :recipientId, :recipientReferenceId, :routeType, :recipientFees, :emailAddress, :country, :type, :iban, :accountNum, :accountHolderName, :swiftBic, :branchId, :bankId, :bankName, :bankAddress, :bankCity, :bankRegionCode, :bankPostalCode, :status, :disabledAt
3
+ attr_writer :id, :primary, :currency, :recipientAccountId, :recipientId, :recipientReferenceId, :routeType, :recipientFees, :emailAddress, :country, :type, :iban, :accountNum, :accountHolderName, :swiftBic, :branchId, :bankId, :bankName, :bankAddress, :bankCity, :bankRegionCode, :bankPostalCode, :status, :disabledAt
4
4
  end
@@ -1,2 +1,33 @@
1
- require_relative 'Gateway.rb'
2
- require_relative 'Configuration.rb'
1
+ class PaymentRails
2
+ attr_reader :recipient
3
+ attr_writer :recipient
4
+
5
+ attr_reader :recipient_account
6
+ attr_writer :recipient_account
7
+
8
+ attr_reader :batch
9
+ attr_writer :batch
10
+
11
+ attr_reader :payment
12
+ attr_writer :payment
13
+
14
+ attr_reader :balance
15
+ attr_writer :balance
16
+
17
+ def initialize(key, secret, environment = 'production')
18
+ load 'Configuration.rb'
19
+ load 'Gateway.rb'
20
+
21
+ client = Gateway.new(Configuration.new(key, secret, environment))
22
+ @recipient = client.recipient
23
+ @recipient_account = client.recipient_account
24
+ @batch = client.batch
25
+ @payment = client.payment
26
+ @balance = client.balance
27
+
28
+ # to avoid overriding potential global Configuration & Gateway
29
+ Object.send(:remove_const, :Gateway)
30
+ Object.send(:remove_const, :Configuration)
31
+ end
32
+
33
+ end
@@ -4,12 +4,12 @@ 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.1'
7
+ s.version = '0.1.2'
8
8
  s.homepage = 'https://www.paymentrails.com/'
9
- s.email = 'jesse.silber@paymentrails.com'
9
+ s.email = ['jesse.silber@paymentrails.com', 'joshua@paymentrails.com']
10
10
  s.license = "MIT"
11
11
  s.author = "PaymentRails"
12
12
  s.has_rdoc = false
13
13
  s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
14
- s.add_dependency "rest-client", "= 2.0.2"
15
- end
14
+ s.add_dependency "rest-client", ">= 2.0.0"
15
+ end
@@ -1,10 +1,10 @@
1
- Dir['../../lib/*'].each { |file| require_relative file }
1
+ Dir[File.join(__dir__, '../../lib', '*.rb')].each { |file| require file }
2
2
  require 'test/unit'
3
3
  require 'securerandom'
4
4
 
5
5
  class BatchTest < Test::Unit::TestCase
6
6
  def setup
7
- @client = Gateway.new(Configuration.new('YOUR-API-KEY', 'YOUR-API-SECRET', 'production'))
7
+ @client = Gateway.new(Configuration.new('YOUR-API-KEY', 'YOUR-API-SECRET'))
8
8
  end
9
9
 
10
10
  def create_recipient
@@ -25,11 +25,6 @@ class BatchTest < Test::Unit::TestCase
25
25
  recipient
26
26
  end
27
27
 
28
- def test_all
29
- batch = @client.batch.all
30
- assert_true(batch.count > 0)
31
- end
32
-
33
28
  def test_create
34
29
  batch = @client.batch.create(sourceCurrency: 'USD', description: 'Integration Test Create')
35
30
  assert_not_nil(batch)
@@ -1,10 +1,10 @@
1
- Dir['../../lib/*'].each { |file| require_relative file }
1
+ Dir[File.join(__dir__, '../../lib', '*.rb')].each { |file| require file }
2
2
  require 'test/unit'
3
3
  require 'securerandom'
4
4
 
5
5
  class RecipientTest < Test::Unit::TestCase
6
6
  def setup
7
- @client = Gateway.new(Configuration.new('YOUR-API-KEY', 'YOUR-API-SECRET', 'production'))
7
+ @client = Gateway.new(Configuration.new('YOUR-API-KEY', 'YOUR-API-SECRET'))
8
8
  end
9
9
 
10
10
  def test_create
metadata CHANGED
@@ -1,31 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paymentrails
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - PaymentRails
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-03 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.2
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.2
26
+ version: 2.0.0
27
27
  description: Ruby SDK for interacting with the PaymentRails API
28
- email: jesse.silber@paymentrails.com
28
+ email:
29
+ - jesse.silber@paymentrails.com
30
+ - joshua@paymentrails.com
29
31
  executables: []
30
32
  extensions: []
31
33
  extra_rdoc_files: []