synapse_pay_rest 3.2.5 → 3.2.6
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 +4 -4
- data/.gitignore +1 -0
- data/lib/synapse_pay_rest.rb +8 -0
- data/lib/synapse_pay_rest/api/institutions.rb +33 -0
- data/lib/synapse_pay_rest/client.rb +2 -1
- data/lib/synapse_pay_rest/models/institution/institution.rb +44 -0
- data/lib/synapse_pay_rest/models/node/node.rb +1 -0
- data/lib/synapse_pay_rest/models/node/subaccount_us_node.rb +15 -0
- data/lib/synapse_pay_rest/models/user/user.rb +13 -0
- data/lib/synapse_pay_rest/version.rb +1 -1
- data/synapse_pay_rest.gemspec +2 -2
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c72de6543bbbb47edefe1df209eaf2091f73c44
|
4
|
+
data.tar.gz: b460b9fdce9f6585cfeb0168beeea3d7d6266b6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0780e99faa813c86be03e05b2ee7082de33bf6a56b6a9a03c60ba7ff3f3d7f981a002476bdb4556424885a76b946c3d9f0aa4a1e9d4fe8ed78942a67295bb465'
|
7
|
+
data.tar.gz: 46bd306c307582b55688cc7419382b0ef0659a3ef1a4230ee938518a83cd044ac8760f767caaf66dace5dbd0e5c3e596db6bbb0dd06f00bba30f7cfe3bef2b67
|
data/.gitignore
CHANGED
data/lib/synapse_pay_rest.rb
CHANGED
@@ -7,6 +7,7 @@ require 'synapse_pay_rest/api/users'
|
|
7
7
|
require 'synapse_pay_rest/api/nodes'
|
8
8
|
require 'synapse_pay_rest/api/transactions'
|
9
9
|
require 'synapse_pay_rest/api/subscriptions'
|
10
|
+
require 'synapse_pay_rest/api/institutions'
|
10
11
|
|
11
12
|
# general library classes
|
12
13
|
require 'synapse_pay_rest/error'
|
@@ -31,6 +32,8 @@ require 'synapse_pay_rest/models/node/base_node'
|
|
31
32
|
require 'synapse_pay_rest/models/node/synapse_us_node.rb'
|
32
33
|
require 'synapse_pay_rest/models/node/synapse_ind_node.rb'
|
33
34
|
require 'synapse_pay_rest/models/node/synapse_np_node.rb'
|
35
|
+
require 'synapse_pay_rest/models/node/subaccount_us_node.rb'
|
36
|
+
|
34
37
|
# ach
|
35
38
|
require 'synapse_pay_rest/models/node/ach_us_node.rb'
|
36
39
|
require 'synapse_pay_rest/models/node/unverified_node.rb'
|
@@ -44,6 +47,8 @@ require 'synapse_pay_rest/models/node/wire_int_node.rb'
|
|
44
47
|
require 'synapse_pay_rest/models/node/reserve_us_node.rb'
|
45
48
|
# triump subaccount
|
46
49
|
require 'synapse_pay_rest/models/node/triumph_subaccount_us_node.rb'
|
50
|
+
require 'synapse_pay_rest/models/node/subaccount_us_node.rb'
|
51
|
+
|
47
52
|
# iou
|
48
53
|
require 'synapse_pay_rest/models/node/iou_node.rb'
|
49
54
|
|
@@ -56,6 +61,9 @@ require 'synapse_pay_rest/models/transaction/transaction'
|
|
56
61
|
# subscription-related classes
|
57
62
|
require 'synapse_pay_rest/models/subscription/subscription'
|
58
63
|
|
64
|
+
# institution-related classes
|
65
|
+
require 'synapse_pay_rest/models/institution/institution'
|
66
|
+
|
59
67
|
# Namespace for all SynapsePayRest classes and modules
|
60
68
|
module SynapsePayRest
|
61
69
|
# Modifies the default method to print a warning when deprecated constants
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module SynapsePayRest
|
2
|
+
# Wrapper class for /institutions endpoints
|
3
|
+
#
|
4
|
+
#
|
5
|
+
class Institutions
|
6
|
+
|
7
|
+
# @!attribute [rw] client
|
8
|
+
# @return [SynapsePayRest::HTTPClient]
|
9
|
+
attr_accessor :client
|
10
|
+
|
11
|
+
# @param client [SynapsePayRest::HTTPClient]
|
12
|
+
def initialize(client)
|
13
|
+
@client = client
|
14
|
+
end
|
15
|
+
|
16
|
+
# Sends a GET request to /v3.1/institutions endpoint. Queries a specific subscription_id
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# @raise [SynapsePayRest::Error] may return subclasses of error based on
|
20
|
+
# HTTP response from API
|
21
|
+
#
|
22
|
+
# @return [Hash] API response
|
23
|
+
#
|
24
|
+
# @todo Probably should use CGI or RestClient's param builder instead of
|
25
|
+
# rolling our own, probably error-prone and untested version
|
26
|
+
# https://github.com/rest-client/rest-client#usage-raw-url
|
27
|
+
def get()
|
28
|
+
path = '/institutions'
|
29
|
+
client.get(path)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -13,7 +13,7 @@ module SynapsePayRest
|
|
13
13
|
# @return [SynapsePayRest::Transactions]
|
14
14
|
# @!attribute [rw] subscriptions
|
15
15
|
# @return [SynapsePayRest::Subscriptions]
|
16
|
-
attr_accessor :http_client, :users, :nodes, :transactions, :subscriptions
|
16
|
+
attr_accessor :http_client, :users, :nodes, :transactions, :subscriptions, :institutions
|
17
17
|
|
18
18
|
# Alias for #transactions (legacy name)
|
19
19
|
alias_method :trans, :transactions
|
@@ -45,6 +45,7 @@ module SynapsePayRest
|
|
45
45
|
@nodes = Nodes.new @http_client
|
46
46
|
@transactions = Transactions.new @http_client
|
47
47
|
@subscriptions = Subscriptions.new @http_client
|
48
|
+
@institutions = Institutions.new @http_client
|
48
49
|
end
|
49
50
|
end
|
50
51
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module SynapsePayRest
|
2
|
+
# Represents an institution record and holds methods for getting institution instances
|
3
|
+
# from API calls. This is built on top of the SynapsePayRest::Institution class and
|
4
|
+
# is intended to make it easier to use the API without knowing payload formats
|
5
|
+
# or knowledge of REST.
|
6
|
+
#
|
7
|
+
# @todo use mixins to remove duplication between Node and BaseNode.
|
8
|
+
class Institution
|
9
|
+
attr_reader :id, :is_active, :scope, :url
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def all(client:)
|
13
|
+
raise ArgumentError, 'client must be a SynapsePayRest::Client' unless client.is_a?(Client)
|
14
|
+
response = client.institutions.get()
|
15
|
+
multiple_from_response(response['banks'])
|
16
|
+
end
|
17
|
+
|
18
|
+
# Creates an Institution from a response hash.
|
19
|
+
#
|
20
|
+
# @note Shouldn't need to call this directly.
|
21
|
+
def from_response(response)
|
22
|
+
args = {
|
23
|
+
bank_code: response['bank_code'],
|
24
|
+
bank_name: response['bank_name'],
|
25
|
+
features: response['features'],
|
26
|
+
forgotten_password: response['forgotten_password'],
|
27
|
+
is_active: response['is_active'],
|
28
|
+
logo: response['logo'],
|
29
|
+
tx_history_months: response['tx_history_months']
|
30
|
+
}
|
31
|
+
self.new(args)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Calls from_response on each member of a response collection.
|
35
|
+
def multiple_from_response(response)
|
36
|
+
return [] if response.empty?
|
37
|
+
response.map { |institution_data| from_response(institution_data)}
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SynapsePayRest
|
2
|
+
class SubaccountUsNode < BaseNode
|
3
|
+
class << self
|
4
|
+
private
|
5
|
+
|
6
|
+
def payload_for_create(nickname:, **options)
|
7
|
+
args = {
|
8
|
+
type: 'SUBACCOUNT-US',
|
9
|
+
nickname: nickname
|
10
|
+
}.merge(options)
|
11
|
+
super(args)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -581,6 +581,19 @@ module SynapsePayRest
|
|
581
581
|
SynapseUsNode.create(user: self, **options)
|
582
582
|
end
|
583
583
|
|
584
|
+
# Creates a SUBACCOUNT-US node.
|
585
|
+
#
|
586
|
+
# @param nickname [String] nickname for the node
|
587
|
+
# @param supp_id [String] (optional)
|
588
|
+
# @param gateway_restricted [Boolean] (optional)
|
589
|
+
#
|
590
|
+
# @raise [SynapsePayRest::Error]
|
591
|
+
#
|
592
|
+
# @return [SynapsePayRest::SubaccountUsNode]
|
593
|
+
def create_subaccount_us_node(**options)
|
594
|
+
SubaccountUsNode.create(user: self, **options)
|
595
|
+
end
|
596
|
+
|
584
597
|
# Creates a TRIUMPH-SUBACCOUNT-US node.
|
585
598
|
#
|
586
599
|
# @param nickname [String] nickname for the node
|
data/synapse_pay_rest.gemspec
CHANGED
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.name = 'synapse_pay_rest'
|
8
8
|
s.version = SynapsePayRest::VERSION
|
9
9
|
s.date = Date.today.to_s
|
10
|
-
s.authors = ['Steven Broderick', '
|
10
|
+
s.authors = ['Steven Broderick', 'Thomas Hipps']
|
11
11
|
s.email = 'help@synapsepay.com'
|
12
|
-
s.summary = '
|
12
|
+
s.summary = 'SynapsePay v3 Rest Native API Library'
|
13
13
|
s.homepage = 'https://rubygems.org/gems/synapse_pay_rest'
|
14
14
|
s.license = 'MIT'
|
15
15
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synapse_pay_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Broderick
|
8
|
-
-
|
8
|
+
- Thomas Hipps
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- Rakefile
|
152
152
|
- bin/console
|
153
153
|
- lib/synapse_pay_rest.rb
|
154
|
+
- lib/synapse_pay_rest/api/institutions.rb
|
154
155
|
- lib/synapse_pay_rest/api/nodes.rb
|
155
156
|
- lib/synapse_pay_rest/api/subscriptions.rb
|
156
157
|
- lib/synapse_pay_rest/api/transactions.rb
|
@@ -158,6 +159,7 @@ files:
|
|
158
159
|
- lib/synapse_pay_rest/client.rb
|
159
160
|
- lib/synapse_pay_rest/error.rb
|
160
161
|
- lib/synapse_pay_rest/http_client.rb
|
162
|
+
- lib/synapse_pay_rest/models/institution/institution.rb
|
161
163
|
- lib/synapse_pay_rest/models/node/ach_us_node.rb
|
162
164
|
- lib/synapse_pay_rest/models/node/base_node.rb
|
163
165
|
- lib/synapse_pay_rest/models/node/eft_ind_node.rb
|
@@ -165,6 +167,7 @@ files:
|
|
165
167
|
- lib/synapse_pay_rest/models/node/iou_node.rb
|
166
168
|
- lib/synapse_pay_rest/models/node/node.rb
|
167
169
|
- lib/synapse_pay_rest/models/node/reserve_us_node.rb
|
170
|
+
- lib/synapse_pay_rest/models/node/subaccount_us_node.rb
|
168
171
|
- lib/synapse_pay_rest/models/node/synapse_ind_node.rb
|
169
172
|
- lib/synapse_pay_rest/models/node/synapse_np_node.rb
|
170
173
|
- lib/synapse_pay_rest/models/node/synapse_us_node.rb
|
@@ -207,5 +210,5 @@ rubyforge_project:
|
|
207
210
|
rubygems_version: 2.6.11
|
208
211
|
signing_key:
|
209
212
|
specification_version: 4
|
210
|
-
summary:
|
213
|
+
summary: SynapsePay v3 Rest Native API Library
|
211
214
|
test_files: []
|