class Atm

Public Class Methods

apiKey() click to toggle source
# File lib/capital_one/atm.rb, line 11
def self.apiKey
        return Config.apiKey
end
getAll() click to toggle source

getAll

Returns all ATMs as an array of hashes.
# File lib/capital_one/atm.rb, line 20
def self.getAll
        url = "#{self.urlWithEntity}?key=#{self.apiKey}"
        resp = Net::HTTP.get_response(URI.parse(url))
        data = JSON.parse(resp.body)
end
getAllByLocation(lat, lng, rad) click to toggle source

getAllByLocation

Get all ATMs withing a certain radius of a geocoordinate

Paremeters: latitude, longitude, radius

Accepts lat, lng, and rad as floats
Returns an array of hashes within the radius of the geocoordinate.  Each hash has an ATM.
# File lib/capital_one/atm.rb, line 32
def self.getAllByLocation(lat, lng, rad)
        url = "#{self.urlWithEntity}?lat=#{lat}&lng=#{lng}&rad=#{rad}&key=#{self.apiKey}"
        resp = Net::HTTP.get_response(URI.parse(url))
        data = JSON.parse(resp.body)
end
getOne(id) click to toggle source

getOne

Gets one ATM for a given ID
Parameters: AtmId
Returns the ATM that has the given ID.
# File lib/capital_one/atm.rb, line 43
def self.getOne(id)
        url = "#{self.urlWithEntity}/#{id}?key=#{self.apiKey}"
        resp = Net::HTTP.get_response(URI.parse(url))
        data = JSON.parse(resp.body)
end
url() click to toggle source
# File lib/capital_one/atm.rb, line 7
def self.url
        return Config.baseUrl
end
urlWithEntity() click to toggle source
# File lib/capital_one/atm.rb, line 3
def self.urlWithEntity
        return Config.baseUrl + "/atms"
end