Module: CPEE::Instantiation::Helpers

Included in:
HandleInstance, InstantiateGit, InstantiateUrl, InstantiateXML
Defined in:
lib/cpee/instantiation.rb

Overview

{{{

Instance Method Summary collapse

Instance Method Details

#handle_data(cpee, instance, data) ⇒ Object

{{{



121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/cpee/instantiation.rb', line 121

def handle_data(cpee,instance,data) #{{{
  if data && !data.empty?
    content = XML::Smart.string('<content/>')
    JSON::parse(data).each do |k,v|
      content.root.add(k,v)
    end
    srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
    res = srv.resource("/#{instance}/properties/values/dataelements/")
    status, response = res.patch [
      Riddl::Parameter::Complex.new('content','text/xml',content.to_s)
    ]
  end rescue nil
end

#handle_endpoints(cpee, instance, data) ⇒ Object

}}}



134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/cpee/instantiation.rb', line 134

def handle_endpoints(cpee,instance,data) #{{{
  if data && !data.empty?
    content = XML::Smart.string('<content/>')
    JSON::parse(data).each do |k,v|
      content.root.add(k,v)
    end
    srv = Riddl::Client.new(cpee, cpee + "?riddl-description")
    res = srv.resource("/#{instance}/properties/values/endpoints/")
    status, response = res.patch [
      Riddl::Parameter::Complex.new('content','text/xml',content.to_s)
    ]
  end rescue nil
end