power-bi 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 349bd7851001e6e16d1d14f50f6abdbd473038ed3ec9665d5cd009a74db365f2
4
- data.tar.gz: fe96607cd040b4fd034336865e7f78ceb35b297526242c4bc1f8ea3419dc95a3
3
+ metadata.gz: e5aaadec6cec57b22f4780dd2e1f4c64c55872d49f5a17a59326fcff099844dd
4
+ data.tar.gz: 1a6bf8c48a1d17333f58519c5ee23ee9a85025c63110c6cc2f2fe9243566f7ca
5
5
  SHA512:
6
- metadata.gz: efc0967cf34f597d99b17a25272ba8546c9200d7e7d85ab8ffbf2ff36f99861560799cefa280f2efb787135bb4afd5bd6588fc3d147b867bd97794803d128637
7
- data.tar.gz: eff9aeb3c7609cd54cf7d9888bb0b6ebc2cddc9cd9996e614d3dffdd8d61f77fc40480fa71baebbfc775044dedc0bd40cf83e36236c512d6808ff8ea3dcb293b
6
+ metadata.gz: 570af0ad49001778d237e4ce712a8120d879cc83d53a9b4a877d2d51ee6fcc3dde4e913cc8a3c42273ce5de45d31d7922308fee03c895fb6fcbce46332b06288
7
+ data.tar.gz: 760813b41e3318fc52871f3adc61f4efcf518f9333f93fcf9295c15b9e61d094518cbd3adbbf7fec0c3c7921239d2082460099fc2adffcd4b60c15067e5946e1
data/README.md CHANGED
@@ -34,6 +34,7 @@ Note 2: to limit the number of API calls, it is best to directly use the _getter
34
34
  * Clone a report from one workspace to another: `report.clone(src_workspace, new_report_name)`
35
35
  * Rebind report to another dataset: `report.rebind(dataset)`
36
36
  * Export report to file: `report.export_to_file(filename, format: 'PDF')`
37
+ * Get embed token: `report.embed_token(access_level: 'View', lifetime_in_minutes: 60)`
37
38
 
38
39
  ## Pages
39
40
 
@@ -79,6 +79,19 @@ module PowerBI
79
79
  File.open(filename, "wb") { |f| f.write(data) }
80
80
  end
81
81
 
82
+ def embed_token(access_level: 'View', lifetime_in_minutes: 60)
83
+ data = @tenant.post("/groups/#{workspace.id}/reports/#{id}/GenerateToken") do |req|
84
+ req.body = {
85
+ accessLevel: access_level,
86
+ lifetimeInMinutes: lifetime_in_minutes
87
+ }.to_json
88
+ end
89
+ {
90
+ token: data[:token],
91
+ expiration: Time.parse(data[:expiration])
92
+ }
93
+ end
94
+
82
95
  end
83
96
 
84
97
  class ReportArray < Array
@@ -14,7 +14,7 @@ module PowerBI
14
14
  ##################
15
15
  @retry_options = {
16
16
  max: retries,
17
- exceptions: [Errno::ETIMEDOUT, Timeout::Error, Faraday::TimeoutError, Faraday::RetriableResponse],
17
+ exceptions: [Errno::ETIMEDOUT, Timeout::Error, Faraday::TimeoutError, Faraday::RetriableResponse, Faraday::ConnectionFailed],
18
18
  methods: [:get, :post, :patch, :delete],
19
19
  retry_statuses: [500], # internal server error
20
20
  interval: 0.2,
data/lib/power-bi/user.rb CHANGED
@@ -18,7 +18,7 @@ module PowerBI
18
18
  end
19
19
 
20
20
  def delete
21
- @tenant.delete("/groups/#{@workspace.id}/users/#{@email_address}")
21
+ @tenant.delete("/groups/#{@workspace.id}/users/#{email_address}")
22
22
  @workspace.users.reload
23
23
  end
24
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power-bi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lode Cools