move-to-go 5.0.11 → 5.4.1
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 +5 -5
- data/bin/move-to-go +11 -1
- data/lib/move-to-go/model/file.rb +12 -7
- data/lib/move-to-go/model/history.rb +6 -1
- data/lib/move-to-go/model/history_classification.rb +3 -0
- data/lib/move-to-go/model/link.rb +12 -7
- data/lib/move-to-go/model/meeting.rb +219 -0
- data/lib/move-to-go/model/organization.rb +9 -1
- data/lib/move-to-go/model/person.rb +11 -1
- data/lib/move-to-go/model/rootmodel.rb +147 -5
- data/lib/move-to-go/model/todo.rb +182 -0
- data/lib/move-to-go/roo_helper.rb +7 -2
- data/lib/move-to-go/serialize_helper.rb +18 -0
- data/lib/move-to-go/shard_helper.rb +16 -0
- data/lib/move-to-go/source.rb +2 -0
- data/sources/excel/.move-to-go/runner.rb +48 -0
- data/sources/excel/converter.rb +61 -1
- data/sources/excel/sample-data.xlsx +0 -0
- data/sources/lime-easy/.move-to-go/runner.rb +149 -32
- data/sources/lime-easy/converter.rb +23 -7
- data/spec/file_spec.rb +27 -0
- data/spec/helpers/xsd_validate_spec.rb +87 -17
- data/spec/link_spec.rb +28 -2
- data/spec/meeting_spec.rb +152 -0
- data/spec/todo_spec.rb +149 -0
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bd937b1db5bd12b8d2a67ee5268cfcfa7d7636bce84c89dfee6d22e6b5d66c5a
|
4
|
+
data.tar.gz: 9c494ea595c8918351912ca6323e5dd06e37289fd217f28c6b650a9f82dcc2ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93548a71b79eafbd314b33bfa5a1618c1bbf4cc3eac7117ceef4e7cc0a083cbbb8be62e12238b1d7f0e33d2360978fb32922796ccabad1e253e71b8def6abc79
|
7
|
+
data.tar.gz: 468ed5939dce2a4fabcf81ba5498f60c8489fb571016d6f8403f5fc2cf16876637d0d335e6730cfdd81257872f2321467024b102a5955509fff46aaaba042dac
|
data/bin/move-to-go
CHANGED
@@ -241,6 +241,10 @@ class MoveToGoCommandLine < Thor
|
|
241
241
|
|
242
242
|
private
|
243
243
|
def check_current_version()
|
244
|
+
if Gem.loaded_specs["move-to-go"] == nil
|
245
|
+
puts "Running source version, no version check"
|
246
|
+
return
|
247
|
+
end
|
244
248
|
uri = URI('https://rubygems.org/api/v1/versions/move-to-go/latest.json')
|
245
249
|
|
246
250
|
Net::HTTP.start(uri.host, uri.port,
|
@@ -264,7 +268,13 @@ class MoveToGoCommandLine < Thor
|
|
264
268
|
|
265
269
|
private
|
266
270
|
def display_current_version()
|
267
|
-
|
271
|
+
if Gem.loaded_specs["move-to-go"] == nil
|
272
|
+
current_version = "source"
|
273
|
+
else
|
274
|
+
current_version = Gem.loaded_specs["move-to-go"].version
|
275
|
+
end
|
276
|
+
|
277
|
+
puts "Version: #{current_version}"
|
268
278
|
puts
|
269
279
|
end
|
270
280
|
end
|
@@ -11,7 +11,7 @@ module MoveToGo
|
|
11
11
|
include SerializeHelper
|
12
12
|
attr_accessor :id, :integration_id, :description
|
13
13
|
|
14
|
-
attr_reader :organization, :created_by, :deal
|
14
|
+
attr_reader :organization, :created_by, :deal, :person
|
15
15
|
|
16
16
|
attr_reader :path
|
17
17
|
|
@@ -45,6 +45,7 @@ module MoveToGo
|
|
45
45
|
[
|
46
46
|
{ :id => :created_by_reference, :type => :coworker_reference, :element_name => :created_by },
|
47
47
|
{ :id => :organization_reference, :type => :organization_reference, :element_name => :organization },
|
48
|
+
{ :id => :person_reference, :type => :person_reference, :element_name => :person },
|
48
49
|
{ :id => :deal_reference, :type => :deal_reference, :element_name => :deal }
|
49
50
|
]
|
50
51
|
end
|
@@ -90,6 +91,14 @@ module MoveToGo
|
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
94
|
+
def person=(person)
|
95
|
+
@person_reference = PersonReference.from_person(person)
|
96
|
+
|
97
|
+
if person.is_a?(Person)
|
98
|
+
@person = person
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
93
102
|
def deal=(deal)
|
94
103
|
@deal_reference = DealReference.from_deal(deal)
|
95
104
|
|
@@ -179,12 +188,8 @@ module MoveToGo
|
|
179
188
|
error = "#{error}Created_by is required for file (#{@name}).\n"
|
180
189
|
end
|
181
190
|
|
182
|
-
if @organization_reference.nil? && @deal_reference.nil?
|
183
|
-
error = "#{error}The file (#{@name}) must have either an organization or a deal.\n"
|
184
|
-
end
|
185
|
-
|
186
|
-
if !@organization_reference.nil? && !@deal_reference.nil?
|
187
|
-
error = "#{error}The file (#{@name}) can't be attached to both an organization and a deal."
|
191
|
+
if @organization_reference.nil? && @deal_reference.nil? && @person_reference.nil?
|
192
|
+
error = "#{error}The file (#{@name}) must have either an organization, person or a deal.\n"
|
188
193
|
end
|
189
194
|
|
190
195
|
return error
|
@@ -98,7 +98,8 @@ module MoveToGo
|
|
98
98
|
raise_if_immutable
|
99
99
|
if classification == HistoryClassification::Comment || classification == HistoryClassification::SalesCall ||
|
100
100
|
classification == HistoryClassification::TalkedTo || classification == HistoryClassification::TriedToReach ||
|
101
|
-
classification == HistoryClassification::ClientVisit
|
101
|
+
classification == HistoryClassification::ClientVisit ||
|
102
|
+
classification == HistoryClassification::MailMessage
|
102
103
|
@classification = classification
|
103
104
|
else
|
104
105
|
raise InvalidHistoryClassificationError, classification
|
@@ -129,6 +130,10 @@ module MoveToGo
|
|
129
130
|
@text.gsub!("\b", "")
|
130
131
|
end
|
131
132
|
|
133
|
+
def date=(date)
|
134
|
+
@date = DateTime.parse(date)
|
135
|
+
end
|
136
|
+
|
132
137
|
def validate
|
133
138
|
error = String.new
|
134
139
|
|
@@ -3,7 +3,7 @@ module MoveToGo
|
|
3
3
|
include SerializeHelper
|
4
4
|
attr_accessor :id, :integration_id, :url, :name, :description
|
5
5
|
|
6
|
-
attr_reader :organization, :created_by, :deal
|
6
|
+
attr_reader :organization, :created_by, :deal, :person
|
7
7
|
|
8
8
|
def initialize(opt = nil)
|
9
9
|
if !opt.nil?
|
@@ -28,6 +28,7 @@ module MoveToGo
|
|
28
28
|
[
|
29
29
|
{ :id => :created_by_reference, :type => :coworker_reference, :element_name => :created_by },
|
30
30
|
{ :id => :organization_reference, :type => :organization_reference, :element_name => :organization },
|
31
|
+
{ :id => :person_reference, :type => :person_reference, :element_name => :person },
|
31
32
|
{ :id => :deal_reference, :type => :deal_reference, :element_name => :deal }
|
32
33
|
]
|
33
34
|
end
|
@@ -40,6 +41,14 @@ module MoveToGo
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
44
|
+
def person=(person)
|
45
|
+
@person_reference = PersonReference.from_person(person)
|
46
|
+
|
47
|
+
if person.is_a?(Person)
|
48
|
+
@person = person
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
43
52
|
def deal=(deal)
|
44
53
|
@deal_reference = DealReference.from_deal(deal)
|
45
54
|
|
@@ -67,12 +76,8 @@ module MoveToGo
|
|
67
76
|
error = "#{error}Created_by is required for link\n"
|
68
77
|
end
|
69
78
|
|
70
|
-
if @organization_reference.nil? && @deal_reference.nil?
|
71
|
-
error = "#{error}A link must have either an organization or a deal\n"
|
72
|
-
end
|
73
|
-
|
74
|
-
if !@organization_reference.nil? && !@deal_reference.nil?
|
75
|
-
error = "#{error}A link can't be attached to both an organization and a deal"
|
79
|
+
if @organization_reference.nil? && @deal_reference.nil? && @person_reference.nil?
|
80
|
+
error = "#{error}A link must have either an organization, person or a deal\n"
|
76
81
|
end
|
77
82
|
|
78
83
|
return error
|
@@ -0,0 +1,219 @@
|
|
1
|
+
module MoveToGo
|
2
|
+
class Meeting < CanBecomeImmutable
|
3
|
+
include SerializeHelper
|
4
|
+
##
|
5
|
+
# :attr_accessor: id
|
6
|
+
immutable_accessor :id
|
7
|
+
##
|
8
|
+
# :attr_accessor: integration_id
|
9
|
+
immutable_accessor :integration_id
|
10
|
+
|
11
|
+
attr_reader :text, :heading, :date_stop, :location
|
12
|
+
attr_reader :date_start, :date_start_has_time, :datechecked
|
13
|
+
attr_reader :organization, :created_by, :assigned_coworker, :person, :deal
|
14
|
+
|
15
|
+
def initialize(opt = nil)
|
16
|
+
if !opt.nil?
|
17
|
+
serialize_variables.each do |myattr|
|
18
|
+
val = opt[myattr[:id]]
|
19
|
+
instance_variable_set("@" + myattr[:id].to_s, val) if val != nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def serialize_variables
|
25
|
+
[ :id, :text, :heading, :location, :integration_id ].map {
|
26
|
+
|p| {
|
27
|
+
:id => p,
|
28
|
+
:type => :string
|
29
|
+
}
|
30
|
+
} +
|
31
|
+
[
|
32
|
+
{ :id => :date_start, :type => :datetime },
|
33
|
+
{ :id => :date_stop, :type => :datetime },
|
34
|
+
{ :id => :date_start_has_time, :type => :bool },
|
35
|
+
{ :id => :created_by_reference, :type => :coworker_reference, :element_name => :created_by },
|
36
|
+
{ :id => :assigned_coworker_reference, :type => :coworker_reference, :element_name => :assigned_coworker },
|
37
|
+
{ :id => :organization_reference, :type => :organization_reference, :element_name => :organization },
|
38
|
+
{ :id => :deal_reference, :type => :deal_reference, :element_name => :deal },
|
39
|
+
{ :id => :person_reference, :type => :person_reference, :element_name => :person }
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_import_rows
|
44
|
+
(serialize_variables + [
|
45
|
+
{ :id => :organization, :type => :organization_reference},
|
46
|
+
{ :id => :person, :type => :person_reference}
|
47
|
+
]).map do |p|
|
48
|
+
map_to_row p
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def serialize_name
|
53
|
+
"Meeting"
|
54
|
+
end
|
55
|
+
|
56
|
+
def organization=(org)
|
57
|
+
raise_if_immutable
|
58
|
+
@organization_reference = OrganizationReference.from_organization(org)
|
59
|
+
|
60
|
+
if org.is_a?(Organization)
|
61
|
+
@organization = org
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def created_by=(coworker)
|
66
|
+
raise_if_immutable
|
67
|
+
@created_by_reference = CoworkerReference.from_coworker(coworker)
|
68
|
+
|
69
|
+
if coworker.is_a?(Coworker)
|
70
|
+
@created_by = coworker
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def assigned_coworker=(coworker)
|
75
|
+
raise_if_immutable
|
76
|
+
@assigned_coworker_reference = CoworkerReference.from_coworker(coworker)
|
77
|
+
|
78
|
+
if coworker.is_a?(Coworker)
|
79
|
+
@assigned_coworker = coworker
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def person=(person)
|
84
|
+
raise_if_immutable
|
85
|
+
@person_reference = PersonReference.from_person(person)
|
86
|
+
|
87
|
+
if person.is_a?(Person)
|
88
|
+
@person = person
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def deal=(deal)
|
93
|
+
raise_if_immutable
|
94
|
+
@deal_reference = DealReference.from_deal(deal)
|
95
|
+
|
96
|
+
if deal.is_a?(Deal)
|
97
|
+
@deal = deal
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def text=(text)
|
102
|
+
raise_if_immutable
|
103
|
+
@text = text
|
104
|
+
|
105
|
+
if @text.nil?
|
106
|
+
return
|
107
|
+
end
|
108
|
+
|
109
|
+
if @text.length == 0
|
110
|
+
return
|
111
|
+
end
|
112
|
+
|
113
|
+
@text.strip!
|
114
|
+
|
115
|
+
# remove form feeds
|
116
|
+
@text.gsub!("\f", "")
|
117
|
+
|
118
|
+
# remove vertical spaces
|
119
|
+
@text.gsub!("\v", "")
|
120
|
+
|
121
|
+
# remove backspace
|
122
|
+
@text.gsub!("\b", "")
|
123
|
+
end
|
124
|
+
|
125
|
+
def heading=(heading)
|
126
|
+
raise_if_immutable
|
127
|
+
@heading = heading
|
128
|
+
|
129
|
+
if @heading.nil?
|
130
|
+
return
|
131
|
+
end
|
132
|
+
|
133
|
+
if @heading.length == 0
|
134
|
+
return
|
135
|
+
end
|
136
|
+
|
137
|
+
@heading.strip!
|
138
|
+
|
139
|
+
# remove form feeds
|
140
|
+
@heading.gsub!("\f", "")
|
141
|
+
|
142
|
+
# remove vertical spaces
|
143
|
+
@heading.gsub!("\v", "")
|
144
|
+
|
145
|
+
# remove backspace
|
146
|
+
@heading.gsub!("\b", "")
|
147
|
+
end
|
148
|
+
|
149
|
+
def location=(location)
|
150
|
+
raise_if_immutable
|
151
|
+
@location = location
|
152
|
+
|
153
|
+
if @location.nil?
|
154
|
+
return
|
155
|
+
end
|
156
|
+
|
157
|
+
if @location.length == 0
|
158
|
+
return
|
159
|
+
end
|
160
|
+
|
161
|
+
@location.strip!
|
162
|
+
|
163
|
+
# remove form feeds
|
164
|
+
@location.gsub!("\f", "")
|
165
|
+
|
166
|
+
# remove vertical spaces
|
167
|
+
@location.gsub!("\v", "")
|
168
|
+
|
169
|
+
# remove backspace
|
170
|
+
@location.gsub!("\b", "")
|
171
|
+
end
|
172
|
+
|
173
|
+
def date_start=(datetime)
|
174
|
+
@date_start = DateTime.parse(datetime)
|
175
|
+
end
|
176
|
+
|
177
|
+
def date_stop=(datetime)
|
178
|
+
@date_stop = DateTime.parse(datetime)
|
179
|
+
end
|
180
|
+
|
181
|
+
def date_start_has_time=(bool)
|
182
|
+
@date_start_has_time = bool
|
183
|
+
end
|
184
|
+
|
185
|
+
def datechecked=(datetime)
|
186
|
+
@datechecked = DateTime.parse(datetime)
|
187
|
+
end
|
188
|
+
|
189
|
+
def validate
|
190
|
+
error = String.new
|
191
|
+
|
192
|
+
if (@heading.nil? || @heading.empty?)
|
193
|
+
error = "Heading is required for meeting\n"
|
194
|
+
end
|
195
|
+
|
196
|
+
if @created_by.nil?
|
197
|
+
error = "#{error}Created_by is required for meeting\n"
|
198
|
+
end
|
199
|
+
|
200
|
+
if @date_start.nil?
|
201
|
+
error = "#{error}Date_start is required for meeting\n"
|
202
|
+
end
|
203
|
+
|
204
|
+
if @date_start_has_time.nil?
|
205
|
+
error = "#{error}Date_start_has_time is required for meeting\n"
|
206
|
+
end
|
207
|
+
|
208
|
+
if @date_stop.nil?
|
209
|
+
error = "#{error}Date_stop is required for meeting\n"
|
210
|
+
end
|
211
|
+
|
212
|
+
if @organization.nil?
|
213
|
+
error = "#{error}Organization is required for meeting\n"
|
214
|
+
end
|
215
|
+
|
216
|
+
return error
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
@@ -196,6 +196,14 @@ module MoveToGo
|
|
196
196
|
@rootmodel.select_histories{|history| history.organization == self}
|
197
197
|
end
|
198
198
|
|
199
|
+
def todos
|
200
|
+
@rootmodel.select_todos{|todo| todo.organization == self}
|
201
|
+
end
|
202
|
+
|
203
|
+
def meetings
|
204
|
+
@rootmodel.select_meetings{|meeting| meeting.organization == self}
|
205
|
+
end
|
206
|
+
|
199
207
|
def documents(type)
|
200
208
|
@rootmodel.select_documents(type){|doc| doc.organization == self}
|
201
209
|
end
|
@@ -227,7 +235,7 @@ module MoveToGo
|
|
227
235
|
end
|
228
236
|
|
229
237
|
def find_employee_by_integration_id(integration_id)
|
230
|
-
return nil if @employees.nil?
|
238
|
+
return nil if @employees.nil? || integration_id.nil?
|
231
239
|
return @employees.find do |e|
|
232
240
|
e.integration_id == integration_id
|
233
241
|
end
|
@@ -6,7 +6,13 @@ module MoveToGo
|
|
6
6
|
[ :id, :integration_id ].map { |prop| {:id=>prop,:type=>:string} }
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def initialize(opt = nil)
|
10
|
+
if opt != nil
|
11
|
+
serialize_variables.each do |var|
|
12
|
+
value = opt[var[:id]]
|
13
|
+
instance_variable_set("@" + var[:id].to_s, value) if value != nil
|
14
|
+
end
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
def to_s
|
@@ -70,6 +76,9 @@ module MoveToGo
|
|
70
76
|
##
|
71
77
|
# :attr_accessor: currently_employed
|
72
78
|
immutable_accessor :currently_employed
|
79
|
+
##
|
80
|
+
# :attr_accessor: has_mail_consent
|
81
|
+
immutable_accessor :has_mail_consent
|
73
82
|
|
74
83
|
# you add custom values by using {#set_custom_value}
|
75
84
|
attr_reader :custom_values, :organization
|
@@ -141,6 +150,7 @@ module MoveToGo
|
|
141
150
|
{:id => :postal_address, :type => :address},
|
142
151
|
{:id => :custom_values, :type => :custom_values},
|
143
152
|
{:id => :currently_employed, :type => :bool},
|
153
|
+
{:id => :has_mail_consent, :type => :bool},
|
144
154
|
{:id => :organization, :type => :organization_reference},
|
145
155
|
|
146
156
|
]
|
@@ -11,7 +11,7 @@ module MoveToGo
|
|
11
11
|
# responsible for objects that requires a coworker, eg a history.
|
12
12
|
attr_accessor :migrator_coworker
|
13
13
|
|
14
|
-
attr_accessor :settings, :organizations, :coworkers, :deals, :histories
|
14
|
+
attr_accessor :settings, :organizations, :coworkers, :deals, :histories, :todos, :meetings
|
15
15
|
|
16
16
|
# The configuration is used to set run-time properties for
|
17
17
|
# move-to-go. This should not be confused with the model's
|
@@ -31,6 +31,8 @@ module MoveToGo
|
|
31
31
|
{:id => :organizations, :type => :organizations},
|
32
32
|
{:id => :deals, :type => :deals},
|
33
33
|
{:id => :histories, :type => :histories},
|
34
|
+
{:id => :todos, :type => :todos},
|
35
|
+
{:id => :meetings, :type => :meetings},
|
34
36
|
{:id => :documents, :type => :documents}
|
35
37
|
]
|
36
38
|
end
|
@@ -52,6 +54,8 @@ module MoveToGo
|
|
52
54
|
@coworkers[@migrator_coworker.integration_id] = @migrator_coworker
|
53
55
|
@deals = {}
|
54
56
|
@histories = {}
|
57
|
+
@todos = {}
|
58
|
+
@meetings = {}
|
55
59
|
@documents = Documents.new
|
56
60
|
@configuration = {}
|
57
61
|
|
@@ -149,11 +153,17 @@ module MoveToGo
|
|
149
153
|
select_histories{|history| history.organization == organization}
|
150
154
|
.each{|history| @histories.delete(history.integration_id)}
|
151
155
|
|
156
|
+
select_todos{|todo| todo.organization == organization}
|
157
|
+
.each{|todo| @todo.delete(todo.integration_id)}
|
158
|
+
|
159
|
+
select_meetings{|meeting| meeting.organization == organization}
|
160
|
+
.each{|meeting| @meeting.delete(meeting.integration_id)}
|
161
|
+
|
152
162
|
select_documents(:file){|file| file.organization == organization}
|
153
163
|
.each{|file| @documents.files.delete(file.integration_id)}
|
154
164
|
|
155
|
-
select_documents(:link){|
|
156
|
-
.each{|
|
165
|
+
select_documents(:link){|doc| doc.organization == organization}
|
166
|
+
.each{|doc| @documents.links.delete(doc.integration_id)}
|
157
167
|
|
158
168
|
@organizations.delete(organization.integration_id)
|
159
169
|
|
@@ -295,6 +305,60 @@ module MoveToGo
|
|
295
305
|
return history
|
296
306
|
end
|
297
307
|
|
308
|
+
def add_todo(todo)
|
309
|
+
if todo.nil?
|
310
|
+
return nil
|
311
|
+
end
|
312
|
+
|
313
|
+
if !todo.is_a?(Todo)
|
314
|
+
raise ArgumentError.new("Expected an todo")
|
315
|
+
end
|
316
|
+
|
317
|
+
if todo.integration_id.nil? || todo.integration_id.length == 0
|
318
|
+
todo.integration_id = "todo_#{@todos.length}"
|
319
|
+
end
|
320
|
+
|
321
|
+
if find_todo_by_integration_id(todo.integration_id, false) != nil
|
322
|
+
raise AlreadyAddedError, "Already added a todo with integration_id #{todo.integration_id}"
|
323
|
+
end
|
324
|
+
|
325
|
+
if todo.created_by.nil?
|
326
|
+
todo.created_by = @migrator_coworker
|
327
|
+
end
|
328
|
+
|
329
|
+
@todos[todo.integration_id] = todo
|
330
|
+
todo.set_is_immutable
|
331
|
+
|
332
|
+
return todo
|
333
|
+
end
|
334
|
+
|
335
|
+
def add_meeting(meeting)
|
336
|
+
if meeting.nil?
|
337
|
+
return nil
|
338
|
+
end
|
339
|
+
|
340
|
+
if !meeting.is_a?(Meeting)
|
341
|
+
raise ArgumentError.new("Expected an meeting")
|
342
|
+
end
|
343
|
+
|
344
|
+
if meeting.integration_id.nil? || meeting.integration_id.length == 0
|
345
|
+
meeting.integration_id = "meeting_#{@meetings.length}"
|
346
|
+
end
|
347
|
+
|
348
|
+
if find_meeting_by_integration_id(meeting.integration_id, false) != nil
|
349
|
+
raise AlreadyAddedError, "Already added a meeting with integration_id #{meeting.integration_id}"
|
350
|
+
end
|
351
|
+
|
352
|
+
if meeting.created_by.nil?
|
353
|
+
meeting.created_by = @migrator_coworker
|
354
|
+
end
|
355
|
+
|
356
|
+
@meetings[meeting.integration_id] = meeting
|
357
|
+
meeting.set_is_immutable
|
358
|
+
|
359
|
+
return meeting
|
360
|
+
end
|
361
|
+
|
298
362
|
def add_link(link)
|
299
363
|
@documents = Documents.new if @documents == nil
|
300
364
|
|
@@ -345,6 +409,24 @@ module MoveToGo
|
|
345
409
|
end
|
346
410
|
end
|
347
411
|
|
412
|
+
def find_todo_by_integration_id(integration_id, report_result=!!configuration[:report_result])
|
413
|
+
if @todos.has_key?(integration_id)
|
414
|
+
return @todos[integration_id]
|
415
|
+
else
|
416
|
+
report_failed_to_find_object("todo", ":#{integration_id}") if report_result
|
417
|
+
return nil
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
def find_meeting_by_integration_id(integration_id, report_result=!!configuration[:report_result])
|
422
|
+
if @meetings.has_key?(integration_id)
|
423
|
+
return @meetings[integration_id]
|
424
|
+
else
|
425
|
+
report_failed_to_find_object("meeting", ":#{integration_id}") if report_result
|
426
|
+
return nil
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
348
430
|
# find deals for organization using {Organization#integration_id}
|
349
431
|
def find_deals_for_organization(organization)
|
350
432
|
deals = []
|
@@ -368,7 +450,7 @@ module MoveToGo
|
|
368
450
|
# Returns the first found matching organization
|
369
451
|
# Method is much slower then using find_organization_by_integration_id
|
370
452
|
# @example Finds a organization on its name
|
371
|
-
# rm.find_organization {|org| org.name == "
|
453
|
+
# rm.find_organization {|org| org.name == "Lime Technologies" }
|
372
454
|
def find_organization(report_result=!!configuration[:report_result], &block)
|
373
455
|
result = find(@organizations.values.flatten, &block)
|
374
456
|
report_failed_to_find_object("organization") if result.nil? and report_result
|
@@ -378,7 +460,7 @@ module MoveToGo
|
|
378
460
|
# Finds organizations based on one of their property.
|
379
461
|
# Returns all matching organizations
|
380
462
|
# @example Selects organizations on their names
|
381
|
-
# rm.select_organizations {|org| org.name == "
|
463
|
+
# rm.select_organizations {|org| org.name == "Lime Technologies" }
|
382
464
|
def select_organizations(report_result=!!configuration[:report_result], &block)
|
383
465
|
result = select(@organizations.values.flatten, &block)
|
384
466
|
report_failed_to_find_object("organization") if result.empty? and report_result
|
@@ -467,6 +549,46 @@ module MoveToGo
|
|
467
549
|
return result
|
468
550
|
end
|
469
551
|
|
552
|
+
# Finds a todo based on one of its property.
|
553
|
+
# Returns the first found matching todo
|
554
|
+
# @example Finds a todo on its name
|
555
|
+
# rm.find_todo {|todo| todo.text == "hello!" }
|
556
|
+
def find_todo(report_result=!!configuration[:report_result], &block)
|
557
|
+
result = find(@todos.values.flatten, &block)
|
558
|
+
report_failed_to_find_object("todo") if result.nil? and report_result
|
559
|
+
return result
|
560
|
+
end
|
561
|
+
|
562
|
+
# Finds a todo based on one of its property.
|
563
|
+
# Returns all found matching todo
|
564
|
+
# @example Finds a todo on its name
|
565
|
+
# rm.select_todo {|todo| todo.text == "hello!" }
|
566
|
+
def select_todos(report_result=!!configuration[:report_result], &block)
|
567
|
+
result = select(@todos.values.flatten, &block)
|
568
|
+
report_failed_to_find_object("todo") if result.nil? and report_result
|
569
|
+
return result
|
570
|
+
end
|
571
|
+
|
572
|
+
# Finds a meeting based on one of its property.
|
573
|
+
# Returns the first found matching meeting
|
574
|
+
# @example Finds a meeting on its name
|
575
|
+
# rm.find_meeting {|meeting| meeting.text == "hello!" }
|
576
|
+
def find_meeting(report_result=!!configuration[:report_result], &block)
|
577
|
+
result = find(@meetings.values.flatten, &block)
|
578
|
+
report_failed_to_find_object("meeting") if result.nil? and report_result
|
579
|
+
return result
|
580
|
+
end
|
581
|
+
|
582
|
+
# Finds a meeting based on one of its property.
|
583
|
+
# Returns all found matching meeting
|
584
|
+
# @example Finds a meeting on its name
|
585
|
+
# rm.select_meeting {|meeting| meeting.text == "hello!" }
|
586
|
+
def select_meetings(report_result=!!configuration[:report_result], &block)
|
587
|
+
result = select(@meetings.values.flatten, &block)
|
588
|
+
report_failed_to_find_object("meeting") if result.nil? and report_result
|
589
|
+
return result
|
590
|
+
end
|
591
|
+
|
470
592
|
# Finds a document based on one of its property.
|
471
593
|
# Returns the first found matching document
|
472
594
|
# @example Finds a document on its name
|
@@ -568,6 +690,22 @@ module MoveToGo
|
|
568
690
|
end
|
569
691
|
end
|
570
692
|
|
693
|
+
@todos.each do |key, todo|
|
694
|
+
validation_message = todo.validate
|
695
|
+
|
696
|
+
if !validation_message.empty?
|
697
|
+
errors = "#{errors}\n#{validation_message}"
|
698
|
+
end
|
699
|
+
end
|
700
|
+
|
701
|
+
@meetings.each do |key, meeting|
|
702
|
+
validation_message = meeting.validate
|
703
|
+
|
704
|
+
if !validation_message.empty?
|
705
|
+
errors = "#{errors}\n#{validation_message}"
|
706
|
+
end
|
707
|
+
end
|
708
|
+
|
571
709
|
@documents.links.each do |link|
|
572
710
|
validation_message = link.validate
|
573
711
|
if !validation_message.empty?
|
@@ -619,6 +757,8 @@ module MoveToGo
|
|
619
757
|
@coworkers = []
|
620
758
|
@deals = []
|
621
759
|
@histories = []
|
760
|
+
@todos = []
|
761
|
+
@meetings = []
|
622
762
|
@documents = saved_documents
|
623
763
|
serialize_to_file(go_files_file)
|
624
764
|
|
@@ -678,6 +818,8 @@ module MoveToGo
|
|
678
818
|
" Persons: #{persons.length}\n" \
|
679
819
|
" Deals: #{@deals.length}\n" \
|
680
820
|
" History logs: #{@histories.length}\n" \
|
821
|
+
" Todos: #{@todos.length}\n" \
|
822
|
+
" Meetings: #{@meetings.length}\n" \
|
681
823
|
" Documents: #{nbr_of_documents}"
|
682
824
|
end
|
683
825
|
|