Class: SacCountyData::OutstandingChecks
- Inherits:
-
Object
- Object
- SacCountyData::OutstandingChecks
- Defined in:
- lib/sac_county_data/outstanding_checks.rb
Constant Summary collapse
- RESOURCE_URL =
'OUTST-CHECK-FROM-COUNT-OF/data.json'.freeze
Class Method Summary collapse
Class Method Details
.all ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sac_county_data/outstanding_checks.rb', line 8 def self.all objs = [] response = Faraday.get("#{API_URL}/#{RESOURCE_URL}/?auth_key=#{SacCountyData.api_key}") a = JSON.parse(response.body)['result']['fArray'] a[4..-1].each_slice(4) do |s| obj = {} obj[:date] = s[0]['fStr'] obj[:number] = s[1]['fStr'] obj[:amount] = s[2]['fStr'] obj[:name] = s[3]['fStr'] objs.push OpenStruct.new obj end objs end |