Class: PowerBI::Datasource
Instance Attribute Summary collapse
-
#dataset ⇒ Object
readonly
Returns the value of attribute dataset.
Attributes inherited from Object
Instance Method Summary collapse
- #data_to_attributes(data) ⇒ Object
-
#initialize(tenant, parent, id = nil) ⇒ Datasource
constructor
A new instance of Datasource.
-
#update_credentials(username, password) ⇒ Object
only MySQL type is currently supported.
Methods inherited from Object
instantiate_from_data, #reload, #set_attributes
Constructor Details
#initialize(tenant, parent, id = nil) ⇒ Datasource
Returns a new instance of Datasource.
5 6 7 8 |
# File 'lib/power-bi/datasource.rb', line 5 def initialize(tenant, parent, id = nil) super(tenant, id) @dataset = parent end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PowerBI::Object
Instance Attribute Details
#dataset ⇒ Object (readonly)
Returns the value of attribute dataset.
3 4 5 |
# File 'lib/power-bi/datasource.rb', line 3 def dataset @dataset end |
Instance Method Details
#data_to_attributes(data) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/power-bi/datasource.rb', line 10 def data_to_attributes(data) { gateway_id: data[:gatewayId], datasource_type: data[:datasourceType], connection_details: data[:connectionDetails], datasource_id: data[:datasourceId], } end |
#update_credentials(username, password) ⇒ Object
only MySQL type is currently supported
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/power-bi/datasource.rb', line 20 def update_credentials(username, password) @tenant.patch("/gateways/#{gateway_id}/datasources/#{datasource_id}") do |req| req.body = { credentialDetails: { credentialType: "Basic", credentials: "{\"credentialData\":[{\"name\":\"username\", \"value\":\"#{username}\"},{\"name\":\"password\", \"value\":\"#{password}\"}]}", encryptedConnection: "Encrypted", encryptionAlgorithm: "None", privacyLevel: "None", useCallerAADIdentity: false, useEndUserOAuth2Credentials: false, }, }.to_json end true end |