remi 0.2.13 → 0.2.14

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: dd17d3ba11bb21e77a71d959beb49e28dec5d8aa
4
- data.tar.gz: 8850daac31d5c0929f53edd85a9509d039f521fa
3
+ metadata.gz: 6434dd8f6eadd170a3e6b64a1c35ffd450277483
4
+ data.tar.gz: fb4edbdad9f5695ca24c5bae9c2fdab484788d4e
5
5
  SHA512:
6
- metadata.gz: 43cc5c4f041cb53d57249a40180b4601c17b7e2ccab7e83d86e37af2a90e490a9b6fee56fe1e7bb00219574772c1b0e498a4afe83182f8dfcb692fe4596fb7ae
7
- data.tar.gz: 0c671a7031b992c809ca4f91cb420f036fcdcc57ce4b95e9bee8d1272cdb4ed54b413cb2fc4c61b15af33162e624b60d48f4a3c89dac29ad19f7fd0a0fb4795f
6
+ metadata.gz: 2584bf727adb2b174c9296cd4b3bc7b7967b94c21a946097e2ed2bcd0946edffd61ddac2a2946c21da734d8e3f61c08263d9069195850a91fd39b53c6f7ebef9
7
+ data.tar.gz: 50a41704c02a33072c705c48adbc0ba4b0b9e2919331eb188f0861f3be04de7dbdf315a0a2a14759bbaaea8fb780e423460974d2d83458cb149e4ce4446cd5bf
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- remi (0.2.13)
4
+ remi (0.2.14)
5
5
  activesupport (~> 4.2)
6
6
  bond (~> 0.5)
7
7
  cucumber (~> 2.1)
@@ -44,7 +44,7 @@ Feature: This is a sample feature file.
44
44
  And the source file is delimited with a comma
45
45
  And the source file is encoded using "ISO-8859-1" format
46
46
  And the source file uses a double quote to quote embedded delimiters
47
- And the source file uses a preceeding double quote to escape an embedded quoting character
47
+ And the source file uses a preceding double quote to escape an embedded quoting character
48
48
  And the source file uses windows or unix line endings
49
49
  And the source file contains a header row
50
50
  And the source file contains at least the following headers in no particular order:
@@ -79,7 +79,7 @@ Given /^the source file uses a ([\w ]+) to quote embedded delimiters$/ do |quote
79
79
  expect(@brt.source.csv_options[:quote_char]).to eq Remi::BusinessRules.csv_opt_map[quote_char]
80
80
  end
81
81
 
82
- Given /^the source file uses a preceeding ([\w ]+) to escape an embedded quoting character$/ do |escape_char|
82
+ Given /^the source file uses a preceding ([\w ]+) to escape an embedded quoting character$/ do |escape_char|
83
83
  expect(@brt.source.csv_options[:quote_char]).to eq Remi::BusinessRules.csv_opt_map[escape_char]
84
84
  end
85
85
 
@@ -186,6 +186,14 @@ Then /^the target field '(.+)' is copied from the source field '(.+:.+)'$/ do |t
186
186
  expect(@brt.target.field.value).to eq (@brt.sources[source_name].fields[source_field_name].value)
187
187
  end
188
188
 
189
+ Then /^the target field '(.+)' is copied from the source field '([^:]+)'$/ do |target_field, source_field|
190
+ step "the target field '#{target_field}'"
191
+ step "the source field '#{source_field}'"
192
+
193
+ @brt.run_transforms
194
+ expect(@brt.target.field.value).to eq (@brt.source.fields[source_field].value)
195
+ end
196
+
189
197
  Then /^the target field is (?:set to the value|populated with) "([^"]*)"$/ do |value|
190
198
  @brt.run_transforms
191
199
  expect(@brt.target.field.value).to eq Remi::BusinessRules::ParseFormula.parse(value)
@@ -12,7 +12,9 @@ class SampleJob
12
12
  api: :bulk,
13
13
  fields: {
14
14
  :Id => {},
15
- :External_ID__c => {}
15
+ :External_ID__c => {},
16
+ :IsActive => { type: :boolean },
17
+ :CreatedDate => { type: :date, format: '%Y-%m-%d %H:%M:%S' }
16
18
  },
17
19
  query: <<-EOQ
18
20
  SELECT
@@ -7,7 +7,8 @@ class ParseDateJob
7
7
  define_param :if_blank, nil
8
8
  define_source :source_data, Remi::DataSource::DataFrame,
9
9
  fields: {
10
- :date_string => {}
10
+ :date_string => { type: :date, format: params[:format] },
11
+ :stubbed_date => { type: :date, format: params[:format] }
11
12
  }
12
13
  define_target :target_data, Remi::DataTarget::DataFrame
13
14
 
@@ -16,6 +17,9 @@ class ParseDateJob
16
17
  Remi::SourceToTargetMap.apply(source_data.df, target_data.df) do
17
18
  map source(:date_string) .target(:parsed_date)
18
19
  .transform(Remi::Transform[:parse_date].(format: params[:format], if_blank: params[:if_blank]))
20
+
21
+ map source(:stubbed_date) .target(:parsed_stubbed_date)
22
+ .transform(Remi::Transform[:parse_date].(format: params[:format], if_blank: params[:if_blank]))
19
23
  end
20
24
  end
21
25
  end
@@ -17,14 +17,15 @@ module Remi
17
17
  end
18
18
 
19
19
  def stub_values
20
- @stub_values ||= {
21
- nil => ->() { Faker::Hipster.word },
22
- string: ->() { Faker::Hipster.word },
23
- number: ->() { Faker::Number.decimal(4,4) },
24
- float: ->() { Faker::Number.decimal(2,2) },
25
- integer: ->() { Faker::Number.number(4) },
26
- date: ->() { Date.parse('2015-10-21') }
27
- }
20
+ @stub_values ||= Hash.new(->() { Faker::Hipster.word }).merge({
21
+ string: ->() { Faker::Hipster.word },
22
+ number: ->() { Faker::Number.decimal(4,4) },
23
+ float: ->() { Faker::Number.decimal(2,2) },
24
+ integer: ->() { Faker::Number.number(4) },
25
+ date: ->() { Faker::Date.backward(3650) },
26
+ datetime: ->() { Faker::Time.backward(3650) },
27
+ boolean: ->() { ['T','F'].shuffle.first }
28
+ })
28
29
  end
29
30
  end
30
31
 
@@ -83,7 +83,9 @@ module Remi
83
83
  def parse_date(format: '%Y-%m-%d', if_blank: nil)
84
84
  memoize_as_lambda(__method__, format, if_blank.try(:to_sym)) do |(mformat, mif_blank), larg|
85
85
  begin
86
- if larg.blank? then
86
+ if larg.respond_to?(:strftime)
87
+ larg
88
+ elsif larg.blank? then
87
89
  if mif_blank == :low
88
90
  Date.new(1900,01,01)
89
91
  elsif mif_blank == :high
@@ -1,3 +1,3 @@
1
1
  module Remi
2
- VERSION = '0.2.13'
2
+ VERSION = '0.2.14'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sterling Paramore