Method: Pod4::NebulousInterface#create

Defined in:
lib/pod4/nebulous_interface.rb

#create(record) ⇒ Object

Pass a parameter string or an array as the record. returns the ID. We assume that the response to the create message returns the ID as the parameter part of the success verb. If that’s not true, then you will have to override #create and sort this out yourself.



226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/pod4/nebulous_interface.rb', line 226

def create(record)
  raise ArgumentError, 'create takes a Hash or an Octothorpe' unless hashy?(record)

  raise ArgumentError, "ID field missing from record" \
    if !@id_ai && record[@id_fld].nil? && record[@id_fld.to_s].nil?

  send_message( verb_for(:create), param_string(:create, record), false )
  @response.params

rescue => e
  handle_error(e)
end