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

{{{



421
422
423
424
425
426
427
428
429
430
431
# File 'lib/cpee/implementation_properties.rb', line 421

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



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/cpee/implementation_properties.rb', line 433

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