Class: Application

Inherits:
Object
  • Object
show all
Extended by:
ApplicationConfiguration
Defined in:
lib/blsk_ruby_core_api.rb

Instance Method Summary collapse

Methods included from ApplicationConfiguration

config, config_cassandra, config_consul, config_rest, random_name

Constructor Details

#initialize(rests = [], config = {}) ⇒ Application

Returns a new instance of Application.



16
17
18
19
# File 'lib/blsk_ruby_core_api.rb', line 16

def initialize(rests=[], config={})
  @config = config
  @rests = rests
end

Instance Method Details

#init_rest_serviceObject



21
22
23
24
25
26
27
28
29
# File 'lib/blsk_ruby_core_api.rb', line 21

def init_rest_service
  rests = @rests
  return Sinatra.new {
    rests.each {|a| use a}
    not_found do
      JSON RestService.error_response('EntityNotFound')
    end
  }
end

#startObject



31
32
33
34
35
# File 'lib/blsk_ruby_core_api.rb', line 31

def start
  puts 'start'
  Container['app_service'].start
  init_rest_service
end

#stopObject



37
38
39
# File 'lib/blsk_ruby_core_api.rb', line 37

def stop
  Container['app_service'].stop
end