gd_bam 0.1.16 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/bam/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bam
2
- VERSION = '0.1.16'
2
+ VERSION = '0.1.17'
3
3
  end
data/lib/base/errors.rb CHANGED
@@ -11,5 +11,13 @@ module GoodData
11
11
  @field = options[:field]
12
12
  end
13
13
  end
14
+
15
+ class IdInTapNotPresentError < RuntimeError
16
+
17
+ def initialize(tap)
18
+ super("Every tap needs to have an output field Id defined. Tap \"#{tap[:id]}\" does not have one.")
19
+ end
20
+ end
21
+
14
22
  end
15
23
  end
data/lib/base/tap.rb CHANGED
@@ -140,16 +140,18 @@ module GoodData
140
140
  end
141
141
 
142
142
  def self.prepare_for_sf_downloader(tap)
143
- id_field = Tap.find_output_field(tap, "Id")
144
- time_field = Tap.find_output_field(tap, "Timestamp")
145
- tap = Tap.remove_acts_as(tap)
146
- fields = tap[:fields].map {|f| f[:name] == id_field[:name] ? f.merge(:acts_as => ["Id"]) : f}
147
- if time_field
148
- fields = fields.map {|f| f[:name] == time_field[:name] ? f.merge(:acts_as => ["Timestamp"]) : f}
149
- end
150
- Tap.create(tap.merge({
151
- :fields => fields
152
- }))
143
+ # begin
144
+ id_field = Tap.find_output_field(tap, "Id")
145
+ fail IdInTapNotPresentError.new(tap) if id_field.nil?
146
+ time_field = Tap.find_output_field(tap, "Timestamp")
147
+ tap = Tap.remove_acts_as(tap)
148
+ fields = tap[:fields].map {|f| f[:name] == id_field[:name] ? f.merge(:acts_as => ["Id"]) : f}
149
+ if time_field
150
+ fields = fields.map {|f| f[:name] == time_field[:name] ? f.merge(:acts_as => ["Timestamp"]) : f}
151
+ end
152
+ Tap.create(tap.merge({
153
+ :fields => fields
154
+ }))
153
155
  end
154
156
 
155
157
  def self.prepare_for_es_downloader(tap)
@@ -9,5 +9,5 @@ flow(:id => "<%= flow_name %>") do |f|
9
9
  end
10
10
  end
11
11
 
12
- sink(:id => "user")
12
+ sink(:id => "owner_dim")
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gd_bam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-24 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake