Class: CPEE::Callbacks::GetCallback

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cpee/implementation_callbacks.rb', line 53

def response
  id = @a[0]
  opts = @a[1]
  callback = @r[-1]

  if CPEE::Persistence::is_member?(id,opts,'callbacks',callback)
    res = {}
    res[:uuid]     = CPEE::Persistence::extract_item(id,opts,"callback/#{callback}/uuid")
    res[:type]     = CPEE::Persistence::extract_item(id,opts,"callback/#{callback}/type")
    res[:position] = CPEE::Persistence::extract_item(id,opts,"callback/#{callback}/position")
    res[:label]    = CPEE::Persistence::extract_item(id,opts,"callback/#{callback}/label")
    if sub = CPEE::Persistence::extract_item(id,opts,"callback/#{callback}/subscription")
      res[:subscription] = sub
    end

    Riddl::Parameter::Complex.new("callback","application/json",JSON.generate(res))
  else
    @status = 404
  end
end