Class: RubyHome::HTTP::ApplicationController

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/ruby_home/http/controllers/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#accessory_infoObject



20
21
22
# File 'lib/ruby_home/http/controllers/application_controller.rb', line 20

def accessory_info
  AccessoryInfo
end

#cacheObject



32
33
34
# File 'lib/ruby_home/http/controllers/application_controller.rb', line 32

def cache
  GlobalCache.instance[request_id] ||= Cache.new
end

#identifier_cacheObject



24
25
26
# File 'lib/ruby_home/http/controllers/application_controller.rb', line 24

def identifier_cache
  IdentifierCache
end

#json_bodyObject



13
14
15
16
17
18
# File 'lib/ruby_home/http/controllers/application_controller.rb', line 13

def json_body
  @_json_body ||= begin
    request.body.rewind
    JSON.parse(request.body.read)
  end
end

#request_idObject



28
29
30
# File 'lib/ruby_home/http/controllers/application_controller.rb', line 28

def request_id
  Application.request_id
end

#unpack_requestObject



6
7
8
9
10
11
# File 'lib/ruby_home/http/controllers/application_controller.rb', line 6

def unpack_request
  @_unpack_request ||= begin
    request.body.rewind
    TLV.unpack(request.body.read)
  end
end