Class: PowerBI::GatewayDatasource
- Defined in:
- lib/power-bi/gateway_datasource.rb
Instance Attribute Summary collapse
-
#gateway ⇒ Object
readonly
Returns the value of attribute gateway.
-
#gateway_datasource_users ⇒ Object
readonly
Returns the value of attribute gateway_datasource_users.
Attributes inherited from Object
Instance Method Summary collapse
- #data_to_attributes(data) ⇒ Object
- #delete ⇒ Object
- #get_data(id) ⇒ Object
-
#initialize(tenant, parent, id = nil) ⇒ GatewayDatasource
constructor
A new instance of GatewayDatasource.
- #update_credentials(encrypted_credentials) ⇒ Object
Methods inherited from Object
instantiate_from_data, #reload, #set_attributes
Constructor Details
#initialize(tenant, parent, id = nil) ⇒ GatewayDatasource
Returns a new instance of GatewayDatasource.
5 6 7 8 9 |
# File 'lib/power-bi/gateway_datasource.rb', line 5 def initialize(tenant, parent, id = nil) super(tenant, id) @gateway = parent @gateway_datasource_users = GatewayDatasourceUserArray.new(@tenant, self) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PowerBI::Object
Instance Attribute Details
#gateway ⇒ Object (readonly)
Returns the value of attribute gateway.
3 4 5 |
# File 'lib/power-bi/gateway_datasource.rb', line 3 def gateway @gateway end |
#gateway_datasource_users ⇒ Object (readonly)
Returns the value of attribute gateway_datasource_users.
3 4 5 |
# File 'lib/power-bi/gateway_datasource.rb', line 3 def gateway_datasource_users @gateway_datasource_users end |
Instance Method Details
#data_to_attributes(data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/power-bi/gateway_datasource.rb', line 15 def data_to_attributes(data) { gateway_id: data[:gatewayId], datasource_type: data[:datasourceType], datasource_name: data[:datasourceName], connection_details: data[:connectionDetails], id: data[:id], credential_type: data[:credentialType], gateway: data[:gateway], } end |
#delete ⇒ Object
44 45 46 47 48 |
# File 'lib/power-bi/gateway_datasource.rb', line 44 def delete @tenant.delete("/gateways/#{gateway.id}/datasources/#{id}", use_profile: false) @gateway.gateway_datasources.reload true end |
#get_data(id) ⇒ Object
11 12 13 |
# File 'lib/power-bi/gateway_datasource.rb', line 11 def get_data(id) @tenant.get("/gateways/#{@gateway.id}/datasources/#{id}", use_profile: false) end |
#update_credentials(encrypted_credentials) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/power-bi/gateway_datasource.rb', line 27 def update_credentials(encrypted_credentials) @tenant.patch("/gateways/#{gateway.id}/datasources/#{id}", use_profile: false) do |req| req.body = { credentialDetails: { credentialType: "Basic", credentials: encrypted_credentials, encryptedConnection: "Encrypted", encryptionAlgorithm: "RSA-OAEP", privacyLevel: "Organizational", useCallerAADIdentity: false, useEndUserOAuth2Credentials: false, }, }.to_json end true end |