Class: CPEE::Properties::PutItems

Inherits:
Riddl::Implementation
  • Object
show all
Defined in:
lib/cpee/implementation_properties.rb

Overview

}}}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set(item, id, opts, xml) ⇒ Object

{{{



387
388
389
390
391
392
393
394
395
396
397
# File 'lib/cpee/implementation_properties.rb', line 387

def self::set(item,id,opts,xml)
  doc = XML::Smart::string(xml)
  val = {}
  doc.find("/*/*").each do |ele|
    val[ele.qname.name] = ele.text unless val.has_key?(ele.qname.name)
  end
  oldkeys = CPEE::Persistence::extract_list(id,opts,item).to_h.keys
  newkeys = val.keys
  del = oldkeys - newkeys
  CPEE::Persistence::set_list(id,opts,item,val,del)
end

Instance Method Details

#responseObject



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/cpee/implementation_properties.rb', line 399

def response
  item = @a[0]
  id = @a[1]
  opts = @a[2]
  if opts[:statemachine].readonly? id
    @status = 423
  else
    begin
      PutItems::set(item,id,opts,@p[0].value.read)
    rescue
      @status = 400
    end
  end
  nil
end