go_import 3.0.23 → 3.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/go_import/model/deal.rb +11 -6
- data/lib/go_import/model/note.rb +25 -1
- data/lib/go_import/model_helpers.rb +15 -10
- data/sources/VISMA/converter.rb +1 -1
- data/sources/easy/converter.rb +14 -12
- data/sources/salesforce/.go_import/runner.rb +23 -16
- data/spec/deal_spec.rb +14 -3
- data/spec/helpers/serialize_helper_spec.rb +52 -48
- data/spec/helpers/xsd_validate_spec.rb +24 -23
- data/spec/note_spec.rb +40 -4
- data/spec/organization_spec.rb +26 -1
- data/spec/person_spec.rb +7 -33
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjljMjUyMzQwNGM4OTg4ZDQxMmExN2VhYmNlYTYwNTEyMzI2MDhkOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWQ5Njk2Mjk1MjY3MTUxN2JkMjdlMGM1ZmM1YTc5OGVlYTNkMjIxMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWU0MWU0MjQwN2QyOGZiN2U5MTI3NjhlMmIxOWFlYWFjZDUzZTkyNjZhZDE2
|
10
|
+
MGZjYzYwNDRhZDAyNGMzNWFmY2NiOTI5ODg1YzgwODdkZTQ0Y2MzZDllMjAx
|
11
|
+
NmE1YTI1ZWFiNmIxNjRiY2M2YzYzZTBiYjEwMjRjYTI5NzViNjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTJjYjk5NmVhMDllZDZhNTFjN2EyM2FhYTk4NjUxMTdmZGRkZjQwMTVkNGEz
|
14
|
+
YmQ2Mjk2ZWUyNjMzZDM0N2UxNDA0MGExMWVlZjJkMGUzMmUwNjA5ZGY4NDdl
|
15
|
+
NWNhYWFjNDllYWRkYThjNmJjNGQwMGNjZDlmNzFiODlhNDk5NTQ=
|
data/lib/go_import/model/deal.rb
CHANGED
@@ -161,6 +161,10 @@ module GoImport
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
# Sets the deal's value. Both . and , are treated as thousand
|
165
|
+
# separators and thus cents and other fractions will be
|
166
|
+
# ignored. This makes it easier for us to convert a string
|
167
|
+
# into an integer value.
|
164
168
|
def value=(value)
|
165
169
|
if value.nil?
|
166
170
|
@value = "0"
|
@@ -172,10 +176,15 @@ module GoImport
|
|
172
176
|
# remove those spaces.
|
173
177
|
fixed_value = value.gsub(" ", "")
|
174
178
|
|
179
|
+
# we assume that both , and . are thousand separators
|
180
|
+
# and remove them from the value string. We dont care
|
181
|
+
# about decimal separators since the value is a deal's
|
182
|
+
# value which is much larger than cents and ores.
|
183
|
+
fixed_value = fixed_value.gsub(",", "")
|
184
|
+
fixed_value = fixed_value.gsub(".", "")
|
185
|
+
|
175
186
|
if is_integer?(fixed_value)
|
176
187
|
@value = fixed_value
|
177
|
-
elsif is_float?(fixed_value)
|
178
|
-
@value = fixed_value
|
179
188
|
elsif fixed_value.length == 0
|
180
189
|
@value = "0"
|
181
190
|
else
|
@@ -187,9 +196,5 @@ module GoImport
|
|
187
196
|
def is_integer?(value)
|
188
197
|
true if Integer(value) rescue false
|
189
198
|
end
|
190
|
-
|
191
|
-
def is_float?(value)
|
192
|
-
true if Float(value) rescue false
|
193
|
-
end
|
194
199
|
end
|
195
200
|
end
|
data/lib/go_import/model/note.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module GoImport
|
2
2
|
class Note
|
3
3
|
include SerializeHelper
|
4
|
-
attr_accessor :id, :
|
4
|
+
attr_accessor :id, :integration_id, :date
|
5
5
|
|
6
|
+
attr_reader :text
|
6
7
|
attr_reader :organization, :created_by, :person, :deal
|
7
8
|
|
8
9
|
# The note's classification. It should be a value from
|
@@ -92,6 +93,29 @@ module GoImport
|
|
92
93
|
|
93
94
|
end
|
94
95
|
|
96
|
+
def text=(text)
|
97
|
+
@text = text
|
98
|
+
|
99
|
+
if @text.nil?
|
100
|
+
return
|
101
|
+
end
|
102
|
+
|
103
|
+
if @text.length == 0
|
104
|
+
return
|
105
|
+
end
|
106
|
+
|
107
|
+
@text.strip!
|
108
|
+
|
109
|
+
# remove form feeds
|
110
|
+
@text.gsub!("\f", "")
|
111
|
+
|
112
|
+
# remove vertical spaces
|
113
|
+
@text.gsub!("\v", "")
|
114
|
+
|
115
|
+
# remove backspace
|
116
|
+
@text.gsub!("\b", "")
|
117
|
+
end
|
118
|
+
|
95
119
|
def validate
|
96
120
|
error = String.new
|
97
121
|
|
@@ -2,23 +2,28 @@ module GoImport
|
|
2
2
|
module ModelHasCustomFields
|
3
3
|
# @example
|
4
4
|
# value = row['business_value_partner_info']
|
5
|
-
# obj.set_custom_value("
|
5
|
+
# obj.set_custom_value("external_url", "https://www.somecompany.com")
|
6
6
|
def set_custom_value(integration_id, value)
|
7
|
-
return set_custom_field({integration_id: integration_id, value: value})
|
8
|
-
end
|
9
|
-
# @example
|
10
|
-
# value = row['business_value_partner_info']
|
11
|
-
# obj.set_custom_field({:integration_id=>"partner_info", :value=>value})
|
12
|
-
def set_custom_field(obj)
|
13
7
|
@custom_values = [] if @custom_values == nil
|
14
|
-
|
15
|
-
|
8
|
+
|
9
|
+
if value.nil?
|
10
|
+
return
|
11
|
+
end
|
12
|
+
|
13
|
+
valueAsString = value.to_s
|
14
|
+
if valueAsString.length == 0
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
18
|
+
field = CustomFieldReference.new({:integration_id => integration_id})
|
16
19
|
custom_value = CustomValue.new
|
17
|
-
custom_value.value =
|
20
|
+
custom_value.value = valueAsString
|
18
21
|
custom_value.field = field
|
22
|
+
|
19
23
|
index = @custom_values.find_index do |custom_value|
|
20
24
|
custom_value.field.same_as?(field)
|
21
25
|
end
|
26
|
+
|
22
27
|
if index
|
23
28
|
@custom_values.delete_at index
|
24
29
|
end
|
data/sources/VISMA/converter.rb
CHANGED
@@ -79,7 +79,7 @@ class Converter
|
|
79
79
|
organization.relation = GoImport::Relation::IsACustomer
|
80
80
|
|
81
81
|
#Fill data to custom fields
|
82
|
-
organization.
|
82
|
+
organization.set_custom_value("ackoms", row["ACKOMS"])
|
83
83
|
|
84
84
|
return organization
|
85
85
|
end
|
data/sources/easy/converter.rb
CHANGED
@@ -222,6 +222,8 @@ class Converter
|
|
222
222
|
# the configure method.
|
223
223
|
|
224
224
|
# person.set_custom_value("shoe_size", row['shoe size'])
|
225
|
+
|
226
|
+
return person
|
225
227
|
end
|
226
228
|
|
227
229
|
# Reads a row from the Easy exported Project.txt
|
@@ -280,16 +282,16 @@ class Converter
|
|
280
282
|
|
281
283
|
# case activity
|
282
284
|
# when 'SalesCall'
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
285
|
+
# classification = GoImport::NoteClassification::SalesCall
|
286
|
+
# when 'Customer Visit'
|
287
|
+
# classification = GoImport::NoteClassification::ClientVisit
|
288
|
+
# when 'No answer'
|
289
|
+
# classification = GoImport::NoteClassification::TriedToReach
|
288
290
|
# else
|
289
291
|
# classification = GoImport::NoteClassification::Comment
|
290
292
|
# end
|
291
|
-
|
292
|
-
|
293
|
+
|
294
|
+
# return classification
|
293
295
|
end
|
294
296
|
|
295
297
|
def get_note_classification_for_activity_on_project(activity)
|
@@ -303,14 +305,14 @@ class Converter
|
|
303
305
|
|
304
306
|
# case activity
|
305
307
|
# when 'Installation'
|
306
|
-
|
307
|
-
|
308
|
-
|
308
|
+
# classification = GoImport::NoteClassification::ClientVisit
|
309
|
+
# when 'No answer'
|
310
|
+
# classification = GoImport::NoteClassification::TriedToReach
|
309
311
|
# else
|
310
312
|
# classification = GoImport::NoteClassification::Comment
|
311
313
|
# end
|
312
|
-
|
313
|
-
|
314
|
+
|
315
|
+
# return classification
|
314
316
|
end
|
315
317
|
|
316
318
|
def configure(rootmodel)
|
@@ -286,16 +286,18 @@ def to_note(row, rootmodel)
|
|
286
286
|
return note
|
287
287
|
end
|
288
288
|
|
289
|
-
def
|
290
|
-
puts "Trying to
|
291
|
-
statuses = []
|
289
|
+
def add_opportunity_stages_as_deal_status_to_model(rootmodel)
|
290
|
+
puts "Trying to create deal statuses..."
|
292
291
|
|
292
|
+
default_status = ''
|
293
|
+
statuses = []
|
293
294
|
process_rows(DEAL_FILE) do |row|
|
294
295
|
status = {
|
295
296
|
:label => row['StageName'],
|
296
297
|
:integration_id => row['StageName'],
|
298
|
+
:sort_order => row['StageSortOrder']
|
297
299
|
}
|
298
|
-
|
300
|
+
|
299
301
|
if row['IsClosed'] == '1'
|
300
302
|
if row['IsWon'] == '1'
|
301
303
|
status[:assessment] = GoImport::DealState::PositiveEndState
|
@@ -306,10 +308,24 @@ def get_deal_statuses_from_opportunites()
|
|
306
308
|
|
307
309
|
if !statuses.any? {|s| s[:label] == status[:label]}
|
308
310
|
statuses.push status
|
311
|
+
|
312
|
+
if row['StageSortOrder'] == '1'
|
313
|
+
default_status = status[:label]
|
314
|
+
end
|
309
315
|
end
|
310
316
|
end
|
311
317
|
|
312
|
-
|
318
|
+
statuses.sort! { |s1, s2| s1[:sort_order] <=> s2[:sort_order] }
|
319
|
+
rootmodel.settings.with_deal do |deal|
|
320
|
+
statuses.each do |status|
|
321
|
+
deal.add_status({ :label => status[:label],
|
322
|
+
:integration_id => status[:integration_id],
|
323
|
+
:assessment => status[:assessment]
|
324
|
+
})
|
325
|
+
end
|
326
|
+
|
327
|
+
deal.default_status = default_status
|
328
|
+
end
|
313
329
|
end
|
314
330
|
|
315
331
|
def convert_source
|
@@ -345,17 +361,8 @@ def convert_source
|
|
345
361
|
end
|
346
362
|
end
|
347
363
|
end
|
348
|
-
|
349
|
-
|
350
|
-
rootmodel.settings.with_deal do |deal|
|
351
|
-
deal_statuses.each do |status|
|
352
|
-
deal.add_status({ :label => status[:label],
|
353
|
-
:integration_id => status[:integration_id],
|
354
|
-
:assessment => status[:assessment]
|
355
|
-
})
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
364
|
+
|
365
|
+
add_opportunity_stages_as_deal_status_to_model(rootmodel)
|
359
366
|
|
360
367
|
puts "Trying to import users..."
|
361
368
|
process_rows(USER_FILE) do |row|
|
data/spec/deal_spec.rb
CHANGED
@@ -144,15 +144,26 @@ describe "Deal" do
|
|
144
144
|
deal.value.should eq "100"
|
145
145
|
end
|
146
146
|
|
147
|
-
it "should
|
147
|
+
it "should treat . as thousand separator and remove it from the value" do
|
148
148
|
# given
|
149
|
-
deal.name = "
|
149
|
+
deal.name = "Deal with . as thousand separator"
|
150
150
|
|
151
151
|
# when
|
152
152
|
deal.value = "100.10"
|
153
153
|
|
154
154
|
# then
|
155
|
-
deal.value.should eq "
|
155
|
+
deal.value.should eq "10010"
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should tread , as thousand separator and remove it from the value" do
|
159
|
+
# given
|
160
|
+
deal.name = "Deal with , as thousand separator"
|
161
|
+
|
162
|
+
# when
|
163
|
+
deal.value = "100,10"
|
164
|
+
|
165
|
+
# then
|
166
|
+
deal.value = "10010"
|
156
167
|
end
|
157
168
|
|
158
169
|
it "should set value to 0 if value is nil" do
|
@@ -70,7 +70,7 @@ describe GoImport::SerializeHelper do
|
|
70
70
|
p.with_source do |source|
|
71
71
|
source.par_se('122345')
|
72
72
|
end
|
73
|
-
#p.source_ref = {:name=>'Go',:id=>"PASE122345"}
|
73
|
+
#p.source_ref = {:name => 'Go',:id => "PASE122345"}
|
74
74
|
p.with_postal_address do |addr|
|
75
75
|
addr.city = "Ankeborg"
|
76
76
|
end
|
@@ -78,9 +78,12 @@ describe GoImport::SerializeHelper do
|
|
78
78
|
p.set_tag("tag:anka")
|
79
79
|
p.set_tag("tag:Bj\u{00F6}rk")
|
80
80
|
p.set_tag("tag:<Bj\u{00F6}rk>")
|
81
|
-
p.set_custom_field({:integration_id=>"2", :value=>"cf value"})
|
82
|
-
p.set_custom_field({:integration_id=>"3", :value=>"cf Bj\u{00F6}rk"})
|
83
|
-
p.set_custom_field({:integration_id=>"4", :value=>"cf <Bj\u{00F6}rk>"})
|
81
|
+
# p.set_custom_field({:integration_id => "2", :value => "cf value"})
|
82
|
+
# p.set_custom_field({:integration_id => "3", :value => "cf Bj\u{00F6}rk"})
|
83
|
+
# p.set_custom_field({:integration_id => "4", :value => "cf <Bj\u{00F6}rk>"})
|
84
|
+
p.set_custom_value("2", "cf value")
|
85
|
+
p.set_custom_value("3", "cf Bj\u{00F6}rk")
|
86
|
+
p.set_custom_value("4", "cf <Bj\u{00F6}rk>")
|
84
87
|
GoImport::SerializeHelper::serialize(p,-1)
|
85
88
|
}
|
86
89
|
it "should contain first and last name" do
|
@@ -120,29 +123,30 @@ describe GoImport::SerializeHelper do
|
|
120
123
|
end
|
121
124
|
describe "Serialize organization" do
|
122
125
|
let(:serialized) {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
+
organization = GoImport::Organization.new
|
127
|
+
organization.name = "Ankeborgs bibliotek"
|
128
|
+
organization.with_source do |source|
|
126
129
|
source.par_se('122345')
|
127
130
|
end
|
128
|
-
#
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
131
|
+
#organization.source_ref = {:name => 'Go',:id => "PASE122345"}
|
132
|
+
organization.set_tag("tag:bibliotek")
|
133
|
+
organization.set_tag("tag:Bj\u{00F6}rk")
|
134
|
+
organization.set_custom_value("2", "cf value")
|
135
|
+
organization.set_custom_value("3", "cf Bj\u{00F6}rk")
|
136
|
+
organization.with_postal_address do |addr|
|
134
137
|
addr.city = "Ankeborg"
|
135
138
|
end
|
136
|
-
|
139
|
+
organization.with_visit_address do |addr|
|
137
140
|
addr.city = "Gaaseborg"
|
138
141
|
end
|
139
|
-
|
142
|
+
organization.add_employee({
|
140
143
|
:integration_id => "1",
|
141
144
|
:first_name => "Kalle",
|
142
145
|
:last_name => "Anka"
|
143
146
|
})
|
144
|
-
GoImport::SerializeHelper::serialize(
|
147
|
+
GoImport::SerializeHelper::serialize(organization, -1)
|
145
148
|
}
|
149
|
+
|
146
150
|
it "should contain name" do
|
147
151
|
serialized.should match(/Ankeborgs bibliotek/)
|
148
152
|
end
|
@@ -177,11 +181,11 @@ describe GoImport::SerializeHelper do
|
|
177
181
|
|
178
182
|
describe "Serialize goimport" do
|
179
183
|
let(:serialized) {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
GoImport::SerializeHelper::serialize(
|
184
|
+
rootmodel = GoImport::RootModel.new
|
185
|
+
organization = GoImport::Organization.new
|
186
|
+
organization.name = "Ankeborgs bibliotek"
|
187
|
+
rootmodel.add_organization organization
|
188
|
+
GoImport::SerializeHelper::serialize(rootmodel, -1)
|
185
189
|
}
|
186
190
|
it "should contain name" do
|
187
191
|
serialized.should match(/Ankeborgs bibliotek/)
|
@@ -197,30 +201,30 @@ describe GoImport::SerializeHelper do
|
|
197
201
|
describe "for person" do
|
198
202
|
let(:import_rows) { GoImport::Person.new.get_import_rows }
|
199
203
|
it "should contain integration id" do
|
200
|
-
import_rows.should include({:id=>'integration_id', :name=>'Integration id', :type
|
201
|
-
import_rows.should include({:id=>'id', :name=>'Go id', :type
|
204
|
+
import_rows.should include({:id => 'integration_id', :name => 'Integration id', :type => :string})
|
205
|
+
import_rows.should include({:id => 'id', :name => 'Go id', :type => :string})
|
202
206
|
end
|
203
207
|
it "should contain address" do
|
204
|
-
expected = {:id=>'postal_address', :name=>'Postal address', :type
|
205
|
-
:model=>[
|
206
|
-
{:id=>'street',:name=>'Street', :type
|
207
|
-
{:id=>'zip_code',:name=>'Zip code', :type
|
208
|
-
{:id=>'city',:name=>'City', :type
|
209
|
-
{:id=>'country_code',:name=>'Country code', :type
|
210
|
-
{:id=>'location',:name=>'Location', :type
|
211
|
-
{:id=>'country_name',:name=>'Country name', :type
|
208
|
+
expected = {:id => 'postal_address', :name => 'Postal address', :type => :address,
|
209
|
+
:model => [
|
210
|
+
{:id => 'street',:name => 'Street', :type => :string},
|
211
|
+
{:id => 'zip_code',:name => 'Zip code', :type => :string},
|
212
|
+
{:id => 'city',:name => 'City', :type => :string},
|
213
|
+
{:id => 'country_code',:name => 'Country code', :type => :string},
|
214
|
+
{:id => 'location',:name => 'Location', :type => :string},
|
215
|
+
{:id => 'country_name',:name => 'Country name', :type => :string},
|
212
216
|
]}
|
213
217
|
import_rows.should include(expected)
|
214
218
|
end
|
215
219
|
it "should contain organization" do
|
216
220
|
import_rows.should include({
|
217
|
-
:id=>'organization',
|
218
|
-
:name=>'Organization',
|
219
|
-
:type
|
220
|
-
:model=>[
|
221
|
-
{:id=>'id', :name=>'Go id', :type
|
222
|
-
{:id=>'integration_id', :name=>'Integration id', :type
|
223
|
-
{:id=>'heading', :name=>'Heading', :type
|
221
|
+
:id => 'organization',
|
222
|
+
:name => 'Organization',
|
223
|
+
:type => :organization_reference,
|
224
|
+
:model => [
|
225
|
+
{:id => 'id', :name => 'Go id', :type => :string},
|
226
|
+
{:id => 'integration_id', :name => 'Integration id', :type => :string},
|
227
|
+
{:id => 'heading', :name => 'Heading', :type => :string}
|
224
228
|
]
|
225
229
|
})
|
226
230
|
end
|
@@ -228,18 +232,18 @@ describe GoImport::SerializeHelper do
|
|
228
232
|
describe "for organization" do
|
229
233
|
let(:import_rows) { GoImport::Organization.new.get_import_rows }
|
230
234
|
it "should contain integration id" do
|
231
|
-
import_rows.should include({:id=>'integration_id', :name=>'Integration id', :type
|
232
|
-
import_rows.should include({:id=>'id', :name=>'Go id', :type
|
235
|
+
import_rows.should include({:id => 'integration_id', :name => 'Integration id', :type => :string})
|
236
|
+
import_rows.should include({:id => 'id', :name => 'Go id', :type => :string})
|
233
237
|
end
|
234
238
|
it "should contain address" do
|
235
|
-
expected = {:id=>'postal_address', :name=>'Postal address', :type
|
236
|
-
:model=>[
|
237
|
-
{:id=>'street',:name=>'Street', :type
|
238
|
-
{:id=>'zip_code',:name=>'Zip code', :type
|
239
|
-
{:id=>'city',:name=>'City', :type
|
240
|
-
{:id=>'country_code',:name=>'Country code', :type
|
241
|
-
{:id=>'location',:name=>'Location', :type
|
242
|
-
{:id=>'country_name',:name=>'Country name', :type
|
239
|
+
expected = {:id => 'postal_address', :name => 'Postal address', :type => :address,
|
240
|
+
:model => [
|
241
|
+
{:id => 'street',:name => 'Street', :type => :string},
|
242
|
+
{:id => 'zip_code',:name => 'Zip code', :type => :string},
|
243
|
+
{:id => 'city',:name => 'City', :type => :string},
|
244
|
+
{:id => 'country_code',:name => 'Country code', :type => :string},
|
245
|
+
{:id => 'location',:name => 'Location', :type => :string},
|
246
|
+
{:id => 'country_name',:name => 'Country name', :type => :string},
|
243
247
|
]}
|
244
248
|
import_rows.should include(expected)
|
245
249
|
end
|
@@ -4,50 +4,51 @@ require 'nokogiri'
|
|
4
4
|
describe GoImport::SerializeHelper do
|
5
5
|
describe "Validate according to xsd" do
|
6
6
|
let(:validate_result) {
|
7
|
-
|
8
|
-
|
9
|
-
s.set_custom_field({:integration_id=>"2", :title=>"cf title"})
|
10
|
-
s.set_custom_field({:integration_id=>"3", :title=>"cf title2"})
|
7
|
+
rootmodel = GoImport::RootModel.new
|
8
|
+
rootmodel.settings.with_organization do |s|
|
9
|
+
s.set_custom_field({:integration_id => "2", :title => "cf title"})
|
10
|
+
s.set_custom_field({:integration_id => "3", :title => "cf title2"})
|
11
11
|
end
|
12
|
-
|
13
|
-
:integration_id=>"123",
|
14
|
-
:first_name=>"Kalle",
|
15
|
-
:last_name=>"Anka",
|
16
|
-
:email=>"kalle.anka@vonanka.com"
|
12
|
+
rootmodel.add_coworker({
|
13
|
+
:integration_id => "123",
|
14
|
+
:first_name => "Kalle",
|
15
|
+
:last_name => "Anka",
|
16
|
+
:email => "kalle.anka@vonanka.com"
|
17
17
|
})
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
organization = GoImport::Organization.new
|
19
|
+
organization.name = "Ankeborgs bibliotek"
|
20
|
+
organization.with_source do |source|
|
21
21
|
source.par_se('122345')
|
22
22
|
end
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
#organization.source_ref = {:name => 'Go',:id => "PASE122345"}
|
24
|
+
organization.set_tag("tag:bibliotek")
|
25
|
+
organization.set_tag("tag:Bj\u{00F6}rk")
|
26
|
+
organization.set_custom_value("2", "cf value")
|
27
|
+
organization.set_custom_value("3", "cf Bj\u{00F6}rk")
|
28
|
+
organization.with_postal_address do |addr|
|
29
29
|
addr.city = "Ankeborg"
|
30
30
|
end
|
31
|
-
|
31
|
+
organization.with_visit_address do |addr|
|
32
32
|
addr.city = "Gaaseborg"
|
33
33
|
end
|
34
34
|
coworker = GoImport::Coworker.new({:integration_id => "1", :first_name => "Vincent", :last_name => "Vega"})
|
35
|
-
|
35
|
+
organization.responsible_coworker = coworker
|
36
36
|
|
37
|
-
emp =
|
37
|
+
emp = organization.add_employee({
|
38
38
|
:integration_id => "1",
|
39
39
|
:first_name => "Kalle",
|
40
40
|
:last_name => "Anka"
|
41
41
|
})
|
42
42
|
emp.direct_phone_number = '234234234'
|
43
43
|
emp.currently_employed = true
|
44
|
-
|
44
|
+
rootmodel.add_organization organization
|
45
45
|
xsd_file = File.join(File.dirname(__FILE__), '..', 'sample_data', 'schema0.xsd')
|
46
46
|
|
47
47
|
xsd = Nokogiri::XML::Schema(File.read(xsd_file))
|
48
|
-
doc = Nokogiri::XML(GoImport::SerializeHelper::serialize(
|
48
|
+
doc = Nokogiri::XML(GoImport::SerializeHelper::serialize(rootmodel, -1))
|
49
49
|
xsd.validate(doc)
|
50
50
|
}
|
51
|
+
|
51
52
|
it "Should not contain validation errors" do
|
52
53
|
expect(validate_result).to eq([])
|
53
54
|
end
|
data/spec/note_spec.rb
CHANGED
@@ -49,7 +49,7 @@ describe "Note" do
|
|
49
49
|
note.validate.length.should be > 0
|
50
50
|
end
|
51
51
|
|
52
|
-
it "will set organization ref when organization is
|
52
|
+
it "will set organization ref when organization is assigned" do
|
53
53
|
# given
|
54
54
|
org = GoImport::Organization.new({:integration_id => "123", :name => "Beagle Boys!"})
|
55
55
|
|
@@ -61,7 +61,7 @@ describe "Note" do
|
|
61
61
|
note.instance_variable_get(:@organization_reference).is_a?(GoImport::OrganizationReference).should eq true
|
62
62
|
end
|
63
63
|
|
64
|
-
it "will set person ref when person is
|
64
|
+
it "will set person ref when person is assigned" do
|
65
65
|
# given
|
66
66
|
person = GoImport::Person.new({:integration_id => "123" })
|
67
67
|
person.parse_name_to_firstname_lastname_se "Billy Bob"
|
@@ -74,7 +74,7 @@ describe "Note" do
|
|
74
74
|
note.instance_variable_get(:@person_reference).is_a?(GoImport::PersonReference).should eq true
|
75
75
|
end
|
76
76
|
|
77
|
-
it "will set coworker ref when coworker is
|
77
|
+
it "will set coworker ref when coworker is assigned" do
|
78
78
|
# given
|
79
79
|
coworker = GoImport::Coworker.new({:integration_id => "123" })
|
80
80
|
coworker.parse_name_to_firstname_lastname_se "Billy Bob"
|
@@ -87,7 +87,7 @@ describe "Note" do
|
|
87
87
|
note.instance_variable_get(:@created_by_reference).is_a?(GoImport::CoworkerReference).should eq true
|
88
88
|
end
|
89
89
|
|
90
|
-
it "will set deal ref when deal is
|
90
|
+
it "will set deal ref when deal is assigned" do
|
91
91
|
# given
|
92
92
|
deal = GoImport::Deal.new({:integration_id => "123" })
|
93
93
|
deal.name = "The new deal"
|
@@ -111,4 +111,40 @@ describe "Note" do
|
|
111
111
|
note.classification = "hubbabubba"
|
112
112
|
}.to raise_error(GoImport::InvalidNoteClassificationError)
|
113
113
|
end
|
114
|
+
|
115
|
+
it "should remove form feed from text" do
|
116
|
+
# given
|
117
|
+
textWithFormFeed = "Text with form feed"
|
118
|
+
textWithoutFormFeed = "Text with form feed"
|
119
|
+
|
120
|
+
# when
|
121
|
+
note.text = textWithFormFeed
|
122
|
+
|
123
|
+
# then
|
124
|
+
note.text.should eq textWithoutFormFeed
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should remove vertical tab from text" do
|
128
|
+
# given
|
129
|
+
textWithVerticalTab = "Text with \vvertical tab"
|
130
|
+
textWithoutVerticalTab = "Text with vertical tab"
|
131
|
+
|
132
|
+
# when
|
133
|
+
note.text = textWithVerticalTab
|
134
|
+
|
135
|
+
# then
|
136
|
+
note.text.should eq textWithoutVerticalTab
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should remove backspace from text" do
|
140
|
+
# given
|
141
|
+
textWithBackSpace = "Text with \bbackspace"
|
142
|
+
textWithoutBackSpace = "Text with backspace"
|
143
|
+
|
144
|
+
# when
|
145
|
+
note.text = textWithBackSpace
|
146
|
+
|
147
|
+
# then
|
148
|
+
note.text.should eq textWithoutBackSpace
|
149
|
+
end
|
114
150
|
end
|
data/spec/organization_spec.rb
CHANGED
@@ -150,12 +150,37 @@ describe "Organization" do
|
|
150
150
|
it "should only set relation last modified to valid date" do
|
151
151
|
# given
|
152
152
|
organization.relation = GoImport::Relation::IsACustomer
|
153
|
-
|
153
|
+
|
154
154
|
# when, then
|
155
155
|
expect {
|
156
156
|
organization.relation_last_modified = "hubbabubba"
|
157
157
|
}.to raise_error(GoImport::InvalidValueError)
|
158
158
|
end
|
159
|
+
|
160
|
+
it "can have custom value" do
|
161
|
+
# given, when
|
162
|
+
organization.set_custom_value "field_integration_id", "the is a value"
|
163
|
+
|
164
|
+
# then
|
165
|
+
organization.custom_values.length.should eq 1
|
166
|
+
end
|
167
|
+
|
168
|
+
it "can have a custom numeric value" do
|
169
|
+
# given, when
|
170
|
+
organization.set_custom_value "price", 100
|
171
|
+
|
172
|
+
# then
|
173
|
+
organization.custom_values.length.should eq 1
|
174
|
+
organization.custom_values[0].value.should eq "100"
|
175
|
+
end
|
176
|
+
|
177
|
+
it "a custom value can not be empty" do
|
178
|
+
# given, when
|
179
|
+
organization.set_custom_value "field_integration_id", ""
|
180
|
+
|
181
|
+
# then
|
182
|
+
organization.custom_values.length.should eq 0
|
183
|
+
end
|
159
184
|
end
|
160
185
|
|
161
186
|
describe "OrganizationReference" do
|
data/spec/person_spec.rb
CHANGED
@@ -12,22 +12,20 @@ describe "Person" do
|
|
12
12
|
person.tags[0].value.should eq 'Import'
|
13
13
|
end
|
14
14
|
|
15
|
-
it "can set a
|
16
|
-
person.
|
17
|
-
:value=> 'the value'})
|
15
|
+
it "can set a custom value" do
|
16
|
+
person.set_custom_value('the field', 'the value')
|
18
17
|
|
19
18
|
value = person.custom_values[0]
|
20
19
|
field = value.field
|
21
|
-
field.integration_id.should eq 'the
|
20
|
+
field.integration_id.should eq 'the field'
|
22
21
|
value.value.should eq 'the value'
|
23
22
|
end
|
24
23
|
|
25
|
-
it "will set custom
|
26
|
-
person.
|
27
|
-
:value=> 'the value'})
|
24
|
+
it "will set custom value with same integration_id to the last value" do
|
25
|
+
person.set_custom_value('the key', 'the value')
|
28
26
|
|
29
|
-
person.
|
30
|
-
|
27
|
+
person.set_custom_value('the key', 'the value 2')
|
28
|
+
|
31
29
|
value = person.custom_values[0]
|
32
30
|
field = value.field
|
33
31
|
|
@@ -36,30 +34,6 @@ describe "Person" do
|
|
36
34
|
value.value.should eq 'the value 2'
|
37
35
|
end
|
38
36
|
|
39
|
-
it "will set custom field with same id to the last value" do
|
40
|
-
person.set_custom_field({ :integration_id => 'the id', :value=> 'the value' })
|
41
|
-
|
42
|
-
person.set_custom_field({ :integration_id => 'the id', :value=> 'the value 2'})
|
43
|
-
value = person.custom_values[0]
|
44
|
-
field = value.field
|
45
|
-
|
46
|
-
person.custom_values.length.should eq 1
|
47
|
-
field.integration_id.should eq 'the id'
|
48
|
-
value.value.should eq 'the value 2'
|
49
|
-
end
|
50
|
-
|
51
|
-
it "will set custom field (using set_custom_value) with same integration_id to the last value" do
|
52
|
-
person.set_custom_value('the id', 'the value')
|
53
|
-
|
54
|
-
person.set_custom_value('the id', 'the value 2')
|
55
|
-
value = person.custom_values[0]
|
56
|
-
field = value.field
|
57
|
-
|
58
|
-
person.custom_values.length.should eq 1
|
59
|
-
field.integration_id.should eq 'the id'
|
60
|
-
value.value.should eq 'the value 2'
|
61
|
-
end
|
62
|
-
|
63
37
|
it "will only set tag once" do
|
64
38
|
# we already have the default 'import' tag.
|
65
39
|
person.tags.length.should eq 1
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oskar Gewalli
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: iso_country_codes
|
@@ -154,8 +154,8 @@ dependencies:
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
description: ! ' go-import is an import tool for LIME Go. It can take virtually any
|
157
|
-
input source and create
|
158
|
-
|
157
|
+
input source and create zip-files that LIME Go likes. go-import has some predefined
|
158
|
+
sources that makes will help you migrate your data.
|
159
159
|
|
160
160
|
'
|
161
161
|
email: support@lundalogik.se
|
@@ -299,7 +299,7 @@ rubyforge_project:
|
|
299
299
|
rubygems_version: 2.1.11
|
300
300
|
signing_key:
|
301
301
|
specification_version: 4
|
302
|
-
summary:
|
302
|
+
summary: Tool to generate Lime Go zip import files
|
303
303
|
test_files:
|
304
304
|
- spec/address_spec.rb
|
305
305
|
- spec/class_settings_spec.rb
|