class SynapsePayRest::Institution
Represents an institution record and holds methods for getting institution instances from API calls. This is built on top of the SynapsePayRest::Institution
class and is intended to make it easier to use the API without knowing payload formats or knowledge of REST.
Attributes
bank_code[R]
bank_name[R]
client[R]
features[R]
forgotten_password[R]
is_active[R]
logo[R]
tx_history_months[R]
Public Class Methods
all(client:)
click to toggle source
# File lib/synapse_pay_rest/models/institution/institution.rb, line 29 def all(client:) raise ArgumentError, 'client must be a SynapsePayRest::Client' unless client.is_a?(Client) response = client.institutions.get() multiple_from_response(client, response['banks']) end
from_response(client, response)
click to toggle source
Creates an Institution
from a response hash.
@note Shouldn't need to call this directly.
# File lib/synapse_pay_rest/models/institution/institution.rb, line 15 def from_response(client, response) args = { client: client, bank_code: response['bank_code'], bank_name: response['bank_name'], features: response['features'], forgotten_password: response['forgotten_password'], is_active: response['is_active'], logo: response['logo'], tx_history_months: response['tx_history_months'] } self.new(args) end
multiple_from_response(client, response)
click to toggle source
Calls from_response
on each member of a response collection.
# File lib/synapse_pay_rest/models/institution/institution.rb, line 36 def multiple_from_response(client, response) return [] if response.empty? response.map { |institution_data| from_response(client.dup, institution_data)} end
new(**options)
click to toggle source
@note Do not call directly. Use other class method
to instantiate via API action.
# File lib/synapse_pay_rest/models/institution/institution.rb, line 45 def initialize(**options) options.each { |key, value| instance_variable_set("@#{key}", value) } end