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