Class: Upman::Extensions::GetInstalledPackages::Servlet
- Inherits:
-
Server::BaseServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Server::BaseServlet
- Upman::Extensions::GetInstalledPackages::Servlet
- Defined in:
- lib/upman/extensions/get_installed_packages.rb
Instance Attribute Summary collapse
-
#requested ⇒ Object
Returns the value of attribute requested.
Attributes inherited from Server::BaseServlet
Instance Method Summary collapse
-
#do_GET(request, response) ⇒ Object
rubocop:disable Naming/MethodName.
- #perform_action ⇒ Object
Methods inherited from Server::BaseServlet
#bad_request, #get_param, #initialize, #is_authenticated, #not_authorized, #ok
Methods included from Utils::Helper
Constructor Details
This class inherits a constructor from Upman::Server::BaseServlet
Instance Attribute Details
#requested ⇒ Object
Returns the value of attribute requested.
12 13 14 |
# File 'lib/upman/extensions/get_installed_packages.rb', line 12 def requested @requested end |
Instance Method Details
#do_GET(request, response) ⇒ Object
rubocop:disable Naming/MethodName
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/upman/extensions/get_installed_packages.rb', line 15 def do_GET(request, response) # rubocop:enable Naming/MethodName super(request, response) unless is_authenticated(request) response = (response, "Request declined") return response end @requested = get_param('requested', 'int') if (body = perform_action) response = ok(response, body) end end |
#perform_action ⇒ Object
32 33 34 35 |
# File 'lib/upman/extensions/get_installed_packages.rb', line 32 def perform_action installed_package_service = Upman::Service::InstalledPackages.new installed_package_service.get(@requested).to_json end |