Class: CPEE::Properties::PatchPositions

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(id, opts, xml) ⇒ Object

{{{



512
513
514
515
516
517
518
519
520
521
522
# File 'lib/cpee/implementation_properties.rb', line 512

def self::set(id,opts,xml)
  doc = XML::Smart::string(xml)
  content = {}
  doc.find("/*/*").map do |ele|
    val = { 'position' => ele.qname.name }
    val['passthrough'] = ele.attributes['passthrough'] if ele.attributes['passthrough']
    content[ele.text] ||= []
    content[ele.text] << val
  end
  CPEE::Persistence::set_item(id,opts,'position',content)
end

Instance Method Details

#responseObject



524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/cpee/implementation_properties.rb', line 524

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