Class: SynapsePayRest::Atms

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(client) ⇒ Atms

Returns a new instance of Atms.

Parameters:



11
12
13
# File 'lib/synapse_pay_rest/api/atms.rb', line 11

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSynapsePayRest::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

Parameters:

  • scope (String)

Returns:

  • (Hash)

    API responsea

Raises:



24
25
26
27
28
29
30
31
32
# File 'lib/synapse_pay_rest/api/atms.rb', line 24

def locate(**options)
  params = VALID_QUERY_PARAMS.map do |p|
    options[p] ? "#{p}=#{options[p]}" : nil
  end.compact

  path = "/nodes/atms?"
  path += params.join('&') if params.any?
  client.get(path)
end