Class: AuroraDataApi::DataService
- Inherits:
-
Object
- Object
- AuroraDataApi::DataService
- Defined in:
- lib/aurora-data-api/data_service.rb
Instance Method Summary collapse
- #execute(hash, without_database = false) ⇒ Object
-
#initialize ⇒ DataService
constructor
A new instance of DataService.
Constructor Details
#initialize ⇒ DataService
Returns a new instance of DataService.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/aurora-data-api/data_service.rb', line 8 def initialize client_param = {region: Environment.region} if Environment.offline? offline_config_update client_param[:endpoint] = Environment.offline_endpoint end @client = Aws::RDSDataService::Client.new(client_param) @execute_params = { database: Environment.database_name, secret_arn: Environment.secret_arn, resource_arn: Environment.resource_arn, include_result_metadata: true } end |
Instance Method Details
#execute(hash, without_database = false) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/aurora-data-api/data_service.rb', line 23 def execute(hash, without_database = false) if without_database @client.execute_statement( hash.merge(@execute_params.reject { |k, _v| k == :database }) ) else @client.execute_statement(hash.merge(@execute_params)) end end |