Class: Branch
- Inherits:
-
Object
- Object
- Branch
- Defined in:
- lib/capital_one/branch.rb
Class Method Summary collapse
- .apiKey ⇒ Object
-
.getAll ⇒ Object
Gets all branches Returns an array of Hashes with the branch data.
-
.getOne(id) ⇒ Object
Gets one branch for a given ID = Parameters: AtmId Returns a hash with the ATM data.
- .url ⇒ Object
- .urlWithEntity ⇒ Object
Class Method Details
.apiKey ⇒ Object
11 12 13 |
# File 'lib/capital_one/branch.rb', line 11 def self.apiKey return Config.apiKey end |
.getAll ⇒ Object
Gets all branches Returns an array of Hashes with the branch data
21 22 23 24 25 |
# File 'lib/capital_one/branch.rb', line 21 def self.getAll url = "#{self.urlWithEntity}?key=#{self.apiKey}" resp = Net::HTTP.get_response(URI.parse(url)) data = JSON.parse(resp.body) end |
.getOne(id) ⇒ Object
Gets one branch for a given ID
Parameters: AtmId
Returns a hash with the ATM data
32 33 34 35 36 |
# File 'lib/capital_one/branch.rb', line 32 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 ⇒ Object
3 4 5 |
# File 'lib/capital_one/branch.rb', line 3 def self.url return Config.baseUrl end |
.urlWithEntity ⇒ Object
7 8 9 |
# File 'lib/capital_one/branch.rb', line 7 def self.urlWithEntity return Config.baseUrl + "/branches" end |