Ravn::Tactical::ServiceV1::

Roles module

:nocov:

Public Class Methods

included( app )

Add bolts-related routes to the given app.

   # File lib/ravn/tactical/service_v1/roles.rb
18 def self::included( app )
19     super
20 
21     self.log.info "Mounting role endpoints."
22     self.mount( app )
23 end
mount( app )

Mount role endpoints in the given app.

   # File lib/ravn/tactical/service_v1/roles.rb
27 def self::mount( app )
28     app.hash_branch( :v1, 'roles' ) do |r|
29 
30         # GET /api/v1/roles
31         r.is do
32             r.get( &self.method(:get_roles) )
33         end
34 
35     end
36 end

Public Instance Methods

get_roles()

Fetch the collection of roles that are available for this kit.

   # File lib/ravn/tactical/service_v1/roles.rb
44 def get_roles
45     self.log.info "Fetching roles from the current role package"
46 
47     unless Ravn::Tactical::BoltPackage.exists?
48         return []
49     end
50 
51     package = Ravn::Tactical::BoltPackage.load
52 
53     # :TODO: Merge with draft roles from all missions?
54 
55     present_collection( package.roles )
56 end