Class: RubyPitaya::MongoService
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- RubyPitaya::MongoService
- Defined in:
- lib/rubypitaya/core/app/services/mongo_service.rb
Instance Method Summary collapse
- #clear_all_data ⇒ Object
- #client ⇒ Object
- #connect ⇒ Object
- #disconnect ⇒ Object
-
#initialize(setup) ⇒ MongoService
constructor
A new instance of MongoService.
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_data ⇒ Object
31 32 33 |
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 31 def clear_all_data # TODO: implement it end |
#client ⇒ Object
27 28 29 |
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 27 def client @mongo end |
#connect ⇒ Object
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 |
#disconnect ⇒ Object
23 24 25 |
# File 'lib/rubypitaya/core/app/services/mongo_service.rb', line 23 def disconnect # TODO: implement it end |