move-to-go 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/move-to-go +210 -0
- data/lib/move-to-go/can_become_immutable.rb +29 -0
- data/lib/move-to-go/csv_helper.rb +47 -0
- data/lib/move-to-go/email_helper.rb +14 -0
- data/lib/move-to-go/errors.rb +31 -0
- data/lib/move-to-go/excel_helper.rb +10 -0
- data/lib/move-to-go/global_phone.json +6571 -0
- data/lib/move-to-go/model/address.rb +63 -0
- data/lib/move-to-go/model/class_settings.rb +50 -0
- data/lib/move-to-go/model/clientvisit.rb +10 -0
- data/lib/move-to-go/model/comment.rb +10 -0
- data/lib/move-to-go/model/coworker.rb +82 -0
- data/lib/move-to-go/model/coworker_reference.rb +33 -0
- data/lib/move-to-go/model/customfield.rb +87 -0
- data/lib/move-to-go/model/deal.rb +216 -0
- data/lib/move-to-go/model/deal_class_settings.rb +97 -0
- data/lib/move-to-go/model/deal_state.rb +15 -0
- data/lib/move-to-go/model/deal_status.rb +23 -0
- data/lib/move-to-go/model/deal_status_reference.rb +47 -0
- data/lib/move-to-go/model/deal_status_setting.rb +49 -0
- data/lib/move-to-go/model/documents.rb +76 -0
- data/lib/move-to-go/model/file.rb +193 -0
- data/lib/move-to-go/model/history.rb +148 -0
- data/lib/move-to-go/model/history_classification.rb +26 -0
- data/lib/move-to-go/model/link.rb +82 -0
- data/lib/move-to-go/model/organization.rb +250 -0
- data/lib/move-to-go/model/person.rb +164 -0
- data/lib/move-to-go/model/referencetosource.rb +58 -0
- data/lib/move-to-go/model/relation.rb +23 -0
- data/lib/move-to-go/model/rootmodel.rb +663 -0
- data/lib/move-to-go/model/salescall.rb +10 -0
- data/lib/move-to-go/model/settings.rb +61 -0
- data/lib/move-to-go/model/tag.rb +35 -0
- data/lib/move-to-go/model/talkedto.rb +10 -0
- data/lib/move-to-go/model/triedtoreach.rb +10 -0
- data/lib/move-to-go/model_helpers.rb +97 -0
- data/lib/move-to-go/phone_helper.rb +75 -0
- data/lib/move-to-go/roo_helper.rb +82 -0
- data/lib/move-to-go/serialize_helper.rb +199 -0
- data/lib/move-to-go/shard_helper.rb +96 -0
- data/lib/move-to-go/source.rb +108 -0
- data/lib/move-to-go/templating.rb +52 -0
- data/lib/move-to-go.rb +20 -0
- data/sources/VISMA/.gitignore +14 -0
- data/sources/VISMA/.move-to-go/readme.txt +1 -0
- data/sources/VISMA/.move-to-go/runner.rb +89 -0
- data/sources/VISMA/Database/KONTAKT.DBF +0 -0
- data/sources/VISMA/Database/KUND.DBF +0 -0
- data/sources/VISMA/Gemfile +5 -0
- data/sources/VISMA/converter.rb +120 -0
- data/sources/base-crm/.move-to-go/runner.rb +235 -0
- data/sources/base-crm/Gemfile +5 -0
- data/sources/base-crm/README.md +9 -0
- data/sources/base-crm/converter.rb +56 -0
- data/sources/base-crm/data/contacts.csv +13 -0
- data/sources/base-crm/data/coworkers.csv +3 -0
- data/sources/base-crm/data/deals.csv +5 -0
- data/sources/base-crm/data/histories.csv +6 -0
- data/sources/base-crm/data/leads.csv +4 -0
- data/sources/base-crm/data/tasks.csv +5 -0
- data/sources/csv/.gitignore +14 -0
- data/sources/csv/.move-to-go/readme.txt +1 -0
- data/sources/csv/.move-to-go/runner.rb +65 -0
- data/sources/csv/Gemfile +5 -0
- data/sources/csv/converter.rb +218 -0
- data/sources/csv/data/coworkers.csv +2 -0
- data/sources/csv/data/deals.csv +2 -0
- data/sources/csv/data/organizations.csv +2 -0
- data/sources/csv/data/persons.csv +2 -0
- data/sources/custom/.gitignore +14 -0
- data/sources/custom/.move-to-go/readme.txt +1 -0
- data/sources/custom/.move-to-go/runner.rb +30 -0
- data/sources/custom/Gemfile +4 -0
- data/sources/custom/converter.rb +45 -0
- data/sources/excel/.gitignore +14 -0
- data/sources/excel/.move-to-go/readme.txt +3 -0
- data/sources/excel/.move-to-go/runner.rb +140 -0
- data/sources/excel/Gemfile +7 -0
- data/sources/excel/converter.rb +188 -0
- data/sources/excel/files/avtal.docx +0 -0
- data/sources/excel/files/more/avtal.docx +0 -0
- data/sources/excel/files/more/offert-2.pdf +0 -0
- data/sources/excel/files/offert-2.docx +0 -0
- data/sources/excel/files/offert.docx +0 -0
- data/sources/excel/sample-data.xlsx +0 -0
- data/sources/excel-basic/.gitignore +14 -0
- data/sources/excel-basic/.move-to-go/readme.txt +3 -0
- data/sources/excel-basic/.move-to-go/runner.rb +139 -0
- data/sources/excel-basic/Exempelfil.xlsx +0 -0
- data/sources/excel-basic/Gemfile +6 -0
- data/sources/excel-basic/converter.rb +175 -0
- data/sources/excel-basic/files/avtal.docx +0 -0
- data/sources/excel-basic/files/more/avtal.docx +0 -0
- data/sources/excel-basic/files/more/offert-2.pdf +0 -0
- data/sources/excel-basic/files/offert-2.docx +0 -0
- data/sources/excel-basic/files/offert.docx +0 -0
- data/sources/lime-crm-basic/.gitignore +14 -0
- data/sources/lime-crm-basic/.move-to-go/readme.txt +1 -0
- data/sources/lime-crm-basic/.move-to-go/runner.rb +524 -0
- data/sources/lime-crm-basic/Gemfile +6 -0
- data/sources/lime-crm-basic/converter.rb +396 -0
- data/sources/lime-easy/.gitignore +14 -0
- data/sources/lime-easy/.move-to-go/readme.txt +1 -0
- data/sources/lime-easy/.move-to-go/runner.rb +348 -0
- data/sources/lime-easy/Export/readme.txt +6 -0
- data/sources/lime-easy/Gemfile +5 -0
- data/sources/lime-easy/converter.rb +362 -0
- data/sources/salesforce/.gitignore +14 -0
- data/sources/salesforce/.move-to-go/readme.txt +1 -0
- data/sources/salesforce/.move-to-go/runner.rb +404 -0
- data/sources/salesforce/Gemfile +6 -0
- data/sources/salesforce/Gemfile.lock +48 -0
- data/sources/salesforce/converter.rb +113 -0
- data/sources/salesforce/export/readme.txt +3 -0
- data/spec/address_spec.rb +49 -0
- data/spec/class_settings_spec.rb +37 -0
- data/spec/coworker_spec.rb +94 -0
- data/spec/custom_field_spec.rb +22 -0
- data/spec/deal_class_settings_spec.rb +116 -0
- data/spec/deal_spec.rb +232 -0
- data/spec/deal_status_reference_spec.rb +17 -0
- data/spec/documents_spec.rb +64 -0
- data/spec/file_spec.rb +178 -0
- data/spec/helpers/csv_helper_spec.rb +45 -0
- data/spec/helpers/email_helper_spec.rb +37 -0
- data/spec/helpers/phone_helper_spec.rb +119 -0
- data/spec/helpers/roo_helper_spec.rb +10 -0
- data/spec/helpers/serialize_helper_spec.rb +253 -0
- data/spec/helpers/shard_helper_spec.rb +141 -0
- data/spec/helpers/xsd_validate_spec.rb +57 -0
- data/spec/history_spec.rb +150 -0
- data/spec/link_spec.rb +107 -0
- data/spec/organization_spec.rb +221 -0
- data/spec/person_spec.rb +129 -0
- data/spec/rootmodel_spec.rb +993 -0
- data/spec/spec_helper.rb +30 -0
- metadata +362 -0
data/spec/person_spec.rb
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require 'move-to-go'
|
3
|
+
|
4
|
+
describe "Person" do
|
5
|
+
let(:person) {
|
6
|
+
MoveToGo::Person.new
|
7
|
+
}
|
8
|
+
|
9
|
+
it "should have import tag as default" do
|
10
|
+
# given, when, then
|
11
|
+
person.tags.count.should eq 1
|
12
|
+
person.tags[0].value.should eq 'Import'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "can set a custom value" do
|
16
|
+
person.set_custom_value('the field', 'the value')
|
17
|
+
|
18
|
+
value = person.custom_values[0]
|
19
|
+
field = value.field
|
20
|
+
field.integration_id.should eq 'the field'
|
21
|
+
value.value.should eq 'the value'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "will set custom value with same integration_id to the last value" do
|
25
|
+
person.set_custom_value('the key', 'the value')
|
26
|
+
|
27
|
+
person.set_custom_value('the key', 'the value 2')
|
28
|
+
|
29
|
+
value = person.custom_values[0]
|
30
|
+
field = value.field
|
31
|
+
|
32
|
+
person.custom_values.length.should eq 1
|
33
|
+
field.integration_id.should eq 'the key'
|
34
|
+
value.value.should eq 'the value 2'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "will only set tag once" do
|
38
|
+
# we already have the default 'import' tag.
|
39
|
+
person.tags.length.should eq 1
|
40
|
+
|
41
|
+
person.set_tag('tag1')
|
42
|
+
person.set_tag('tag1')
|
43
|
+
|
44
|
+
person.tags.length.should eq 2
|
45
|
+
person.tags[1].value.should eq 'tag1'
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have a firstname if no lastname" do
|
49
|
+
person.first_name = "Vincent"
|
50
|
+
person.last_name = nil
|
51
|
+
|
52
|
+
error = person.validate
|
53
|
+
error.should be_empty
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should be currently employed if nothing specified" do
|
57
|
+
expect(person.currently_employed).to eq(true)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should have a lastname if no firstname" do
|
61
|
+
person.first_name = String.new
|
62
|
+
person.last_name = "Vega"
|
63
|
+
|
64
|
+
error = person.validate
|
65
|
+
error.should be_empty
|
66
|
+
end
|
67
|
+
|
68
|
+
it "shouldnt pass validation with no firstname and lastname" do
|
69
|
+
person.first_name = String.new
|
70
|
+
person.last_name = nil
|
71
|
+
|
72
|
+
error = person.validate
|
73
|
+
error.should start_with("A firstname or lastname is required for person")
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should auto convert org to org.ref during assignment" do
|
77
|
+
# given
|
78
|
+
org = MoveToGo::Organization.new({:integration_id => "123", :name => "Lundalogik"})
|
79
|
+
|
80
|
+
# when
|
81
|
+
person.set_organization_reference = org
|
82
|
+
|
83
|
+
# then
|
84
|
+
person.organization.is_a?(MoveToGo::OrganizationReference).should eq true
|
85
|
+
end
|
86
|
+
|
87
|
+
# *** TODO:
|
88
|
+
# Enable this when sources are fixed, see comment in organization.add_employee
|
89
|
+
|
90
|
+
# it "should be immutable when added to an organization" do
|
91
|
+
# # given
|
92
|
+
# org = MoveToGo::Organization.new({:integration_id => "123", :name => "Lundalogik"})
|
93
|
+
# person = MoveToGo::Person.new({:integration_id => "456", :first_name => "vincent"})
|
94
|
+
|
95
|
+
# # when
|
96
|
+
# org.add_employee person
|
97
|
+
|
98
|
+
# # then
|
99
|
+
# person.is_immutable.should eq true
|
100
|
+
# end
|
101
|
+
|
102
|
+
describe "parse_name_to_firstname_lastname_se" do
|
103
|
+
it "can parse 'Kalle Nilsson' into firstname 'Kalle' and lastname 'Nilsson'" do
|
104
|
+
person.parse_name_to_firstname_lastname_se 'Kalle Nilsson'
|
105
|
+
|
106
|
+
person.first_name.should eq 'Kalle'
|
107
|
+
person.last_name.should eq 'Nilsson'
|
108
|
+
end
|
109
|
+
|
110
|
+
it "can parse 'Kalle Svensson Nilsson' into firstname 'Kalle' and lastname 'Svensson Nilsson'" do
|
111
|
+
person.parse_name_to_firstname_lastname_se 'Kalle Svensson Nilsson'
|
112
|
+
|
113
|
+
person.first_name.should eq 'Kalle'
|
114
|
+
person.last_name.should eq 'Svensson Nilsson'
|
115
|
+
end
|
116
|
+
|
117
|
+
it "sets default name when name is empty" do
|
118
|
+
person.parse_name_to_firstname_lastname_se '', 'a default'
|
119
|
+
|
120
|
+
person.first_name.should eq 'a default'
|
121
|
+
end
|
122
|
+
|
123
|
+
it "sets default name when name is nil" do
|
124
|
+
person.parse_name_to_firstname_lastname_se nil, 'a default'
|
125
|
+
|
126
|
+
person.first_name.should eq 'a default'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|