module Cloverly::Base::ClassMethods

Public Instance Methods

parse(cloverly_instance, json_response) click to toggle source
# File lib/cloverly/base.rb, line 28
def parse(cloverly_instance, json_response)
  if json_response.is_a?(Array)
    json_response.map do |item_json|
      self.parse(cloverly_instance, item_json)
    end
  else
    instance = self.new(cloverly_instance)

    instance.json = json_response
    instance.attributes = json_response

    instance
  end
end