lib/QuickBaseClient.rb in quickbase_client-1.0.17 vs lib/QuickBaseClient.rb in quickbase_client-1.0.18
- old
+ new
@@ -39,11 +39,11 @@
attr_reader :cacheSchemas, :cachedSchemas, :chdbids, :choice, :clist, :copyfid, :create, :createapptoken, :createdTime
attr_reader :databases, :dbdesc, :dbid, :dbidForRequestURL, :dbname, :delete, :destrid, :disprec, :domain, :downLoadFileURL
attr_reader :email, :errcode, :errdetail, :errtext, :excludeparents, :externalAuth, :fform
attr_reader :fid, :fids, :field, :fields, :field_data, :field_data_list, :fieldTypeLabelMap, :fieldValue, :fileContents, :fileUploadToken, :firstName, :fmt, :fname, :fnames, :fvlist
attr_reader :hours, :HTML, :httpConnection, :id, :ignoreError, :includeancestors
- attr_reader :jht, :jsa, :key_fid, :keepData, :label, :lastAccessTime
+ attr_reader :jht, :jsa, :key_fid, :key, :keepData, :label, :lastAccessTime
attr_reader :lastError, :lastModifiedTime, :lastName, :lastPaymentDate, :lastRecModTime, :login
attr_reader :mgrID, :mgrName, :mode, :modify, :name
attr_reader :newappname, :newowner, :newdbdesc, :newdbid, :newdbname
attr_reader :num_fields, :numMatches, :num_records, :num_recs_added, :num_records_deleted
attr_reader :num_recs_input, :num_recs_updated, :numadded, :numCreated
@@ -2189,16 +2189,17 @@
alias downloadFile downLoadFile
alias _downloadFile _downLoadFile
# API_EditRecord
- def editRecord( dbid, rid, fvlist, disprec = nil, fform = nil, ignoreError = nil, update_id = nil, msInUTC =nil )
+ def editRecord( dbid, rid, fvlist, disprec = nil, fform = nil, ignoreError = nil, update_id = nil, msInUTC =nil, key = nil )
- @dbid, @rid, @fvlist, @disprec, @fform, @ignoreError, @update_id, @msInUTC = dbid, rid, fvlist, disprec, fform, ignoreError, update_id, msInUTC
+ @dbid, @rid, @fvlist, @disprec, @fform, @ignoreError, @update_id, @msInUTC, @key = dbid, rid, fvlist, disprec, fform, ignoreError, update_id, msInUTC, key
setFieldValues( fvlist, false ) if fvlist.is_a?(Hash)
- xmlRequestData = toXML( :rid, @rid )
+ xmlRequestData = toXML( :rid, @rid ) if @rid
+ xmlRequestData = toXML( :key, @key ) if @key
@fvlist.each{ |fv| xmlRequestData << fv } #see addFieldValuePair, clearFieldValuePairList, @fvlist
xmlRequestData << toXML( :disprec, @disprec ) if @disprec
xmlRequestData << toXML( :fform, @fform ) if @fform
xmlRequestData << toXML( :ignoreError, "1" ) if @ignoreError
xmlRequestData << toXML( :update_id, @update_id ) if @update_id
@@ -3036,13 +3037,13 @@
# These methods are focused on reducing the amount of code you
# have to write to get stuff done using the QuickBase::Client.
# -----------------------------------------------------------------------------------------------
# Use this if you aren't sure whether a particular record already exists or not
- def addOrEditRecord( dbid, fvlist, rid = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )
- if rid
- editRecord( dbid, rid, fvlist, disprec, fform, ignoreError, update_id )
+ def addOrEditRecord( dbid, fvlist, rid = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil, key = nil )
+ if rid or key
+ editRecord( dbid, rid, fvlist, disprec, fform, ignoreError, update_id, key )
if !@requestSucceeded
addRecord( dbid, fvlist, disprec, fform, ignoreError, update_id )
end
else
addRecord( dbid, fvlist, disprec, fform, ignoreError, update_id )
@@ -3157,17 +3158,18 @@
end
def _setActiveRecord( rid ) setActiveRecord( @dbid, rid ) end
# Change a named field's value in the active record.
# e.g. setFieldValue( "Location", "Miami" )
- def setFieldValue( fieldName, fieldValue, dbid = nil, rid = nil )
+ def setFieldValue( fieldName, fieldValue, dbid = nil, rid = nil, key =nil )
@dbid ||= dbid
@rid ||= rid
- if @dbid and @rid
+ @key ||= key
+ if @dbid and (@rid or @key)
clearFieldValuePairList
addFieldValuePair( fieldName, nil, nil, fieldValue )
- editRecord( @dbid, @rid, @fvlist )
+ editRecord( @dbid, @rid, @fvlist, nil, nil, nil, nil, nil, @key )
end
end
# Set several named fields' values. Will modify the active record if there is one.
# e.g. setFieldValues( {"Location" => "Miami", "Phone" => "343-4567" } )
@@ -3175,11 +3177,11 @@
if fields.is_a?(Hash)
clearFieldValuePairList
fields.each{ |fieldName,fieldValue|
addFieldValuePair( fieldName, nil, nil, fieldValue )
}
- if editRecord and @dbid and @rid
- editRecord( @dbid, @rid, @fvlist )
+ if editRecord and @dbid and (@rid or @key)
+ editRecord( @dbid, @rid, @fvlist, nil, nil, nil, nil, nil, @key )
end
end
end
# Change a field's value in multiple records. If the optional test