Class: PowerBI::Dataset
Instance Attribute Summary collapse
-
#datasources ⇒ Object
readonly
Returns the value of attribute datasources.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#refresh_history ⇒ Object
readonly
Returns the value of attribute refresh_history.
-
#workspace ⇒ Object
readonly
Returns the value of attribute workspace.
Attributes inherited from Object
Instance Method Summary collapse
- #bind_to_gateway(gateway, gateway_datasource) ⇒ Object
- #data_to_attributes(data) ⇒ Object
- #delete ⇒ Object
- #get_data(id) ⇒ Object
-
#initialize(tenant, parent, id = nil) ⇒ Dataset
constructor
A new instance of Dataset.
- #last_refresh ⇒ Object
- #refresh ⇒ Object
- #update_parameter(name, value) ⇒ Object
Methods inherited from Object
instantiate_from_data, #reload, #set_attributes
Constructor Details
#initialize(tenant, parent, id = nil) ⇒ Dataset
Returns a new instance of Dataset.
5 6 7 8 9 10 11 |
# File 'lib/power-bi/dataset.rb', line 5 def initialize(tenant, parent, id = nil) super(tenant, id) @workspace = parent @datasources = DatasourceArray.new(@tenant, self) @parameters = ParameterArray.new(@tenant, self) @refresh_history = RefreshArray.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
#datasources ⇒ Object (readonly)
Returns the value of attribute datasources.
3 4 5 |
# File 'lib/power-bi/dataset.rb', line 3 def datasources @datasources end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/power-bi/dataset.rb', line 3 def parameters @parameters end |
#refresh_history ⇒ Object (readonly)
Returns the value of attribute refresh_history.
3 4 5 |
# File 'lib/power-bi/dataset.rb', line 3 def refresh_history @refresh_history end |
#workspace ⇒ Object (readonly)
Returns the value of attribute workspace.
3 4 5 |
# File 'lib/power-bi/dataset.rb', line 3 def workspace @workspace end |
Instance Method Details
#bind_to_gateway(gateway, gateway_datasource) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/power-bi/dataset.rb', line 61 def bind_to_gateway(gateway, gateway_datasource) @tenant.post("/groups/#{workspace.id}/datasets/#{id}/Default.BindToGateway") do |req| req.body = { gatewayObjectId: gateway.id, datasourceObjectIds: [gateway_datasource.id] }.to_json end true end |
#data_to_attributes(data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/power-bi/dataset.rb', line 17 def data_to_attributes(data) { id: data[:id], name: data[:name], add_rows_API_enabled: data[:addRowsAPIEnabled], configured_by: data[:configuredBy], is_refreshable: data[:isRefreshable], is_effective_identity_required: data[:isEffectiveIdentityRequired], is_effective_identity_roles_required: data[:isEffectiveIdentityRolesRequired], is_on_prem_gateway_required: data[:isOnPremGatewayRequired], target_storage_mode: data[:targetStorageMode], } end |
#delete ⇒ Object
55 56 57 58 59 |
# File 'lib/power-bi/dataset.rb', line 55 def delete @tenant.delete("/groups/#{workspace.id}/datasets/#{id}") @workspace.datasets.reload true end |
#get_data(id) ⇒ Object
13 14 15 |
# File 'lib/power-bi/dataset.rb', line 13 def get_data(id) @tenant.get("/groups/#{@workspace.id}/datasets/#{id}") end |
#last_refresh ⇒ Object
41 42 43 |
# File 'lib/power-bi/dataset.rb', line 41 def last_refresh @refresh_history.first end |
#refresh ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/power-bi/dataset.rb', line 45 def refresh @tenant.post("/groups/#{workspace.id}/datasets/#{id}/refreshes") do |req| req.body = { notifyOption: "NoNotification" }.to_json end @refresh_history.reload true end |
#update_parameter(name, value) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/power-bi/dataset.rb', line 31 def update_parameter(name, value) @tenant.post("/groups/#{workspace.id}/datasets/#{id}/Default.UpdateParameters") do |req| req.body = { updateDetails: [{name: name, newValue: value.to_s}] }.to_json end @parameters.reload true end |