gooddata-bricks 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: c449efac4ebc29bbe1894ddacd889d6c5bc408e0
4
- data.tar.gz: 1ddd5f72330bbcbd4837b3790f4c620d1a87e254
3
+ metadata.gz: 909157ae49e16430568d32477998b87c36b08235
4
+ data.tar.gz: ae58ed11a11753cd720189711002023192ab99a3
5
5
  SHA512:
6
- metadata.gz: 0f46c3b8817ec7f367e4e45b629d3765541acbb875f3f059daa7634302ea9980e1032b818e94cb2d6575e256da5656dba4accff1cbf51ded0328b2f0f10fcc35
7
- data.tar.gz: 1c9c0c4fa49f22ee8771ed314e534aef03a13de6005a2524026772c2f9b50d509ca76ee9971f49e5c8d9ed1a4086a4e5b5521adaa552c41e7c08dd991a8818cd
6
+ metadata.gz: 68ec19cefd7a236623e7579a94d16d4bb30656e6ed4a4196aa7fc300c5f131982e88935936dd7d9b3891ea5fb75d02a57f88ebd1f29266a496aeea9aef5ceb10
7
+ data.tar.gz: 21bb4e4a62be4de59129dd50f4852905782f34abc97291b18ff94c7b246713d6974078ded5da1916be9e380f2a7003417b330ded65aba2be49a79bb7c5db71f0
data/.rubocop.yml CHANGED
@@ -9,3 +9,9 @@ LineLength:
9
9
 
10
10
  MethodLength:
11
11
  Enabled: false
12
+
13
+ CyclomaticComplexity:
14
+ Enabled: false
15
+
16
+ PerceivedComplexity:
17
+ Enabled: false
@@ -13,9 +13,9 @@ module GoodData
13
13
  def call(params)
14
14
  if params.key?('ads_client')
15
15
  puts "Setting up ADS connection to #{params['ads_client']['ads_id']}"
16
- fail "ADS middleware needs username either as part of ads_client spec or as a global 'GDC_USERNAME' parameter" unless params['ads_client']['username'] || params['GDC_USERNAME']
17
- fail "ADS middleware needs password either as part of ads_client spec or as a global 'GDC_PASSWORD' parameter" unless params['ads_client']['password'] || params['GDC_PASSWORD']
18
-
16
+ raise "ADS middleware needs username either as part of ads_client spec or as a global 'GDC_USERNAME' parameter" unless params['ads_client']['username'] || params['GDC_USERNAME']
17
+ raise "ADS middleware needs password either as part of ads_client spec or as a global 'GDC_PASSWORD' parameter" unless params['ads_client']['password'] || params['GDC_PASSWORD']
18
+
19
19
  ads = GoodData::Datawarehouse.new(params['ads_client']['username'] || params['GDC_USERNAME'], params['ads_client']['password'] || params['GDC_PASSWORD'], params['ads_client']['ads_id'])
20
20
  @app.call(params.merge('ads_client' => ads, :ads_client => ads))
21
21
  else
@@ -32,7 +32,13 @@ module GoodData
32
32
  project = client.projects(project_id)
33
33
  GoodData.project = project
34
34
  GoodData.logger = logger
35
- @app.call(params.merge('GDC_GD_CLIENT' => client, 'gdc_project' => project))
35
+ returning_value = @app.call(params.merge('GDC_GD_CLIENT' => client, 'gdc_project' => project))
36
+ begin
37
+ client.disconnect
38
+ rescue
39
+ puts 'Tried to disconnect. Was unsuccesfull. Proceeding anyway.'
40
+ end
41
+ returning_value
36
42
  end
37
43
  end
38
44
  end
@@ -6,6 +6,6 @@
6
6
 
7
7
  module GoodData
8
8
  module Bricks
9
- VERSION = '0.2.0'.freeze
9
+ VERSION = '0.3.0'.freeze
10
10
  end
11
11
  end
@@ -34,7 +34,7 @@ module GoodData
34
34
  when 's3'
35
35
  realize_s3(params)
36
36
  else
37
- fail "DataSource does not support type \"#{source}\""
37
+ raise "DataSource does not support type \"#{source}\""
38
38
  end
39
39
  end
40
40
 
@@ -47,7 +47,7 @@ module GoodData
47
47
  def realize_query(params)
48
48
  query = @options[:query]
49
49
  dwh = params['ads_client']
50
- fail "Data Source needs a client to ads to be able to query the storage but 'ads_client' is empty." unless dwh
50
+ raise "Data Source needs a client to ads to be able to query the storage but 'ads_client' is empty." unless dwh
51
51
  filename = Digest::SHA256.new.hexdigest(query)
52
52
  measure = Benchmark.measure do
53
53
  CSV.open(filename, 'w') do |csv|
@@ -94,11 +94,11 @@ module GoodData
94
94
 
95
95
  def realize_s3(params)
96
96
  s3_client = params['aws_client'] && params['aws_client']['s3_client']
97
- fail 'AWS client not present. Perhaps S3Middleware is missing in the brick definition?' if !s3_client || !s3_client.respond_to?(:buckets)
97
+ raise 'AWS client not present. Perhaps S3Middleware is missing in the brick definition?' if !s3_client || !s3_client.respond_to?(:buckets)
98
98
  bucket_name = @options[:bucket]
99
99
  key = @options[:key]
100
- fail "Key \"bucket\" is missing in S3 datasource" if bucket_name.blank?
101
- fail "Key \"key\" is missing in S3 datasource" if key.blank?
100
+ raise 'Key "bucket" is missing in S3 datasource' if bucket_name.blank?
101
+ raise 'Key "key" is missing in S3 datasource' if key.blank?
102
102
  puts "Realizing download from S3. Bucket #{bucket_name}, object with key #{key}."
103
103
  filename = Digest::SHA256.new.hexdigest(@options.to_json)
104
104
  bucket = s3_client.buckets[bucket_name]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata-bricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Svarovsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler