Class: Wellness::Services::PostgresService
- Defined in:
- lib/wellness/services/postgres_service.rb
Instance Method Summary collapse
- #call ⇒ Hash
-
#initialize(args = {}) ⇒ PostgresService
constructor
A new instance of PostgresService.
Methods inherited from Base
Constructor Details
#initialize(args = {}) ⇒ PostgresService
Returns a new instance of PostgresService.
10 11 12 13 14 15 16 17 18 |
# File 'lib/wellness/services/postgres_service.rb', line 10 def initialize(args={}) @connection_options = { host: args[:host], port: args[:port], dbname: args[:database], user: args[:user], password: args[:password] } end |
Instance Method Details
#call ⇒ Hash
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wellness/services/postgres_service.rb', line 21 def call case PG::Connection.ping(@connection_options) when PG::Constants::PQPING_NO_ATTEMPT ping_failed('no attempt made to ping') when PG::Constants::PQPING_NO_RESPONSE ping_failed('no response from ping') when PG::Constants::PQPING_REJECT ping_failed('ping was rejected') else ping_successful end end |