go_import 4.0.0 → 4.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b80d03092ece9f1cc8f8194de2e009fea1ec57f9
4
- data.tar.gz: cb272c0880e52b47b935320a45d452c94e5f3df3
3
+ metadata.gz: 507063cbf423a43ae9e1ba8ebacb9fd83c3d6527
4
+ data.tar.gz: b58ced3f91d1be73757433c5f73f23e6fed9ae69
5
5
  SHA512:
6
- metadata.gz: 6b83c3c678daca732107052641e35d2c3bc2b393465b127d281d9513516d1b1135d82bfa6fe14b7930a7e1a0e426e89b3ccfb8d48d0aaf3a9d7e09aa90ffd28b
7
- data.tar.gz: 5ed9dfd6b376bdfc28985076afe05240a9631d2a0c9bbabfba66525deab6b82802af1f380448c098c725b7848890e61860c40104799c5a0a330b22e596bfe14e
6
+ metadata.gz: b23399243c9378cc42e7b802034a2a45f771f0fe764b1b52184756367f998e58345f9cae1f05ee935389b6c621f9b71fe835503aea33bfb8773ae02f21927603
7
+ data.tar.gz: cfd4216cb1097f01f40020f2daa3ab0fd789da348ba805151b5396ba385aa18b9e9b33cae5e018eeb9688bf6d1eefe06a7d90c536d78dde28a8f0bc4be2d5d5a
@@ -4,6 +4,8 @@ module GoImport
4
4
  Dir.glob(::File.join(::File.dirname(::File.absolute_path(__FILE__)),folder), &method(:require))
5
5
  end
6
6
 
7
+ warn "[DEPRECATION] This gem has been renamed to 'move-to-go' and will no longer be supported. Please switch to 'move-to-go' as soon as possible.\n\n"
8
+
7
9
  require_relative 'go_import/errors'
8
10
  require_relative 'go_import/serialize_helper'
9
11
  require_relative 'go_import/model_helpers'
@@ -0,0 +1,10 @@
1
+ require_relative 'history'
2
+ module GoImport
3
+ class ClientVisit < History
4
+ def initialize(opt = nil)
5
+ super(opt)
6
+
7
+ @classification = HistoryClassification::ClientVisit
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'history'
2
+ module GoImport
3
+ class Comment < History
4
+ def initialize(opt = nil)
5
+ super(opt)
6
+
7
+ @classification = HistoryClassification::Comment
8
+ end
9
+ end
10
+ end
@@ -171,16 +171,66 @@ module GoImport
171
171
  end
172
172
  end
173
173
 
174
+ def add_sales_call(sales_call)
175
+ if sales_call.nil?
176
+ return nil
177
+ end
178
+ if !sales_call.is_a?(SalesCall)
179
+ raise ArgumentError.new("Expected a SalesCall")
180
+ end
181
+ add_history(sales_call)
182
+ end
183
+
184
+ def add_comment(comment)
185
+ if comment.nil?
186
+ return nil
187
+ end
188
+ if !comment.is_a?(Comment)
189
+ raise ArgumentError.new("Expected a Comment")
190
+ end
191
+ add_history(comment)
192
+ end
193
+
194
+ def add_talked_to(talked_to)
195
+ if talked_to.nil?
196
+ return nil
197
+ end
198
+ if !talked_to.is_a?(TalkedTo)
199
+ raise ArgumentError.new("Expected a TalkedTo")
200
+ end
201
+ add_history(talked_to)
202
+ end
203
+
204
+ def add_tried_to_reach(tried_to_reach)
205
+ if tried_to_reach.nil?
206
+ return nil
207
+ end
208
+ if !tried_to_reach.is_a?(TriedToReach)
209
+ raise ArgumentError.new("Expected a TriedToReach")
210
+ end
211
+ add_history(tried_to_reach)
212
+ end
213
+
214
+ def add_client_visit(client_visit)
215
+ if client_visit.nil?
216
+ return nil
217
+ end
218
+ if !client_visit.is_a?(ClientVisit)
219
+ raise ArgumentError.new("Expected a ClientVisit")
220
+ end
221
+ add_history(client_visit)
222
+ end
223
+
174
224
  # Adds the specifed history object to the model.
175
225
  #
176
226
  # If no integration_id has been specifed go-import generate
177
227
  # one.
178
228
  #
179
- # @example Add a history from a new history
180
- # history = GoImport::History.new
181
- # history.integration_id = "123"
182
- # history.text = "This is a history"
183
- # rootmodel.add_history(history)
229
+ # @example Add a comment from a new comment
230
+ # comment = GoImport::Comment.new
231
+ # comment.integration_id = "123"
232
+ # comment.text = "This is a history"
233
+ # rootmodel.add_comment(comment)
184
234
  def add_history(history)
185
235
  if history.nil?
186
236
  return nil
@@ -561,7 +611,7 @@ module GoImport
561
611
  " Organizations: #{@organizations.length}\n" \
562
612
  " Persons: #{persons.length}\n" \
563
613
  " Deals: #{@deals.length}\n" \
564
- " Histories: #{@histories.length}\n" \
614
+ " History logs: #{@histories.length}\n" \
565
615
  " Documents: #{nbr_of_documents}"
566
616
  end
567
617
 
@@ -0,0 +1,10 @@
1
+ require_relative 'history'
2
+ module GoImport
3
+ class SalesCall < History
4
+ def initialize(opt = nil)
5
+ super(opt)
6
+
7
+ @classification = HistoryClassification::SalesCall
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'history'
2
+ module GoImport
3
+ class TalkedTo < History
4
+ def initialize(opt = nil)
5
+ super(opt)
6
+
7
+ @classification = HistoryClassification::TalkedTo
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require_relative 'history'
2
+ module GoImport
3
+ class TriedToReach < History
4
+ def initialize(opt = nil)
5
+ super(opt)
6
+
7
+ @classification = HistoryClassification::TriedToReach
8
+ end
9
+ end
10
+ end
@@ -67,7 +67,17 @@ def convert_source
67
67
  organization_rows.each do |row|
68
68
  if not row.nil?
69
69
  if row['ANTECK_1'].length > 0
70
- rootmodel.add_history(converter.to_history(row))
70
+
71
+ comment = GoImport::Comment.new()
72
+
73
+ organization = rootmodel.find_organization_by_integration_id(row['KUNDNR'])
74
+ unless organization.nil?
75
+ comment.organization = organization
76
+ end
77
+ comment.created_by = rootmodel.import_coworker
78
+ comment.text = row['ANTECK_1']
79
+
80
+ rootmodel.add_history(comment)
71
81
  imported_history_count = imported_history_count + 1
72
82
  end
73
83
  end
@@ -85,22 +85,6 @@ class Converter
85
85
  return organization
86
86
  end
87
87
 
88
- def to_history(row, rootmodel)
89
- history = GoImport::History.new()
90
-
91
- # *** TODO:
92
- #
93
- # Set history properties from the row.
94
- organization = rootmodel.find_organization_by_integration_id(row['KUNDNR'])
95
- unless organization.nil?
96
- history.organization = organization
97
- end
98
- history.created_by = rootmodel.import_coworker
99
- history.text = row['ANTECK_1']
100
-
101
- return history
102
- end
103
-
104
88
  def to_person(row, rootmodel)
105
89
  person = GoImport::Person.new()
106
90
 
@@ -121,15 +105,15 @@ class Converter
121
105
  # HOOKS
122
106
  #
123
107
  # Sometimes you need to add exra information to the rootmodel, this can be done
124
- # with hooks, below is an example of an organization hook that adds a history to
108
+ # with hooks, below is an example of an organization hook that adds a comment to
125
109
  # an organization if a field has a specific value
126
110
  #def organization_hook(row, organization, rootmodel)
127
111
  # if not row['fieldname'].empty?
128
- # history = GoImport::History.new
129
- # history.text = row['fieldname']
130
- # history.organization = organization
131
- # history.created_by = rootmodel.import_coworker
132
- # rootmodel.add_history(history)
112
+ # comment = GoImport::Comment.new
113
+ # comment.text = row['fieldname']
114
+ # comment.organization = organization
115
+ # comment.created_by = rootmodel.import_coworker
116
+ # rootmodel.add_history(comment)
133
117
  # end
134
118
  #end
135
119
 
@@ -39,12 +39,12 @@ def convert_source
39
39
  # from everywhere....
40
40
  if defined?(COWORKER_FILE) && !COWORKER_FILE.nil? && !COWORKER_FILE.empty?
41
41
  process_rows(COWORKER_FILE, source_encoding) do |row|
42
- coworker = converter.to_coworker(row)
43
- coworker.integration_id = "#{row['first_name']} #{row['last_name']}"
44
- coworker.first_name = row['first_name']
45
- coworker.last_name = row['last_name']
46
- coworker.email = row['email']
47
- rootmodel.add_coworker(coworker)
42
+ coworker = converter.to_coworker(row)
43
+ coworker.integration_id = "#{row['first_name']} #{row['last_name']}"
44
+ coworker.first_name = row['first_name']
45
+ coworker.last_name = row['last_name']
46
+ coworker.email = row['email']
47
+ rootmodel.add_coworker(coworker)
48
48
  end
49
49
  end
50
50
 
@@ -55,7 +55,7 @@ def convert_source
55
55
  organization = converter.to_organization(row, rootmodel)
56
56
  organization = GoImport::Organization.new
57
57
  organization.integration_id = row['id']
58
- organization.name = row['name']
58
+ organization.name = row['name']
59
59
  organization.email = row['email']
60
60
  organization.web_site = row['website']
61
61
  organization.central_phone_number = GoImport::PhoneHelper.parse_numbers(row['phone']) if not row['phone'].nil?
@@ -67,33 +67,33 @@ def convert_source
67
67
  end
68
68
 
69
69
  organization.with_postal_address do |address|
70
- address.street = row['address']
71
- address.zip_code = row['zip']
72
- address.city = row['city']
70
+ address.street = row['address']
71
+ address.zip_code = row['zip']
72
+ address.city = row['city']
73
73
  end
74
74
 
75
75
  case row['prospect_status']
76
76
  when "current"
77
- organization.relation = GoImport::Relation::WorkingOnIt
77
+ organization.relation = GoImport::Relation::WorkingOnIt
78
78
  else
79
- organization.relation = GoImport::Relation::BeenInTouch
79
+ organization.relation = GoImport::Relation::BeenInTouch
80
80
  end
81
81
 
82
82
  case row['customer_status']
83
83
  when "current"
84
- organization.relation = GoImport::Relation::IsACustomer
84
+ organization.relation = GoImport::Relation::IsACustomer
85
85
  when "past"
86
- organization.relation = GoImport::Relation::WasACustomer
86
+ organization.relation = GoImport::Relation::WasACustomer
87
87
  else
88
- organization.relation = GoImport::Relation::BeenInTouch
88
+ organization.relation = GoImport::Relation::BeenInTouch
89
89
  end
90
90
 
91
91
  coworker = rootmodel.find_coworker_by_integration_id row['owner']
92
92
  organization.responsible_coworker = coworker
93
- tags = row['tags'].split(",")
94
- tags.each do |tag|
95
- organization.set_tag(tag)
96
- end
93
+ tags = row['tags'].split(",")
94
+ tags.each do |tag|
95
+ organization.set_tag(tag)
96
+ end
97
97
 
98
98
  rootmodel.add_organization(organization)
99
99
  end
@@ -117,20 +117,20 @@ def convert_source
117
117
  person.email = row['email']
118
118
 
119
119
  organization = rootmodel.find_organization {|org|
120
- org.name == row["organisation_name"]
121
- }
120
+ org.name == row["organisation_name"]
121
+ }
122
122
  if not organization.nil?
123
- organization.add_employee(person)
123
+ organization.add_employee(person)
124
124
  else
125
- puts "No organization for person '#{person.first_name} #{person.last_name}, #{person.integration_id}' could be found. Person will not be imported!"
126
- ignored_persons += 1
125
+ puts "No organization for person '#{person.first_name} #{person.last_name}, #{person.integration_id}' could be found. Person will not be imported!"
126
+ ignored_persons += 1
127
127
  end
128
128
  end
129
129
  end
130
130
 
131
131
  # leads
132
132
  if defined?(LEADS_FILE) && !LEADS_FILE.nil? && !LEADS_FILE.empty?
133
- process_rows(LEADS_FILE, source_encoding) do |row|
133
+ process_rows(LEADS_FILE, source_encoding) do |row|
134
134
  organization = converter.to_organization_from_lead(row, rootmodel)
135
135
 
136
136
  organization.integration_id = "l#{row['id']}"
@@ -148,10 +148,10 @@ def convert_source
148
148
  organization.responsible_coworker = coworker
149
149
 
150
150
  if not row['tags'].nil?
151
- tags = row['tags'].split(",")
152
- tags.each do |tag|
153
- organization.set_tag(tag)
154
- end
151
+ tags = row['tags'].split(",")
152
+ tags.each do |tag|
153
+ organization.set_tag(tag)
154
+ end
155
155
  end
156
156
 
157
157
  person = GoImport::Person.new
@@ -166,17 +166,17 @@ def convert_source
166
166
  organization.add_employee(person)
167
167
 
168
168
  if row['description']
169
- history = GoImport::History.new()
169
+ comment = GoImport::Comment.new()
170
170
 
171
- history.text = row['description']
172
- history.person = person
173
- history.organization = organization
174
- history.created_by = coworker
171
+ comment.text = row['description']
172
+ comment.person = person
173
+ comment.organization = organization
174
+ comment.created_by = coworker
175
175
 
176
- rootmodel.add_history(history)
176
+ rootmodel.add_comment(comment)
177
177
  end
178
178
  rootmodel.add_organization(organization)
179
- end
179
+ end
180
180
  end
181
181
 
182
182
  # deals
@@ -191,10 +191,10 @@ def convert_source
191
191
  deal.customer_contact = rootmodel.find_person_by_integration_id(row['main_contact_id'])
192
192
  deal.responsible_coworker = rootmodel.find_coworker_by_integration_id(row['owner'])
193
193
 
194
- values = row['tags'].split(",")
195
- values.each do |value|
196
- deal.set_tag(value)
197
- end
194
+ values = row['tags'].split(",")
195
+ values.each do |value|
196
+ deal.set_tag(value)
197
+ end
198
198
  rootmodel.add_deal(deal)
199
199
  end
200
200
  end
@@ -202,30 +202,30 @@ def convert_source
202
202
  # historys
203
203
  if defined?(HISTORY_FILE) && !HISTORY_FILE.nil? && !HISTORY_FILE.empty?
204
204
  process_rows(HISTORY_FILE, source_encoding) do |row|
205
- history = converter.to_history(row, rootmodel)
205
+ history = GoImport::Comment.new()
206
206
  history.integration_id = row['id']
207
207
  history.text = row['content']
208
208
  history.created_by = rootmodel.find_coworker_by_integration_id(row["owner"])
209
209
  notable_id = row['noteable_id']
210
210
  case row["noteable_type"]
211
211
  when "Deal"
212
- deal = rootmodel.find_deal_by_integration_id(notable_id)
213
- history.deal = deal
212
+ deal = rootmodel.find_deal_by_integration_id(notable_id)
213
+ history.deal = deal
214
214
  when "Lead"
215
- history.person = rootmodel.find_person_by_integration_id("p#{notable_id}")
216
- history.organization = rootmodel.find_organization_by_integration_id("l#{notable_id}")
215
+ history.person = rootmodel.find_person_by_integration_id("p#{notable_id}")
216
+ history.organization = rootmodel.find_organization_by_integration_id("l#{notable_id}")
217
217
  when "Contact"
218
- puts "Ignoreing history for unbound person: #{row['owner']}"
219
- ignored_histories += 1
220
- next
218
+ puts "Ignoreing history for unbound person: #{row['owner']}"
219
+ ignored_histories += 1
220
+ next
221
221
  else
222
- org = rootmodel.find_organization_by_integration_id(notable_id)
223
- if org.nil?
224
- person = rootmodel.find_person_by_integration_id(notable_id)
225
- org = person.organization
226
- history.person = person
227
- end
228
- history.organization = org
222
+ org = rootmodel.find_organization_by_integration_id(notable_id)
223
+ if org.nil?
224
+ person = rootmodel.find_person_by_integration_id(notable_id)
225
+ org = person.organization
226
+ history.person = person
227
+ end
228
+ history.organization = org
229
229
  end
230
230
  rootmodel.add_history(history)
231
231
  end
@@ -35,13 +35,13 @@ class Converter
35
35
  end
36
36
 
37
37
  def to_coworker(row)
38
- coworker = GoImport::Coworker.new
38
+ coworker = GoImport::Coworker.new
39
39
  # All built in fields are automagically mapped. Add your custom stuff here...
40
- return coworker
40
+ return coworker
41
41
  end
42
42
 
43
43
  def to_person(row, rootmodel)
44
- person = GoImport::Person.new
44
+ person = GoImport::Person.new
45
45
  # All built in fields are automagically mapped. Add your custom stuff here...
46
46
  return person
47
47
  end
@@ -53,10 +53,4 @@ class Converter
53
53
  return deal
54
54
  end
55
55
 
56
- def to_history(row, rootmodel)
57
- history = GoImport::History.new()
58
- # All built in fields are automagically mapped. Add your custom stuff here...
59
- return history
60
- end
61
-
62
56
  end
@@ -207,11 +207,11 @@ class Converter
207
207
  # an organization if a field has a specific value
208
208
  #def organization_hook(row, organization, rootmodel)
209
209
  # if not row['fieldname'].empty?
210
- # history = GoImport::History.new
211
- # history.text = row['fieldname']
212
- # history.organization = organization
213
- # history.created_by = rootmodel.import_coworker
214
- # rootmodel.add_history(history)
210
+ # comment = GoImport::Comment.new
211
+ # comment.text = row['fieldname']
212
+ # comment.organization = organization
213
+ # comment.created_by = rootmodel.import_coworker
214
+ # rootmodel.add_comment(comment)
215
215
  # end
216
216
  #end
217
217
 
@@ -120,7 +120,7 @@ def convert_source
120
120
 
121
121
  # histories must be owned by a coworker and the be added to
122
122
  # organizations and histories and might refernce a person
123
- if defined?(histories_rows) && !histories_rows.nil?
123
+ if defined?(history_rows) && !history_rows.nil?
124
124
  puts "Trying to convert history..."
125
125
  history_rows.each do |row|
126
126
  rootmodel.add_history(converter.to_history(row, rootmodel))
@@ -173,15 +173,15 @@ class Converter
173
173
  # HOOKS
174
174
  #
175
175
  # Sometimes you need to add exra information to the rootmodel, this can be done
176
- # with hooks, below is an example of an organization hook that adds a history to
176
+ # with hooks, below is an example of an organization hook that adds a comment to
177
177
  # an organization if a field has a specific value
178
178
  #def organization_hook(row, organization, rootmodel)
179
179
  # if not row['fieldname'].empty?
180
- # history = GoImport::History.new
181
- # history.text = row['fieldname']
182
- # history.organization = organization
183
- # history.created_by = rootmodel.import_coworker
184
- # rootmodel.add_history(history)
180
+ # comment = GoImport::Comment.new
181
+ # comment.text = row['fieldname']
182
+ # comment.organization = organization
183
+ # comment.created_by = rootmodel.import_coworker
184
+ # rootmodel.add_comment(comment)
185
185
  # end
186
186
  #end
187
187
 
@@ -345,15 +345,15 @@ class Converter
345
345
  # HOOKS
346
346
  #
347
347
  # Sometimes you need to add exra information to the rootmodel, this can be done
348
- # with hooks, below is an example of an organization hook that adds a history to
348
+ # with hooks, below is an example of an organization hook that adds a comment to
349
349
  # an organization if a field has a specific value
350
350
  #def organization_hook(row, organization, rootmodel)
351
351
  # if not row['fieldname'].empty?
352
- # history = GoImport::History.new
353
- # history.text = row['fieldname']
354
- # history.organization = organization
355
- # history.created_by = rootmodel.import_coworker
356
- # rootmodel.add_history(history)
352
+ # comment = GoImport::Comment.new
353
+ # comment.text = row['fieldname']
354
+ # comment.organization = organization
355
+ # comment.created_by = rootmodel.import_coworker
356
+ # rootmodel.add_comment(comment)
357
357
  # end
358
358
  #end
359
359
 
@@ -380,15 +380,15 @@ class Converter
380
380
  # HOOKS
381
381
  #
382
382
  # Sometimes you need to add exra information to the rootmodel, this can be done
383
- # with hooks, below is an example of an organization hook that adds a history to
383
+ # with hooks, below is an example of an organization hook that adds a comment to
384
384
  # an organization if a field has a specific value
385
385
  #def organization_hook(row, organization, rootmodel)
386
386
  # if not row['fieldname'].empty?
387
- # history = GoImport::History.new
388
- # history.text = row['fieldname']
389
- # history.organization = organization
390
- # history.created_by = rootmodel.import_coworker
391
- # rootmodel.add_history(history)
387
+ # comment = GoImport::Comment.new
388
+ # comment.text = row['fieldname']
389
+ # comment.organization = organization
390
+ # comment.created_by = rootmodel.import_coworker
391
+ # rootmodel.add_comment(comment)
392
392
  # end
393
393
  #end
394
394
 
@@ -98,15 +98,15 @@ class Converter
98
98
  # HOOKS
99
99
  #
100
100
  # Sometimes you need to add exra information to the rootmodel, this can be done
101
- # with hooks, below is an example of an organization hook that adds a history to
101
+ # with hooks, below is an example of an organization hook that adds a comment to
102
102
  # an organization if a field has a specific value
103
103
  #def organization_hook(row, organization, rootmodel)
104
104
  # if not row['fieldname'].empty?
105
- # history = GoImport::History.new
106
- # history.text = row['fieldname']
107
- # history.organization = organization
108
- # history.created_by = rootmodel.import_coworker
109
- # rootmodel.add_history(history)
105
+ # comment = GoImport::Comment.new
106
+ # comment.text = row['fieldname']
107
+ # comment.organization = organization
108
+ # comment.created_by = rootmodel.import_coworker
109
+ # rootmodel.add_comment(comment)
110
110
  # end
111
111
  #end
112
112
 
@@ -49,9 +49,9 @@ describe GoImport::ShardHelper do
49
49
  end
50
50
 
51
51
  (1..10).each do |n|
52
- history = GoImport::History.new
53
- history.text = "Important history"
54
- model.add_history(history)
52
+ comment = GoImport::Comment.new
53
+ comment.text = "Important comment"
54
+ model.add_comment(comment)
55
55
  end
56
56
 
57
57
  (1..10).each do |n|
@@ -305,74 +305,139 @@ describe "RootModel" do
305
305
  }.to raise_error(GoImport::IntegrationIdIsRequiredError)
306
306
  end
307
307
 
308
- it "will only add history" do
308
+ it "will add comment" do
309
+ # given
310
+ comment = GoImport::Comment.new
311
+ comment.text = "this is a comment"
312
+
313
+ # when
314
+ rootmodel.add_comment(comment)
315
+
316
+ # then
317
+ rootmodel.histories.length.should eq 1
318
+ rootmodel.histories["0"].is_a?(GoImport::Comment).should eq true
319
+ end
320
+
321
+ it "will add sales call" do
322
+ # given
323
+ salesCall = GoImport::SalesCall.new
324
+ salesCall.text = "this is a sales call"
325
+
326
+ # when
327
+ rootmodel.add_sales_call(salesCall)
328
+
329
+ # then
330
+ rootmodel.histories.length.should eq 1
331
+ rootmodel.histories["0"].is_a?(GoImport::SalesCall).should eq true
332
+ end
333
+
334
+ it "will add talked to" do
335
+ # given
336
+ talkedTo = GoImport::TalkedTo.new
337
+ talkedTo.text = "this is a sales call"
338
+
339
+ # when
340
+ rootmodel.add_talked_to(talkedTo)
341
+
342
+ # then
343
+ rootmodel.histories.length.should eq 1
344
+ rootmodel.histories["0"].is_a?(GoImport::TalkedTo).should eq true
345
+ end
346
+
347
+ it "will add tried to reach" do
348
+ # given
349
+ triedToReach = GoImport::TriedToReach.new
350
+ triedToReach.text = "this is a sales call"
351
+
352
+ # when
353
+ rootmodel.add_tried_to_reach(triedToReach)
354
+
355
+ # then
356
+ rootmodel.histories.length.should eq 1
357
+ rootmodel.histories["0"].is_a?(GoImport::TriedToReach).should eq true
358
+ end
359
+
360
+ it "will add client visit" do
361
+ # given
362
+ clientVisit = GoImport::ClientVisit.new
363
+ clientVisit.text = "this is a client visit"
364
+
365
+ # when
366
+ rootmodel.add_client_visit(clientVisit)
367
+
368
+ # then
369
+ rootmodel.histories.length.should eq 1
370
+ rootmodel.histories["0"].is_a?(GoImport::ClientVisit).should eq true
371
+ end
372
+
373
+ it "will only add comment" do
309
374
  # given
310
- not_a_history = { :integration_id => "123", :text => "This is not a history"}
375
+ not_a_comment = { :integration_id => "123", :text => "This is not a comment"}
311
376
 
312
377
  # when, then
313
378
  expect {
314
- rootmodel.add_history(not_a_history)
379
+ rootmodel.add_comment(not_a_comment)
315
380
  }.to raise_error(ArgumentError)
316
381
  rootmodel.histories.length.should eq 0
317
382
  end
318
383
 
319
- it "will make history immutable after it has been added" do
384
+ it "will make comment immutable after it has been added" do
320
385
  # given
321
- history = GoImport::History.new
322
- history.text = "this is a history"
386
+ comment = GoImport::Comment.new
387
+ comment.text = "this is a comment"
323
388
 
324
389
  # when
325
- rootmodel.add_history(history)
390
+ rootmodel.add_comment(comment)
326
391
 
327
392
  # then
328
- history.is_immutable.should eq true
393
+ comment.is_immutable.should eq true
329
394
  end
330
395
 
331
- it "can add a history from a new history" do
396
+ it "can add a comment from a new comment" do
332
397
  # given
333
- history = GoImport::History.new
334
- history.integration_id = "123key"
335
- history.text = "This is a history"
398
+ comment = GoImport::Comment.new
399
+ comment.integration_id = "123key"
400
+ comment.text = "This is a comment"
336
401
 
337
402
  # when
338
- rootmodel.add_history(history)
403
+ rootmodel.add_comment(comment)
339
404
 
340
405
  # then
341
- rootmodel.find_history_by_integration_id("123key").text.should eq "This is a history"
406
+ rootmodel.find_history_by_integration_id("123key").text.should eq "This is a comment"
342
407
  rootmodel.histories.length.should eq 1
343
408
  end
344
409
 
345
- it "will generate an integration id if the new history dont have one" do
410
+ it "will generate an integration id if the new comment dont have one" do
346
411
  # given
347
- history = GoImport::History.new
348
- history.text = "This is a history"
412
+ comment = GoImport::Comment.new
413
+ comment.text = "This is a comment"
349
414
 
350
415
  # when
351
- rootmodel.add_history(history)
416
+ rootmodel.add_comment(comment)
352
417
 
353
418
  # then
354
- history.integration_id.length.should be > 0
419
+ comment.integration_id.length.should be > 0
355
420
  end
356
421
 
357
422
  it "will generate unique integration ids for each history" do
358
423
  # given
359
- history1 = GoImport::History.new
360
- history1.text = "This is a history"
424
+ comment1 = GoImport::Comment.new
425
+ comment1.text = "This is a history"
361
426
 
362
- history2 = GoImport::History.new
363
- history2.text = "This is a different history"
427
+ comment2 = GoImport::Comment.new
428
+ comment2.text = "This is a different history"
364
429
 
365
430
  # when
366
- rootmodel.add_history history1
367
- rootmodel.add_history history2
431
+ rootmodel.add_comment(comment1)
432
+ rootmodel.add_comment(comment2)
368
433
 
369
434
  # then
370
- history1.integration_id.should be != history2.integration_id
435
+ comment1.integration_id.should be != comment2.integration_id
371
436
  end
372
437
 
373
438
  it "will not add a nil history" do
374
439
  # given, when
375
- rootmodel.add_history(nil)
440
+ rootmodel.add_comment(nil)
376
441
 
377
442
  # then
378
443
  rootmodel.histories.length.should eq 0
@@ -431,25 +496,25 @@ describe "RootModel" do
431
496
  rootmodel.documents.files.length.should eq 1
432
497
  end
433
498
 
434
- it "will not add a new history when the history is already added (same integration id)" do
499
+ it "will not add a new comment when the comment is already added (same integration id)" do
435
500
  # given
436
- history = GoImport::History.new({
501
+ comment = GoImport::Comment.new({
437
502
  :integration_id => "123key",
438
- :text => "This is a history"
503
+ :text => "This is a comment"
439
504
  })
440
- rootmodel.add_history(history)
505
+ rootmodel.add_comment(comment)
441
506
  rootmodel.histories.length.should eq 1
442
507
 
443
508
  # when, then
444
- history2 = GoImport::History.new({
509
+ comment2 = GoImport::Comment.new({
445
510
  :integration_id => "123key",
446
- :text => "This is another history"
511
+ :text => "This is another comment"
447
512
  })
448
513
  expect {
449
- rootmodel.add_history(history2)
514
+ rootmodel.add_comment(comment2)
450
515
  }.to raise_error(GoImport::AlreadyAddedError)
451
516
  rootmodel.histories.length.should eq 1
452
- rootmodel.find_history_by_integration_id("123key").text.should eq "This is a history"
517
+ rootmodel.find_history_by_integration_id("123key").text.should eq "This is a comment"
453
518
  end
454
519
 
455
520
  it "Will find a person by integration id" do
@@ -674,23 +739,23 @@ describe "RootModel" do
674
739
  result.should eq nil
675
740
  end
676
741
 
677
- it "will find an history based on a property" do
742
+ it "will find an comment based on a property" do
678
743
  # given
679
744
  organization = GoImport::Organization.new
680
745
  organization.name = "Hubba Bubba"
681
746
  organization.integration_id = "321"
682
747
  rootmodel.add_organization(organization)
683
748
 
684
- history = GoImport::History.new
685
- history.text = "Hello!"
686
- history.organization = organization
749
+ comment = GoImport::Comment.new
750
+ comment.text = "Hello!"
751
+ comment.organization = organization
687
752
 
688
- rootmodel.add_history(history)
753
+ rootmodel.add_comment(comment)
689
754
  # when
690
755
  result = rootmodel.find_history{|n| n.text == "Hello!"}
691
756
 
692
757
  # then
693
- result.should eq history
758
+ result.should eq comment
694
759
  end
695
760
 
696
761
  it "will return nil if it doesn't find a history on a property" do
@@ -700,11 +765,11 @@ describe "RootModel" do
700
765
  organization.integration_id = "321"
701
766
  rootmodel.add_organization(organization)
702
767
 
703
- history = GoImport::History.new
704
- history.text = "Hello!"
705
- history.organization = organization
768
+ comment = GoImport::Comment.new
769
+ comment.text = "Hello!"
770
+ comment.organization = organization
706
771
 
707
- rootmodel.add_history(history)
772
+ rootmodel.add_comment(comment)
708
773
  # when
709
774
  result = rootmodel.find_history{|n| n.text == "Goodbye!"}
710
775
 
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: 4.0.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petter Sandholdt
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-05-26 00:00:00.000000000 Z
16
+ date: 2016-08-22 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: iso_country_codes
@@ -187,6 +187,8 @@ files:
187
187
  - lib/go_import/global_phone.json
188
188
  - lib/go_import/model/address.rb
189
189
  - lib/go_import/model/class_settings.rb
190
+ - lib/go_import/model/clientvisit.rb
191
+ - lib/go_import/model/comment.rb
190
192
  - lib/go_import/model/coworker.rb
191
193
  - lib/go_import/model/coworker_reference.rb
192
194
  - lib/go_import/model/customfield.rb
@@ -206,8 +208,11 @@ files:
206
208
  - lib/go_import/model/referencetosource.rb
207
209
  - lib/go_import/model/relation.rb
208
210
  - lib/go_import/model/rootmodel.rb
211
+ - lib/go_import/model/salescall.rb
209
212
  - lib/go_import/model/settings.rb
210
213
  - lib/go_import/model/tag.rb
214
+ - lib/go_import/model/talkedto.rb
215
+ - lib/go_import/model/triedtoreach.rb
211
216
  - lib/go_import/model_helpers.rb
212
217
  - lib/go_import/phone_helper.rb
213
218
  - lib/go_import/roo_helper.rb
@@ -311,7 +316,9 @@ files:
311
316
  homepage:
312
317
  licenses: []
313
318
  metadata: {}
314
- post_install_message:
319
+ post_install_message: |
320
+ ! The 'go-import' gem has been deprecated and has been replaced by 'move-to-go'.
321
+ ! See: https://rubygems.org/gems/move-to-go
315
322
  rdoc_options: []
316
323
  require_paths:
317
324
  - lib
@@ -327,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
334
  version: '0'
328
335
  requirements: []
329
336
  rubyforge_project:
330
- rubygems_version: 2.4.6
337
+ rubygems_version: 2.2.3
331
338
  signing_key:
332
339
  specification_version: 4
333
340
  summary: Tool to generate Lime Go zip import files