Class: SynapsePayRest::Atm
- Inherits:
-
Object
- Object
- SynapsePayRest::Atm
- Defined in:
- lib/synapse_pay_rest/models/atm/atm.rb
Overview
Represents a public key record and holds methods for getting public key instances from API calls. This is built on top of the SynapsePayRest::Client class and is intended to make it easier to use the API without knowing payload formats or knowledge of REST.
Instance Attribute Summary collapse
-
#address_city ⇒ Object
readonly
Returns the value of attribute address_city.
-
#address_country ⇒ Object
readonly
Returns the value of attribute address_country.
-
#address_postal_code ⇒ Object
readonly
Returns the value of attribute address_postal_code.
-
#address_state ⇒ Object
readonly
Returns the value of attribute address_state.
-
#address_street ⇒ Object
readonly
Returns the value of attribute address_street.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#isAvailable24Hours ⇒ Object
readonly
Returns the value of attribute isAvailable24Hours.
-
#isDepositAvailable ⇒ Object
readonly
Returns the value of attribute isDepositAvailable.
-
#isHandicappedAccessible ⇒ Object
readonly
Returns the value of attribute isHandicappedAccessible.
-
#isOffPremise ⇒ Object
readonly
Returns the value of attribute isOffPremise.
-
#isSeasonal ⇒ Object
readonly
Returns the value of attribute isSeasonal.
-
#languageType ⇒ Object
readonly
Returns the value of attribute languageType.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#locationDescription ⇒ Object
readonly
Returns the value of attribute locationDescription.
-
#logoName ⇒ Object
readonly
Returns the value of attribute logoName.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.from_response(client, response) ⇒ Object
Creates a client public key from a response hash.
-
.locate(client:, zip: nil, page: nil, per_page: nil, radius: nil, lat: nil, lon: nil) ⇒ SynapsePayRest::Atm
Locate ATMs near zip code.
-
.multiple_from_response(client, response) ⇒ Object
Calls from_response on each member of a response collection.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Atm
constructor
A new instance of Atm.
Constructor Details
#initialize(**options) ⇒ Atm
Do not call directly. Use other class method to instantiate via API action.
Returns a new instance of Atm.
75 76 77 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 75 def initialize(**) .each { |key, value| instance_variable_set("@#{key}", value) } end |
Instance Attribute Details
#address_city ⇒ Object (readonly)
Returns the value of attribute address_city.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def address_city @address_city end |
#address_country ⇒ Object (readonly)
Returns the value of attribute address_country.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def address_country @address_country end |
#address_postal_code ⇒ Object (readonly)
Returns the value of attribute address_postal_code.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def address_postal_code @address_postal_code end |
#address_state ⇒ Object (readonly)
Returns the value of attribute address_state.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def address_state @address_state end |
#address_street ⇒ Object (readonly)
Returns the value of attribute address_street.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def address_street @address_street end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def client @client end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def distance @distance end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def id @id end |
#isAvailable24Hours ⇒ Object (readonly)
Returns the value of attribute isAvailable24Hours.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def isAvailable24Hours @isAvailable24Hours end |
#isDepositAvailable ⇒ Object (readonly)
Returns the value of attribute isDepositAvailable.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def isDepositAvailable @isDepositAvailable end |
#isHandicappedAccessible ⇒ Object (readonly)
Returns the value of attribute isHandicappedAccessible.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def isHandicappedAccessible @isHandicappedAccessible end |
#isOffPremise ⇒ Object (readonly)
Returns the value of attribute isOffPremise.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def isOffPremise @isOffPremise end |
#isSeasonal ⇒ Object (readonly)
Returns the value of attribute isSeasonal.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def isSeasonal @isSeasonal end |
#languageType ⇒ Object (readonly)
Returns the value of attribute languageType.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def languageType @languageType end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def latitude @latitude end |
#locationDescription ⇒ Object (readonly)
Returns the value of attribute locationDescription.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def locationDescription @locationDescription end |
#logoName ⇒ Object (readonly)
Returns the value of attribute logoName.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def logoName @logoName end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 7 def name @name end |
Class Method Details
.from_response(client, response) ⇒ Object
Shouldn’t need to call this directly.
Creates a client public key from a response hash.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 14 def from_response(client, response) args = { client: client, address_city: response['atmLocation']['address']['city'], address_country: response['atmLocation']['address']['country'], address_postal_code: response['atmLocation']['address']['postalCode'], address_state: response['atmLocation']['address']['state'], address_street: response['atmLocation']['address']['street'], latitude: response['atmLocation']['coordinates']['latitude'], longitude: response['atmLocation']['coordinates']['longitude'], id: response['atmLocation']['id'], isAvailable24Hours: response['atmLocation']['isAvailable24Hours'], isDepositAvailable: response['atmLocation']['isDepositAvailable'], isHandicappedAccessible: response['atmLocation']['isHandicappedAccessible'], isOffPremise: response['atmLocation']['isOffPremise'], isSeasonal: response['atmLocation']['isSeasonal'], languageType: response['atmLocation']['languageType'], locationDescription: response['atmLocation']['locationDescription'], logoName: response['atmLocation']['logoName'], name: response['atmLocation']['name'], distance: response['distance'] } self.new(args) end |
.locate(client:, zip: nil, page: nil, per_page: nil, radius: nil, lat: nil, lon: nil) ⇒ SynapsePayRest::Atm
Locate ATMs near zip code
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 46 def locate(client:, zip: nil, page: nil, per_page: nil, radius: nil, lat: nil, lon: nil) raise ArgumentError, 'client must be a SynapsePayRest::Client' unless client.is_a?(Client) [page, per_page].each do |arg| if arg && (!arg.is_a?(Integer) || arg < 1) raise ArgumentError, "#{arg} must be nil or an Integer >= 1" end end [zip, radius, lat, lon].each do |arg| if arg && !arg.is_a?(String) raise ArgumentError, "#{arg}must be a String" end end response = client.atms.locate(zip: zip, page: page, per_page: per_page, radius: radius, lat: lat, lon: lon) multiple_from_response(client, response['atms']) end |
.multiple_from_response(client, response) ⇒ Object
Calls from_response on each member of a response collection.
66 67 68 69 |
# File 'lib/synapse_pay_rest/models/atm/atm.rb', line 66 def multiple_from_response(client, response) return [] if response.empty? response.map { |atm_data| from_response(client.dup, atm_data)} end |