20 lines
382 B
Ruby
20 lines
382 B
Ruby
class ApiResponse
|
|
attr_reader :meta
|
|
attr_reader :data
|
|
|
|
# ApiResponse.new(:raw_json => String)
|
|
def initialize(options = {})
|
|
json_input = options[:raw_json]
|
|
hash = JSON.parse(json_input)
|
|
hash.each do |line|
|
|
case line[0]
|
|
when "meta"
|
|
@meta = line[1]
|
|
when "data"
|
|
@data = line[1]
|
|
else
|
|
# Doh?
|
|
end
|
|
end
|
|
end
|
|
end
|