gooddata 0.6.23 → 0.6.24

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
  SHA1:
3
- metadata.gz: cf83961610c60c9419a174b0f54d7f9f7c1fd5b6
4
- data.tar.gz: 4d29bd398cd6223a07cf0b9ab83eb17a182c795b
3
+ metadata.gz: 30374dd9fc0772222ad087d4c46a0e0cbf67afa7
4
+ data.tar.gz: ca952f77f35a66ed185d4397f2316d40e39bdb6f
5
5
  SHA512:
6
- metadata.gz: ce0faaf8e3e6f8a8d44216047602e4d98d9ecd326d5a258ef641e9a2186d4ac4afa36d3c38195a46d2fc708193d6e062567b938af0a3cf7a8db7b9bc3e7beceb
7
- data.tar.gz: 56e6a3495144c698801c9e006a42d7f2b2f7e3f04f79cefd71185ad7de41b476c7b603691ddaf1ff40a7011928b77ef904938795fd6016a1be42a1be260f0f62
6
+ metadata.gz: eab3feca7ef26f5e9b97bbc6b7878910afa7da4317b5a802327bd383fa767de654cf6466537ff34e7ee3944b76da5f858e6c5e76f8b535c29929ead8bd9e6138
7
+ data.tar.gz: 00491d58b885d2b11ae9364e011ec008e91aeb39777e0318619c21a20fb4bf64642f2b689e6ebb23357e1d0a64e214f374c9d342030e5201ebd4fa81a6d8cc05
data/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # GoodData Ruby SDK Changelog
2
2
 
3
3
  ## 0.6.23
4
+ - Fixed typo sometimes causing crash of ReportDefinition#replace
4
5
 
5
6
  ## 0.6.22
6
7
  - Added rake task (license:add) for automatic license headers generating
@@ -131,7 +131,7 @@ module GoodData
131
131
  guesser.headers.each_with_index do |header, i|
132
132
  options = guess[header].map(&:to_s)
133
133
  options = options.select { |t| t != :connection_point.to_s } if connection_point_set
134
- type = ask((question_fmt % [i + 1, header]), :answers => options) # rubocop:disable Lint/FormatParameterMismatch
134
+ type = ask((question_fmt % [i + 1, header]), :answers => options)
135
135
  model.push :title => header, :name => header, :type => type.upcase
136
136
  connection_point_set = true if type == :connection_point.to_s
137
137
  end
@@ -125,7 +125,7 @@ module GoodData
125
125
  tab = options[:tab] || ''
126
126
 
127
127
  req_uri = "/gdc/projects/#{project.pid}/clientexport"
128
- x = client.post(req_uri, 'clientExport' => { 'url' => "https://secure.gooddata.com/dashboard.html#project=#{GoodData.project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", 'name' => title })
128
+ x = client.post(req_uri, 'clientExport' => { 'url' => "#{client.connection.server_url}/dashboard.html#project=#{GoodData.project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", 'name' => title })
129
129
  client.poll_on_code(x['asyncTask']['link']['poll'], options.merge(process: false))
130
130
  end
131
131
 
@@ -19,7 +19,7 @@ module GoodData
19
19
  # @return [String]
20
20
  def find_value_uri(value)
21
21
  escaped_value = CGI.escape(value)
22
- results = client.post("#{uri}/validElements?limit=1&offset=0&order=asc&filter=#{escaped_value}", {})
22
+ results = client.post("#{uri}/validElements?limit=1&offset=0&order=asc&filter=#{escaped_value}", 'validElementsRequest' => {})
23
23
  items = results['validElements']['items']
24
24
  if items.empty?
25
25
  fail(AttributeElementNotFound, value)
@@ -63,7 +63,7 @@ module GoodData
63
63
  offset = options[:offset] || 0
64
64
  page_limit = options[:limit] || 100
65
65
  loop do
66
- results = client.post("#{uri}/validElements?limit=#{page_limit}&offset=#{offset}&order=asc", {})
66
+ results = client.post("#{uri}/validElements?limit=#{page_limit}&offset=#{offset}&order=asc", 'validElementsRequest' => {})
67
67
 
68
68
  # Implementation of polling is based on
69
69
  # https://opengrok.intgdc.com/source/xref/gdc-backend/src/test/java/com/gooddata/service/dao/ValidElementsDaoTest.java
@@ -90,8 +90,9 @@ module GoodData
90
90
  end
91
91
 
92
92
  def values_count
93
- results = client.post("#{uri}/validElements?limit=1&offset=0&order=asc", {})
94
- results['validElements']['paging']['total'].to_i
93
+ results = client.post("#{uri}/validElements?limit=1&offset=0&order=asc", 'validElementsRequest' => {})
94
+ count = GoodData::Helpers.get_path(results, %w(validElements paging total))
95
+ count && count.to_i
95
96
  end
96
97
 
97
98
  # Gives an attribute of current label
@@ -57,6 +57,29 @@ module GoodData
57
57
  report['report']['meta']['identifier'] = options[:identifier] if options[:identifier]
58
58
  client.create(Report, report, :project => project)
59
59
  end
60
+
61
+ def data_result(result, options = {})
62
+ client = options[:client]
63
+ data_result_uri = result['execResult']['dataResult']
64
+ begin
65
+ result = client.poll_on_response(data_result_uri, options) do |body|
66
+ body && body['taskState'] && body['taskState']['status'] == 'WAIT'
67
+ end
68
+ rescue RestClient::BadRequest => e
69
+ resp = JSON.parse(e.response)
70
+ if GoodData::Helpers.get_path(resp, %w(error component)) == 'MD::DataResult'
71
+ raise GoodData::UncomputableReport
72
+ else
73
+ raise e
74
+ end
75
+ end
76
+
77
+ if result.empty?
78
+ ReportDataResult.new(data: [], top: 0, left: 0)
79
+ else
80
+ ReportDataResult.from_xtab(result)
81
+ end
82
+ end
60
83
  end
61
84
 
62
85
  # Add a report definition to a report. This will show on a UI as a new version.
@@ -127,17 +150,7 @@ module GoodData
127
150
  def execute(options = {})
128
151
  fail 'You have to save the report before executing. If you do not want to do that please use GoodData::ReportDefinition' unless saved?
129
152
  result = client.post '/gdc/xtab2/executor3', 'report_req' => { 'report' => uri }
130
- data_result_uri = result['execResult']['dataResult']
131
-
132
- result = client.poll_on_response(data_result_uri, options) do |body|
133
- body && body['taskState'] && body['taskState']['status'] == 'WAIT'
134
- end
135
-
136
- if result.empty?
137
- client.create(ReportDataResult, data: [], top: 0, left: 0, project: project)
138
- else
139
- ReportDataResult.from_xtab(result, client: client, project: project)
140
- end
153
+ GoodData::Report.data_result(result, options.merge(client: client))
141
154
  end
142
155
 
143
156
  # Returns true if you can export and object
@@ -242,7 +242,7 @@ module GoodData
242
242
  uri = "/gdc/app/projects/#{project.pid}/execute"
243
243
  client.post(uri, data)
244
244
  end
245
- data_result(result, opts)
245
+ GoodData::Report.data_result(result, opts.merge(client: client))
246
246
  end
247
247
 
248
248
  def filters
@@ -352,29 +352,5 @@ module GoodData
352
352
  def table?
353
353
  content['format'] == 'grid'
354
354
  end
355
-
356
- private
357
-
358
- def data_result(result, options = {})
359
- data_result_uri = result['execResult']['dataResult']
360
- begin
361
- result = client.poll_on_response(data_result_uri, options) do |body|
362
- body && body['taskState'] && body['taskState']['status'] == 'WAIT'
363
- end
364
- rescue RestClient::BadRequest => e
365
- resp = JSON.parse(e.response)
366
- if GoodData::Helpers.get_path(resp, %w(error component)) == 'MD::DataResult'
367
- raise GoodData::UncomputableReport
368
- else
369
- raise e
370
- end
371
- end
372
-
373
- if result.empty?
374
- client.create(ReportDataResult, data: [], top: 0, left: 0, project: project)
375
- else
376
- ReportDataResult.from_xtab(result, client: client, project: project)
377
- end
378
- end
379
355
  end
380
356
  end
@@ -6,7 +6,7 @@
6
6
 
7
7
  # GoodData Module
8
8
  module GoodData
9
- VERSION = '0.6.23'
9
+ VERSION = '0.6.24'
10
10
 
11
11
  class << self
12
12
  # Version
@@ -17,7 +17,7 @@ module GoodData
17
17
  # Identifier of gem version
18
18
  # @return Formatted gem version
19
19
  def gem_version_string
20
- "gooddata-gem/#{VERSION}"
20
+ "gooddata-gem/#{VERSION}/#{RUBY_PLATFORM}/#{RUBY_VERSION}"
21
21
  end
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.23
4
+ version: 0.6.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-09-11 00:00:00.000000000 Z
14
+ date: 2015-10-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -1030,7 +1030,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1030
1030
  version: '0'
1031
1031
  requirements: []
1032
1032
  rubyforge_project:
1033
- rubygems_version: 2.4.5
1033
+ rubygems_version: 2.4.6
1034
1034
  signing_key:
1035
1035
  specification_version: 4
1036
1036
  summary: A convenient Ruby wrapper around the GoodData RESTful API