Class: RubyPitaya::MongoService

Inherits:
ServiceBase show all
Defined in:
lib/rubypitaya/core/app/services/mongo_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(setup) ⇒ MongoService

Returns a new instance of MongoService.



8
9
10
11
12
13
14
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 8

def initialize(setup)
  @mongo = nil
  @mongo_address = setup['rubypitaya.mongo.url']
  @mongo_user = setup['rubypitaya.mongo.user']
  @mongo_password = setup['rubypitaya.mongo.pass']
  @mongo_database_name = setup['rubypitaya.mongo.database']
end

Instance Method Details

#clear_all_dataObject



31
32
33
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 31

def clear_all_data
  # TODO: implement it
end

#clientObject



27
28
29
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 27

def client
  @mongo
end

#connectObject



16
17
18
19
20
21
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 16

def connect
  @mongo = Mongo::Client.new([@mongo_address],
                             user: @mongo_user,
                             password: @mongo_password,
                             database: @mongo_database_name)
end

#disconnectObject



23
24
25
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 23

def disconnect
  # TODO: implement it
end