class Yelp::Fusion::Responses::Base

Base instance variables sent back from JSON response

Public Class Methods

new(json) click to toggle source

yelp returns its data in JSON format.

# File lib/yelp/fusion/responses/base.rb, line 28
def initialize(json)
  return if json.nil?

  json.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Private Instance Methods

parse(json, klass) click to toggle source
# File lib/yelp/fusion/responses/base.rb, line 38
def parse(json, klass)
  return json.collect { |j| klass.new(j) } if json.is_a?(Array)
  return klass.new(json) if json

  nil
end