Class: SynapsePayRest::Atms
- Inherits:
-
Object
- Object
- SynapsePayRest::Atms
- Defined in:
- lib/synapse_pay_rest/api/atms.rb
Overview
Wrapper class for /client endpoint
Constant Summary collapse
- VALID_QUERY_PARAMS =
[:page, :per_page, :radius, :zip, :lat, :lon].freeze
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(client) ⇒ Atms
constructor
A new instance of Atms.
-
#locate(**options) ⇒ Hash
Sends a GET request to /nodes endpoint to locate atms, and returns the response.
Constructor Details
#initialize(client) ⇒ Atms
Returns a new instance of Atms.
11 12 13 |
# File 'lib/synapse_pay_rest/api/atms.rb', line 11 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ SynapsePayRest::HTTPClient
8 9 10 |
# File 'lib/synapse_pay_rest/api/atms.rb', line 8 def client @client end |
Instance Method Details
#locate(**options) ⇒ Hash
Sends a GET request to /nodes endpoint to locate atms, and returns the response.
HTTP response from API
24 25 26 27 28 29 30 31 32 |
# File 'lib/synapse_pay_rest/api/atms.rb', line 24 def locate(**) params = VALID_QUERY_PARAMS.map do |p| [p] ? "#{p}=#{[p]}" : nil end.compact path = "/nodes/atms?" path += params.join('&') if params.any? client.get(path) end |