class Restforce::Mash

def klass(val)

represent the data.
When passed a hash, it will determine what class is appropriate to
def klass(val)
  if val.has_key? 'records'
    # When the hash has a records key, it should be considered a collection
    # of sobject records.
    Restforce::Collection
  elsif val.has_key? 'attributes'
    if val['attributes']['type'] == 'Attachment'
      Restforce::Attachment
    else
      # When the hash contains an attributes key, it should be considered an
      # sobject record
      Restforce::SObject
    end
  else
    # Fallback to a standard Restforce::Mash for everything else
    Restforce::Mash
  end
end