svbclient 2.0.3 → 3.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/svbclient.rb +43 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aef2cf061294df9f0a35dd9bb628fa162bd93a11
4
- data.tar.gz: fc83eb55c86efcfa64f4f64268c3cf86eb36230a
3
+ metadata.gz: e0d684e3db7b968c35197b58e146a4ec525d050b
4
+ data.tar.gz: b9528bb2530a7b80e6aeb0b17dffe50cff8abb3a
5
5
  SHA512:
6
- metadata.gz: d0e54a705060199c3b8550b7bfb3ed01091d2e8a7483f76de4bfd29c1b694fde698301a76fca8bed57d52c5f332f4c4877b2a2c04ac6961dec216aeda2002167
7
- data.tar.gz: 24bac0007bec8b679e6ce6e7d4c10308735db8cc39454b31be527a8c3c1ca7f995099fbfec3d15ab573c599f30cb0b889adc43e9fa13f82aee898787d2fa3d8c
6
+ metadata.gz: '036623794bbcfd5433ac1cd085ad4247c55c4279921d346e892e5a4dd271f9e5d81dd3021fcef316832ce8c159fe7b9a769269f9f85a210357c91766330a79fe'
7
+ data.tar.gz: 7b0a9e8987437f0a6824a01c82c93ca21b94ed5a5fa716b290414033e0c9ca2d9554d33baae2d2830357fcc8aa1b4f2769a5b850df71ef1527d474ba68d01989
data/lib/svbclient.rb CHANGED
@@ -85,6 +85,49 @@ class SVBClient
85
85
  end
86
86
  end
87
87
 
88
+ class SVBClient::ACH
89
+ def initialize(client, id)
90
+ @client = client
91
+ @id = id
92
+ end
93
+
94
+ def data
95
+ JSON.parse(@client.get("/v1/ach/#{@id}").body)["data"]
96
+ end
97
+
98
+ def update_status(status)
99
+ @client.patch("/v1/ach/#{id}", { status: status })
100
+ end
101
+ end
102
+
103
+ class SVBClient::ACHHandler
104
+ def initialize(client)
105
+ raise 'provide an API client' if client.nil?
106
+ @client = client
107
+ end
108
+
109
+ def create(ach_data)
110
+ response = @client.post('/v1/ach', ach_data)
111
+ SVBClient::ACH.new(@client, JSON.parse(response.body)["data"]["id"])
112
+ end
113
+
114
+ def get(id)
115
+ @client.get("/v1/ach/#{id}")
116
+ SVBClient::ACH.new(@client, id)
117
+ end
118
+
119
+ def find(status: nil, effective_date: nil)
120
+ query = ''
121
+ query += "filter%5Bstatus%5D=#{status}" unless status.nil?
122
+ query += "filter%5Beffective_date%5D=#{effective_date}" unless effective_date.nil?
123
+ response = @client.get("/v1/ach", query)
124
+ list = JSON.parse(response.body)["data"]
125
+ list.map do |ach|
126
+ SVBClient::ACH.new(@client, ach["id"])
127
+ end
128
+ end
129
+ end
130
+
88
131
  class SVBClient::Onboarding
89
132
  def initialize(client)
90
133
  raise 'provide an API client' if client.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svbclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Silicon Valley Bank