Class: CPEE::Frames::GetFrames
- Inherits:
-
Riddl::Implementation
- Object
- Riddl::Implementation
- CPEE::Frames::GetFrames
- Defined in:
- lib/cpee-frames/implementation.rb
Overview
}}}
Instance Method Summary collapse
-
#response ⇒ Object
{{{.
Instance Method Details
#response ⇒ Object
{{{
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/cpee-frames/implementation.rb', line 258 def response data_dir = @a[0] fname = File.join(data_dir,@r[-2],'frames.json') if File.exist? fname infofile = File.join(data_dir,@r[-2],'info.json') infojson = JSON::parse(File.read(infofile)) # remove not used languages file = JSON::parse(File.read(fname)) file["data"].each do |child| child["url"] = child["url"].find{ |h| h['lang'] == infojson["lang"]}['url'] end Riddl::Parameter::Complex.new('value','application/json',JSON.dump(file)) else @status = 404 end end |