Class: PowerBI::GatewayDatasourceArray
- Defined in:
- lib/power-bi/gateway_datasource.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#create(name, encrypted_credentials, db_server, db_name) ⇒ Object
only MySQL type is currently supported.
- #get_data ⇒ Object
-
#initialize(tenant, gateway) ⇒ GatewayDatasourceArray
constructor
A new instance of GatewayDatasourceArray.
Methods inherited from Array
Constructor Details
#initialize(tenant, gateway) ⇒ GatewayDatasourceArray
Returns a new instance of GatewayDatasourceArray.
54 55 56 57 |
# File 'lib/power-bi/gateway_datasource.rb', line 54 def initialize(tenant, gateway) super(tenant, gateway) @gateway = gateway end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PowerBI::Array
Class Method Details
.get_class ⇒ Object
59 60 61 |
# File 'lib/power-bi/gateway_datasource.rb', line 59 def self.get_class GatewayDatasource end |
Instance Method Details
#create(name, encrypted_credentials, db_server, db_name) ⇒ Object
only MySQL type is currently supported
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/power-bi/gateway_datasource.rb', line 64 def create(name, encrypted_credentials, db_server, db_name) data = @tenant.post("/gateways/#{@gateway.id}/datasources", use_profile: false) do |req| req.body = { connectionDetails: {server: db_server, database: db_name}.to_json, credentialDetails: { credentialType: "Basic", credentials: encrypted_credentials, encryptedConnection: "Encrypted", encryptionAlgorithm: "RSA-OAEP", privacyLevel: "Organizational", useCallerAADIdentity: false, useEndUserOAuth2Credentials: false, }, datasourceName: name, datasourceType: 'MySql', }.to_json end self.reload GatewayDatasource.instantiate_from_data(@tenant, @gateway, data) end |
#get_data ⇒ Object
85 86 87 |
# File 'lib/power-bi/gateway_datasource.rb', line 85 def get_data @tenant.get("/gateways/#{@gateway.id}/datasources", use_profile: false)[:value] end |