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.
43 44 45 46 |
# File 'lib/power-bi/gateway_datasource.rb', line 43 def initialize(tenant, gateway) super(tenant) @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
48 49 50 |
# File 'lib/power-bi/gateway_datasource.rb', line 48 def self.get_class GatewayDatasource end |
Instance Method Details
#create(name, encrypted_credentials, db_server, db_name) ⇒ Object
only MySQL type is currently supported
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/power-bi/gateway_datasource.rb', line 53 def create(name, encrypted_credentials, db_server, db_name) data = @tenant.post("/gateways/#{@gateway.id}/datasources",) 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.new(@tenant, data) end |
#get_data ⇒ Object
74 75 76 77 |
# File 'lib/power-bi/gateway_datasource.rb', line 74 def get_data data = @tenant.get("/gateways/#{@gateway.id}/datasources")[:value] data.each { |d| d[:gateway] = @gateway } end |