Class: SlideEmUp::SlidesAPI

Inherits:
Goliath::API
  • Object
show all
Defined in:
lib/slide-em-up/slides_api.rb

Instance Method Summary collapse

Constructor Details

#initialize(presentation) ⇒ SlidesAPI

Returns a new instance of SlidesAPI.



9
10
11
# File 'lib/slide-em-up/slides_api.rb', line 9

def initialize(presentation)
  @presentation = presentation
end

Instance Method Details

#response(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/slide-em-up/slides_api.rb', line 13

def response(env)
  path_info = Rack::Utils.unescape(env["PATH_INFO"])
  if path_info == "/"
    serve_slides
  elsif path_info.include? ".."
    unauthorized_access
  else
    serve_asset(path_info)
  end
end