class Papapi::GridResponse

Public Instance Methods

[](key) click to toggle source
# File lib/papapi/grid_response.rb, line 18
def [] (key)
  if rows[key.to_i]
    return Hash[*attributes.zip(rows[key.to_i]).flatten]
  end
end
attributes() click to toggle source
# File lib/papapi/grid_response.rb, line 6
def attributes
  parsed['rows'].first
end
count() click to toggle source
# File lib/papapi/grid_response.rb, line 10
def count
  parsed['count']
end
each() { |Hash| ... } click to toggle source
# File lib/papapi/grid_response.rb, line 24
def each
  rows.each do |row|
    yield Hash[*attributes.zip(row).flatten]
  end
end
rows() click to toggle source
# File lib/papapi/grid_response.rb, line 14
def rows
  parsed['rows'].slice(1, parsed['rows'].count-1)
end
to_a() click to toggle source
# File lib/papapi/grid_response.rb, line 30
def to_a
  rows
end