go_import 3.0.39 → 3.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/go-import +23 -8
- data/lib/go_import.rb +1 -0
- data/lib/go_import/shard_helper.rb +96 -0
- data/sources/VISMA/.go_import/runner.rb +1 -0
- data/sources/csv/.go_import/runner.rb +8 -6
- data/sources/csv/converter.rb +8 -1
- data/sources/excel-basic/.go_import/runner.rb +1 -0
- data/sources/excel-basic/converter.rb +8 -1
- data/sources/excel/.go_import/runner.rb +1 -0
- data/sources/excel/converter.rb +11 -0
- data/sources/lime-easy/converter.rb +28 -21
- data/sources/lime-pro-basic/.go_import/runner.rb +1 -0
- data/sources/salesforce/.go_import/runner.rb +2 -0
- data/spec/helpers/shard_helper_spec.rb +121 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59427aef6763d25193bcb19a34b834207e0a1afa
|
4
|
+
data.tar.gz: 171379596422ffb7b8bf31d2d071ebb05682db26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8e6aa91dec72dbffe0bcf9d430b78a51c28208c60758a3dd85f959dce032b50d7f0f95402c4996eec20cace636173d7010a23909df1008c03ee983a9c33cfaf
|
7
|
+
data.tar.gz: f3d1e0faa54a918fce9136b5247f8af2dd6d9d6b06dffb895d9d3550d87cc24a9ba92a069f59f7b7e9ce125a5ccf3959dd468f5cb94b741b9a8cb264469fcc9f
|
data/bin/go-import
CHANGED
@@ -67,6 +67,10 @@ class GoImportCommandLine < Thor
|
|
67
67
|
:desc => "Name of the file to put imported documents in (default in same as --output)",
|
68
68
|
:type => :string,
|
69
69
|
:required => false)
|
70
|
+
option(:shard_size,
|
71
|
+
:desc => "Large imports are sharded into several zip-files. This property sets how many objects each zip-file should contain. Default is 25 000",
|
72
|
+
:type => :numeric,
|
73
|
+
:required => false)
|
70
74
|
def run_import()
|
71
75
|
if !options.log_to_file.nil?
|
72
76
|
$stdout = File.new(options.log_to_file == "log_to_file" ? "go-import.log" : options.log_to_file, 'w')
|
@@ -99,14 +103,25 @@ class GoImportCommandLine < Thor
|
|
99
103
|
log_and_remove_invalid_files model, max_file_size
|
100
104
|
end
|
101
105
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
puts "Starting sharding of model..."
|
107
|
+
sharder = GoImport::ShardHelper.new(options.shard_size)
|
108
|
+
models_to_serialize = sharder.shard_model(model)
|
109
|
+
|
110
|
+
if models_to_serialize.length > 1
|
111
|
+
puts "Import is large and will be broken into #{models_to_serialize.length} files"
|
112
|
+
end
|
113
|
+
|
114
|
+
models_to_serialize.each_with_index do |model, i|
|
115
|
+
go_data_zip = options.output.nil? == true ? "go" : options.output
|
116
|
+
go_data_zip += "_#{i}.zip"
|
117
|
+
go_files = options.output_documents.nil? == true ? nil : ::File.basename(options.output_documents,File.extname(options.output_documents))
|
118
|
+
model.save_to_zip(go_data_zip, go_files)
|
119
|
+
puts "Source has been been converted into '#{go_data_zip}'."
|
120
|
+
puts " - and files into '#{go_files}.zip'." if !go_files.nil?
|
121
|
+
if !warnings_msg.empty?
|
122
|
+
puts "WARNINGS: "
|
123
|
+
puts warnings_msg
|
124
|
+
end
|
110
125
|
end
|
111
126
|
else
|
112
127
|
puts "ERROR: Source could not be converted due to:"
|
data/lib/go_import.rb
CHANGED
@@ -0,0 +1,96 @@
|
|
1
|
+
module GoImport
|
2
|
+
class ShardHelper
|
3
|
+
|
4
|
+
attr_accessor :shards, :current_shard_count, :current_shard
|
5
|
+
|
6
|
+
def initialize(shard_size = nil)
|
7
|
+
@shard_size = shard_size || 25000
|
8
|
+
setup()
|
9
|
+
end
|
10
|
+
|
11
|
+
def shard_model(model)
|
12
|
+
@current_shard.configuration = model.configuration
|
13
|
+
|
14
|
+
model.coworkers.each{ |key, coworker|
|
15
|
+
if coworker.integration_id != "import"
|
16
|
+
add_coworker(coworker)
|
17
|
+
end
|
18
|
+
}
|
19
|
+
model.organizations.each{|key, org| add_organization(org)}
|
20
|
+
model.deals.each{|key, deal| add_deal(deal)}
|
21
|
+
model.notes.each{|key, note| add_note(note)}
|
22
|
+
add_documents(model.documents)
|
23
|
+
|
24
|
+
return_value = @shards
|
25
|
+
setup()
|
26
|
+
return return_value
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def setup()
|
31
|
+
@current_shard = GoImport::RootModel.new
|
32
|
+
@shards = [@current_shard]
|
33
|
+
@current_shard_count = 0
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def add_note(note)
|
38
|
+
check_or_create_new_chard()
|
39
|
+
@current_shard.add_note(note)
|
40
|
+
@current_shard_count += 1
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def add_deal(deal)
|
45
|
+
check_or_create_new_chard()
|
46
|
+
@current_shard.add_deal(deal)
|
47
|
+
@current_shard_count += 1
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def add_coworker(coworker)
|
52
|
+
check_or_create_new_chard()
|
53
|
+
@current_shard.add_coworker(coworker)
|
54
|
+
@current_shard_count += 1
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
def add_organization(org)
|
59
|
+
check_or_create_new_chard()
|
60
|
+
if org.employees != nil
|
61
|
+
@current_shard_count += org.employees.length
|
62
|
+
end
|
63
|
+
@current_shard.add_organization(org)
|
64
|
+
@current_shard_count += 1
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
def add_documents(doc)
|
69
|
+
doc.files.each{|file| add_file(file)}
|
70
|
+
doc.links.each{|link| add_link(link)}
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
def add_file(file)
|
75
|
+
check_or_create_new_chard()
|
76
|
+
@current_shard.add_file(file)
|
77
|
+
@current_shard_count += 1
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
def add_link(link)
|
82
|
+
check_or_create_new_chard()
|
83
|
+
@current_shard.add_link(link)
|
84
|
+
@current_shard_count += 1
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
def check_or_create_new_chard()
|
89
|
+
if @current_shard_count > @shard_size
|
90
|
+
@current_shard = GoImport::RootModel.new
|
91
|
+
@shards.push(@current_shard)
|
92
|
+
@current_shard_count = 0
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -39,6 +39,7 @@ def convert_source
|
|
39
39
|
if not row["NAMN"] == ""
|
40
40
|
organization = converter.to_organization(row, rootmodel)
|
41
41
|
rootmodel.add_organization(organization)
|
42
|
+
converter.organization_hook(row, organization, rootmodel) if defined? converter.organization_hook
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -4,8 +4,8 @@ require_relative("../converter")
|
|
4
4
|
|
5
5
|
# COWORKER_FILE and other file names should be defined ../converter.rb
|
6
6
|
|
7
|
-
def process_rows(file_name)
|
8
|
-
data = File.
|
7
|
+
def process_rows(file_name, source_encoding)
|
8
|
+
data = File.read(file_name, :encoding => source_encoding)
|
9
9
|
rows = GoImport::CsvHelper::text_to_hashes(data)
|
10
10
|
rows.each do |row|
|
11
11
|
yield row
|
@@ -22,28 +22,30 @@ def convert_source
|
|
22
22
|
rootmodel = GoImport::RootModel.new
|
23
23
|
|
24
24
|
converter.configure(rootmodel)
|
25
|
+
source_encoding = defined?(SOURCE_ENCODING) ? SOURCE_ENCODING : 'ISO-8859-1'
|
25
26
|
|
26
27
|
# coworkers
|
27
28
|
# start with these since they are referenced
|
28
29
|
# from everywhere....
|
29
30
|
if defined?(COWORKER_FILE) && !COWORKER_FILE.nil? && !COWORKER_FILE.empty?
|
30
|
-
process_rows
|
31
|
+
process_rows(COWORKER_FILE, source_encoding) do |row|
|
31
32
|
rootmodel.add_coworker(converter.to_coworker(row))
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
36
|
# organizations
|
36
37
|
if defined?(ORGANIZATION_FILE) && !ORGANIZATION_FILE.nil? && !ORGANIZATION_FILE.empty?
|
37
|
-
process_rows
|
38
|
+
process_rows(ORGANIZATION_FILE, source_encoding) do |row|
|
38
39
|
organization = converter.to_organization(row, rootmodel)
|
39
40
|
rootmodel.add_organization(organization)
|
41
|
+
converter.organization_hook(row, organization, rootmodel) if defined? converter.organization_hook
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
45
|
# persons
|
44
46
|
# depends on organizations
|
45
47
|
if defined?(PERSON_FILE) && !PERSON_FILE.nil? && !PERSON_FILE.empty?
|
46
|
-
process_rows
|
48
|
+
process_rows(PERSON_FILE, source_encoding) do |row|
|
47
49
|
# adds it self to the employer
|
48
50
|
converter.to_person(row, rootmodel)
|
49
51
|
end
|
@@ -53,7 +55,7 @@ def convert_source
|
|
53
55
|
# deals can reference coworkers (responsible), organizations
|
54
56
|
# and persons (contact)
|
55
57
|
if defined?(DEAL_FILE) && !DEAL_FILE.nil? && !DEAL_FILE.empty?
|
56
|
-
process_rows
|
58
|
+
process_rows(DEAL_FILE, source_encoding) do |row|
|
57
59
|
rootmodel.add_deal(converter.to_deal(row, rootmodel))
|
58
60
|
end
|
59
61
|
end
|
data/sources/csv/converter.rb
CHANGED
@@ -12,9 +12,16 @@ COWORKER_FILE = "data/coworkers.csv"
|
|
12
12
|
ORGANIZATION_FILE = "data/organizations.csv"
|
13
13
|
PERSON_FILE = "data/persons.csv"
|
14
14
|
DEAL_FILE = "data/deals.csv"
|
15
|
-
|
16
15
|
# Ie if you dont want to import deals, set DEAL_FILE = ""
|
17
16
|
|
17
|
+
# Default encoding for files are 'ISO-8859-1' (aka latin1)
|
18
|
+
# If the file is in any other encoding this must be specified with
|
19
|
+
# SOURCE_ENCODING set to correct value
|
20
|
+
# Ruby can handle lots of encodings, but common ones are:
|
21
|
+
# SOURCE_ENCODING = "UTF-8"
|
22
|
+
# SOURCE_ENCODING = "bom|UTF-8"
|
23
|
+
# SOURCE_ENCODING = "UTF-16"
|
24
|
+
|
18
25
|
# If you are importing files then you must set the FILES_FOLDER
|
19
26
|
# constant. FILES_FOLDER should point to the folder where the files
|
20
27
|
# are stored. FILES_FOLDER can be relative to the project directory
|
@@ -35,6 +35,7 @@ def convert_source
|
|
35
35
|
if defined?(ORGANIZATION_SHEET)
|
36
36
|
if excel_workbook.has_sheet?(ORGANIZATION_SHEET)
|
37
37
|
organization_rows = excel_workbook.rows_for_sheet ORGANIZATION_SHEET
|
38
|
+
converter.organization_hook(row, organization, rootmodel) if defined? converter.organization_hook
|
38
39
|
else
|
39
40
|
puts "WARNING: can't find sheet '#{ORGANIZATION_SHEET}'"
|
40
41
|
end
|
@@ -30,10 +30,17 @@ class Converter
|
|
30
30
|
# are :String and :Link. If no type is specified :String is
|
31
31
|
# used as default.
|
32
32
|
|
33
|
+
# Organizastion
|
33
34
|
# rootmodel.settings.with_organization do |organization|
|
34
35
|
# organization.set_custom_field( { :integration_id => 'source', :title => 'Källa', :type => :Link } )
|
35
36
|
# end
|
36
|
-
|
37
|
+
|
38
|
+
#Person
|
39
|
+
#rootmodel.settings.with_person do |person|
|
40
|
+
# person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe Size', :type => :String} )
|
41
|
+
#end
|
42
|
+
|
43
|
+
end
|
37
44
|
|
38
45
|
def import_person_to_organization(row, rootmodel)
|
39
46
|
person = to_person(row, rootmodel)
|
@@ -36,6 +36,7 @@ def convert_source
|
|
36
36
|
if defined?(ORGANIZATION_SHEET)
|
37
37
|
if excel_workbook.has_sheet?(ORGANIZATION_SHEET)
|
38
38
|
organization_rows = excel_workbook.rows_for_sheet ORGANIZATION_SHEET
|
39
|
+
converter.organization_hook(row, organization, rootmodel) if defined? converter.organization_hook
|
39
40
|
else
|
40
41
|
puts "WARNING: can't find sheet '#{ORGANIZATION_SHEET}'"
|
41
42
|
end
|
data/sources/excel/converter.rb
CHANGED
@@ -51,6 +51,17 @@ class Converter
|
|
51
51
|
# rootmodel.settings.with_organization do |organization|
|
52
52
|
# organization.set_custom_field( { :integration_id => 'source', :title => 'Källa', :type => :Link } )
|
53
53
|
# end
|
54
|
+
|
55
|
+
# rootmodel.settings.with_person do |person|
|
56
|
+
# person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
|
57
|
+
# end
|
58
|
+
|
59
|
+
# rootmodel.settings.with_deal do |deal|
|
60
|
+
# assessment is default DealState::NoEndState
|
61
|
+
# deal.add_status( {:label => '1. Kvalificering' })
|
62
|
+
# deal.add_status( {:label => '2. Deal closed', :assessment => GoImport::DealState::PositiveEndState })
|
63
|
+
# deal.add_status( {:label => '4. Deal lost', :assessment => GoImport::DealState::NegativeEndState })
|
64
|
+
# end
|
54
65
|
end
|
55
66
|
|
56
67
|
def import_person_to_organization(row, rootmodel)
|
@@ -67,14 +67,39 @@ FILES_FOLDER_AT_CUSTOMER = "m:\\documents\\"
|
|
67
67
|
class Converter
|
68
68
|
# Reads a row from the Easy exported Company.txt
|
69
69
|
# and ads custom fields to the go_import organization.
|
70
|
-
|
71
|
-
# NOTE!!! You should customize this method to include
|
70
|
+
# NOTE!!! You should customize this method to include
|
72
71
|
# and transform the fields you want to import to LIME Go.
|
73
72
|
# The method includes examples of different types of
|
74
73
|
# fields and how you should handle them.
|
75
74
|
# Sometimes it's enough to uncomment some code and
|
76
75
|
# change the row name but in most cases you need to
|
77
76
|
# do some thinking of your own.
|
77
|
+
|
78
|
+
def configure(rootmodel)
|
79
|
+
#####################################################################
|
80
|
+
## LIME Go custom fields.
|
81
|
+
# This is how you add a custom field in LIME Go.
|
82
|
+
# Custom fields can be added to organization, deal and person.
|
83
|
+
# Valid types are :String and :Link. If no type is specified
|
84
|
+
# :String is used as default.
|
85
|
+
|
86
|
+
#rootmodel.settings.with_organization do |organization|
|
87
|
+
#organization.set_custom_field( { :integration_id => 'building_size', :title => 'Building Size', :type => :String } )
|
88
|
+
#end
|
89
|
+
|
90
|
+
# rootmodel.settings.with_person do |person|
|
91
|
+
# person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
|
92
|
+
# end
|
93
|
+
|
94
|
+
# rootmodel.settings.with_deal do |deal|
|
95
|
+
# assessment is default DealState::NoEndState
|
96
|
+
# deal.add_status( {:label => '1. Kvalificering' })
|
97
|
+
# deal.add_status( {:label => '2. Deal closed', :assessment => GoImport::DealState::PositiveEndState })
|
98
|
+
# deal.add_status( {:label => '4. Deal lost', :assessment => GoImport::DealState::NegativeEndState })
|
99
|
+
# end
|
100
|
+
end
|
101
|
+
|
102
|
+
|
78
103
|
def to_organization(organization, row)
|
79
104
|
# Here are some standard fields that are present
|
80
105
|
# on a LIME Go organization and are usually represented
|
@@ -315,25 +340,7 @@ class Converter
|
|
315
340
|
# return classification
|
316
341
|
end
|
317
342
|
|
318
|
-
|
319
|
-
#####################################################################
|
320
|
-
## LIME Go custom fields.
|
321
|
-
# This is how you add a custom field in LIME Go.
|
322
|
-
# Custom fields can be added to organization, deal and person.
|
323
|
-
# Valid types are :String and :Link. If no type is specified
|
324
|
-
# :String is used as default.
|
325
|
-
|
326
|
-
# rootmodel.settings.with_person do |person|
|
327
|
-
# person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
|
328
|
-
# end
|
329
|
-
|
330
|
-
# rootmodel.settings.with_deal do |deal|
|
331
|
-
# assessment is default DealState::NoEndState
|
332
|
-
# deal.add_status( {:label => '1. Kvalificering' })
|
333
|
-
# deal.add_status( {:label => '2. Deal closed', :assessment => GoImport::DealState::PositiveEndState })
|
334
|
-
# deal.add_status( {:label => '4. Deal lost', :assessment => GoImport::DealState::NegativeEndState })
|
335
|
-
# end
|
336
|
-
end
|
343
|
+
|
337
344
|
|
338
345
|
# HOOKS
|
339
346
|
#
|
@@ -108,6 +108,7 @@ def convert_source
|
|
108
108
|
con.fetch_data "company" do |row|
|
109
109
|
organization = init_organization(row, con.get_class_by_name('company'), rootmodel)
|
110
110
|
rootmodel.add_organization(converter.to_organization(organization, row))
|
111
|
+
converter.organization_hook(row, organization, rootmodel) if defined? converter.organization_hook
|
111
112
|
end
|
112
113
|
|
113
114
|
# persons
|
@@ -115,6 +115,8 @@ def account_to_organization(row, rootmodel)
|
|
115
115
|
|
116
116
|
organization.responsible_coworker =
|
117
117
|
rootmodel.find_coworker_by_integration_id(row['OwnerId'])
|
118
|
+
|
119
|
+
converter.organization_hook(row, organization, rootmodel) if defined? converter.organization_hook
|
118
120
|
|
119
121
|
return organization
|
120
122
|
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'go_import'
|
3
|
+
|
4
|
+
describe GoImport::ShardHelper do
|
5
|
+
it "should shard 50 objects of a single type into two shards" do
|
6
|
+
# given
|
7
|
+
model = GoImport::RootModel.new
|
8
|
+
|
9
|
+
(1..50).each do |n|
|
10
|
+
organization = GoImport::Organization.new
|
11
|
+
organization.name = "Ankeborgs bibliotek"
|
12
|
+
organization.integration_id = n.to_s
|
13
|
+
model.add_organization(organization)
|
14
|
+
end
|
15
|
+
|
16
|
+
sharder = GoImport::ShardHelper.new(25)
|
17
|
+
|
18
|
+
# when, the
|
19
|
+
sharder.shard_model(model).length.should eq 2
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should shard 60 objects of different type into three shards" do
|
23
|
+
# given
|
24
|
+
model = GoImport::RootModel.new
|
25
|
+
|
26
|
+
(1..10).each do |n|
|
27
|
+
organization = GoImport::Organization.new
|
28
|
+
organization.name = "Ankeborgs bibliotek"
|
29
|
+
organization.integration_id = n.to_s
|
30
|
+
|
31
|
+
person = GoImport::Person.new
|
32
|
+
person.first_name = "Kalle"
|
33
|
+
person.last_name = "Kula"
|
34
|
+
organization.add_employee(person)
|
35
|
+
|
36
|
+
person = GoImport::Person.new
|
37
|
+
person.first_name = "Nisse"
|
38
|
+
person.last_name = "Nice"
|
39
|
+
organization.add_employee(person)
|
40
|
+
|
41
|
+
model.add_organization(organization)
|
42
|
+
end
|
43
|
+
|
44
|
+
(1..10).each do |n|
|
45
|
+
deal = GoImport::Deal.new
|
46
|
+
deal.name = "Big deal"
|
47
|
+
deal.integration_id = n.to_s
|
48
|
+
model.add_deal(deal)
|
49
|
+
end
|
50
|
+
|
51
|
+
(1..10).each do |n|
|
52
|
+
note = GoImport::Note.new
|
53
|
+
note.text = "Important note"
|
54
|
+
model.add_note(note)
|
55
|
+
end
|
56
|
+
|
57
|
+
(1..10).each do |n|
|
58
|
+
link = GoImport::Link.new
|
59
|
+
link.url = "https://go.lime-go.com"
|
60
|
+
link.name = "Our url"
|
61
|
+
model.add_link(link)
|
62
|
+
end
|
63
|
+
|
64
|
+
sharder = GoImport::ShardHelper.new(20)
|
65
|
+
|
66
|
+
# when, then
|
67
|
+
sharder.shard_model(model).length.should eq 3
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should be able to change the shard size" do
|
71
|
+
# given
|
72
|
+
model = GoImport::RootModel.new
|
73
|
+
|
74
|
+
(1..20).each do |n|
|
75
|
+
organization = GoImport::Organization.new
|
76
|
+
organization.name = "Ankeborgs bibliotek"
|
77
|
+
organization.integration_id = n.to_s
|
78
|
+
model.add_organization(organization)
|
79
|
+
end
|
80
|
+
|
81
|
+
sharder = GoImport::ShardHelper.new(5)
|
82
|
+
|
83
|
+
# when, then
|
84
|
+
sharder.shard_model(model).length.should eq 4
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should add an organization into a shard" do
|
88
|
+
# given
|
89
|
+
|
90
|
+
model = GoImport::RootModel.new
|
91
|
+
|
92
|
+
organization = GoImport::Organization.new
|
93
|
+
organization.name = "Ankeborgs bibliotek"
|
94
|
+
organization.integration_id = "123"
|
95
|
+
|
96
|
+
sharder = GoImport::ShardHelper.new()
|
97
|
+
model.add_organization(organization)
|
98
|
+
|
99
|
+
# when, then
|
100
|
+
sharder.shard_model(model)[0].find_organization_by_integration_id("123").should eq organization
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should add a deal into a shard" do
|
104
|
+
# given
|
105
|
+
|
106
|
+
model = GoImport::RootModel.new
|
107
|
+
|
108
|
+
deal = GoImport::Deal.new
|
109
|
+
deal.name = "Big deal"
|
110
|
+
deal.integration_id = "123"
|
111
|
+
|
112
|
+
sharder = GoImport::ShardHelper.new()
|
113
|
+
model.add_deal(deal)
|
114
|
+
|
115
|
+
# when, then
|
116
|
+
sharder.shard_model(model)[0].find_deal_by_integration_id("123").should eq deal
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petter Sandholdt
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-
|
15
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: iso_country_codes
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- lib/go_import/phone_helper.rb
|
212
212
|
- lib/go_import/roo_helper.rb
|
213
213
|
- lib/go_import/serialize_helper.rb
|
214
|
+
- lib/go_import/shard_helper.rb
|
214
215
|
- lib/go_import/source.rb
|
215
216
|
- lib/go_import/templating.rb
|
216
217
|
- sources/VISMA/.gitignore
|
@@ -288,6 +289,7 @@ files:
|
|
288
289
|
- spec/helpers/phone_helper_spec.rb
|
289
290
|
- spec/helpers/roo_helper_spec.rb
|
290
291
|
- spec/helpers/serialize_helper_spec.rb
|
292
|
+
- spec/helpers/shard_helper_spec.rb
|
291
293
|
- spec/helpers/xsd_validate_spec.rb
|
292
294
|
- spec/link_spec.rb
|
293
295
|
- spec/note_spec.rb
|
@@ -333,6 +335,7 @@ test_files:
|
|
333
335
|
- spec/helpers/phone_helper_spec.rb
|
334
336
|
- spec/helpers/roo_helper_spec.rb
|
335
337
|
- spec/helpers/serialize_helper_spec.rb
|
338
|
+
- spec/helpers/shard_helper_spec.rb
|
336
339
|
- spec/helpers/xsd_validate_spec.rb
|
337
340
|
- spec/link_spec.rb
|
338
341
|
- spec/note_spec.rb
|