move-to-go 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,6 +39,22 @@ require 'move-to-go'
39
39
  ## Constants
40
40
  # Edit these constants to fit your needs
41
41
 
42
+ # The export folder, it's probably called 'Export' if you haven't changed it.
43
+ EXPORT_FOLDER = 'Export'
44
+
45
+ # This file referes to the consent set super field in Lime Easy
46
+ # where the customer have their email consents.
47
+ PERSON_CONSENT_FILE = "#{EXPORT_FOLDER}/Company-Person-Samtycken.txt"
48
+
49
+ # Valid Consents strings for setting E-mail consent.
50
+ # Which of the set alternatives should be converted to
51
+ # E-mail consent in Lime Go. Just name them here, and
52
+ # move-to-go will fetch them from the file above.
53
+
54
+ # VALID_EMAIL_CONSENTS = ['Ok för nyhetsbrev', 'Ok för produktnyheter']
55
+ VALID_EMAIL_CONSENTS = ['Nyhetsbrev']
56
+
57
+
42
58
  # determines if documents should be imported.
43
59
  # IMPORT_DOCUMENTS = true
44
60
 
@@ -305,7 +321,7 @@ class Converter
305
321
  # return the note will get the default classification 'Comment'
306
322
 
307
323
  # case activity
308
- # when 'SalesCall'
324
+ # when 'SalesCall'
309
325
  # classification = MoveToGo::HistoryClassification::SalesCall
310
326
  # when 'Customer Visit'
311
327
  # classification = MoveToGo::HistoryClassification::ClientVisit
@@ -314,7 +330,7 @@ class Converter
314
330
  # else
315
331
  # classification = MoveToGo::HistoryClassification::Comment
316
332
  # end
317
-
333
+
318
334
  # return classification
319
335
  end
320
336
 
@@ -326,20 +342,20 @@ class Converter
326
342
  # in LIME Go. The return value must be a value from the
327
343
  # MoveToGo::HistoryClassification enum. If no classification is
328
344
  # return the history will get the default classification 'Comment'
329
-
345
+
330
346
  # case activity
331
- # when 'Installation'
347
+ # when 'Installation'
332
348
  # classification = MoveToGo::HistoryClassification::ClientVisit
333
349
  # when 'No answer'
334
350
  # classification = MoveToGo::HistoryClassification::TriedToReach
335
351
  # else
336
352
  # classification = MoveToGo::HistoryClassification::Comment
337
353
  # end
338
-
354
+
339
355
  # return classification
340
356
  end
341
357
 
342
-
358
+
343
359
 
344
360
  # HOOKS
345
361
  #
@@ -355,7 +371,7 @@ class Converter
355
371
  # rootmodel.add_comment(comment)
356
372
  # end
357
373
  #end
358
-
374
+
359
375
 
360
376
  end
361
377
 
@@ -0,0 +1,152 @@
1
+ require "spec_helper"
2
+ require 'move-to-go'
3
+
4
+ describe "Meeting" do
5
+ let("meeting") {
6
+ MoveToGo::Meeting.new
7
+ }
8
+
9
+ it "must have a text" do
10
+ meeting.validate.length.should be > 0
11
+ end
12
+
13
+ it "is valid when it has attributes and organization" do
14
+ # given
15
+ meeting.heading = "They are very interested in the new deal (the one where you get a free bike as a gift)"
16
+ meeting.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
17
+ meeting.organization = MoveToGo::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
18
+ meeting.assigned_coworker = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
19
+ meeting.date_start = "2011-01-01 10:00"
20
+ meeting.date_stop = "2011-01-01 12:00"
21
+ meeting.date_start_has_time = true
22
+
23
+ # when, then
24
+ meeting.validate.should eq ""
25
+ end
26
+
27
+ it "is valid when it has text, created_by, assigned_coworker, date_start, date_start_has_time, org and person" do
28
+ # given
29
+ meeting.heading = "They are very interested in the new deal (the one where you get a free bike as a gift)"
30
+ meeting.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
31
+ meeting.organization = MoveToGo::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
32
+ meeting.person = MoveToGo::Person.new({ :integration_id => "456", :heading => "Billy Bob" })
33
+ meeting.assigned_coworker = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
34
+ meeting.date_start = "2011-01-01 10:00"
35
+ meeting.date_stop = "2011-01-01 12:00"
36
+ meeting.date_start_has_time = true
37
+
38
+ # when, then
39
+ meeting.validate.should eq ""
40
+ end
41
+
42
+ it "is valid when it has text, created_by, assigned_coworker, date_start, date_start_has_time, org and deal" do
43
+ # given
44
+ meeting.heading = "They are very interested in the new deal (the one where you get a free bike as a gift)"
45
+ meeting.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
46
+ meeting.organization = MoveToGo::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
47
+ meeting.deal = MoveToGo::Deal.new({ :integration_id => "456", :heading => "The new deal" })
48
+ meeting.assigned_coworker = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
49
+ meeting.date_start = "2011-01-01 10:00"
50
+ meeting.date_stop = "2011-01-01 12:00"
51
+ meeting.date_start_has_time = true
52
+
53
+ # when, then
54
+ meeting.validate.should eq ""
55
+ end
56
+
57
+ it "is invalid if no meeting has no attached objects" do
58
+ # given
59
+ meeting.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
60
+ meeting.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
61
+
62
+ # when, then
63
+ meeting.validate.length.should be > 0
64
+ end
65
+
66
+ it "will set organization ref when organization is assigned" do
67
+ # given
68
+ org = MoveToGo::Organization.new({:integration_id => "123", :name => "Beagle Boys!"})
69
+
70
+ # when
71
+ meeting.organization = org
72
+
73
+ # then
74
+ meeting.organization.is_a?(MoveToGo::Organization).should eq true
75
+ meeting.instance_variable_get(:@organization_reference).is_a?(MoveToGo::OrganizationReference).should eq true
76
+ end
77
+
78
+ it "will set person ref when person is assigned" do
79
+ # given
80
+ person = MoveToGo::Person.new({:integration_id => "123" })
81
+ person.parse_name_to_firstname_lastname_se "Billy Bob"
82
+
83
+ # when
84
+ meeting.person = person
85
+
86
+ # then
87
+ meeting.person.is_a?(MoveToGo::Person).should eq true
88
+ meeting.instance_variable_get(:@person_reference).is_a?(MoveToGo::PersonReference).should eq true
89
+ end
90
+
91
+ it "will set coworker ref when coworker is assigned" do
92
+ # given
93
+ coworker = MoveToGo::Coworker.new({:integration_id => "123" })
94
+ coworker.parse_name_to_firstname_lastname_se "Billy Bob"
95
+
96
+ # when
97
+ meeting.created_by = coworker
98
+
99
+ # then
100
+ meeting.created_by.is_a?(MoveToGo::Coworker).should eq true
101
+ meeting.instance_variable_get(:@created_by_reference).is_a?(MoveToGo::CoworkerReference).should eq true
102
+ end
103
+
104
+ it "will set deal ref when deal is assigned" do
105
+ # given
106
+ deal = MoveToGo::Deal.new({:integration_id => "123" })
107
+ deal.name = "The new deal"
108
+
109
+ # when
110
+ meeting.deal = deal
111
+
112
+ # then
113
+ meeting.deal.is_a?(MoveToGo::Deal).should eq true
114
+ meeting.instance_variable_get(:@deal_reference).is_a?(MoveToGo::DealReference).should eq true
115
+ end
116
+
117
+ it "should remove form feed from text" do
118
+ # given
119
+ textWithFormFeed = "Text with form feed"
120
+ textWithoutFormFeed = "Text with form feed"
121
+
122
+ # when
123
+ meeting.text = textWithFormFeed
124
+
125
+ # then
126
+ meeting.text.should eq textWithoutFormFeed
127
+ end
128
+
129
+ it "should remove vertical tab from text" do
130
+ # given
131
+ textWithVerticalTab = "Text with \vvertical tab"
132
+ textWithoutVerticalTab = "Text with vertical tab"
133
+
134
+ # when
135
+ meeting.text = textWithVerticalTab
136
+
137
+ # then
138
+ meeting.text.should eq textWithoutVerticalTab
139
+ end
140
+
141
+ it "should remove backspace from text" do
142
+ # given
143
+ textWithBackSpace = "Text with \bbackspace"
144
+ textWithoutBackSpace = "Text with backspace"
145
+
146
+ # when
147
+ meeting.text = textWithBackSpace
148
+
149
+ # then
150
+ meeting.text.should eq textWithoutBackSpace
151
+ end
152
+ end
@@ -0,0 +1,149 @@
1
+ require "spec_helper"
2
+ require 'move-to-go'
3
+
4
+ describe "Todo" do
5
+ let("todo") {
6
+ MoveToGo::Todo.new
7
+ }
8
+
9
+ it "must have a text" do
10
+ todo.validate.length.should be > 0
11
+ end
12
+
13
+ it "is valid when it has text, created_by, assigned_coworker, date_start, date_start_has_time and organization" do
14
+ # given
15
+ todo.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
16
+ todo.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
17
+ todo.organization = MoveToGo::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
18
+ todo.assigned_coworker = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
19
+ todo.date_start = "2011-01-01"
20
+ todo.date_start_has_time = false
21
+
22
+ # when, then
23
+ todo.validate.should eq ""
24
+ end
25
+
26
+ it "is valid when it has text, created_by, assigned_coworker, date_start, date_start_has_time, org and person" do
27
+ # given
28
+ todo.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
29
+ todo.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
30
+ todo.organization = MoveToGo::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
31
+ todo.person = MoveToGo::Person.new({ :integration_id => "456", :heading => "Billy Bob" })
32
+ todo.assigned_coworker = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
33
+ todo.date_start = "2011-01-01"
34
+ todo.date_start_has_time = false
35
+
36
+ # when, then
37
+ todo.validate.should eq ""
38
+ end
39
+
40
+ it "is valid when it has text, created_by, assigned_coworker, date_start, date_start_has_time, org and deal" do
41
+ # given
42
+ todo.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
43
+ todo.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
44
+ todo.organization = MoveToGo::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
45
+ todo.deal = MoveToGo::Deal.new({ :integration_id => "456", :heading => "The new deal" })
46
+ todo.assigned_coworker = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
47
+ todo.date_start = "2011-01-01"
48
+ todo.date_start_has_time = false
49
+
50
+ # when, then
51
+ todo.validate.should eq ""
52
+ end
53
+
54
+ it "is invalid if no todo has no attached objects" do
55
+ # given
56
+ todo.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
57
+ todo.created_by = MoveToGo::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
58
+
59
+ # when, then
60
+ todo.validate.length.should be > 0
61
+ end
62
+
63
+ it "will set organization ref when organization is assigned" do
64
+ # given
65
+ org = MoveToGo::Organization.new({:integration_id => "123", :name => "Beagle Boys!"})
66
+
67
+ # when
68
+ todo.organization = org
69
+
70
+ # then
71
+ todo.organization.is_a?(MoveToGo::Organization).should eq true
72
+ todo.instance_variable_get(:@organization_reference).is_a?(MoveToGo::OrganizationReference).should eq true
73
+ end
74
+
75
+ it "will set person ref when person is assigned" do
76
+ # given
77
+ person = MoveToGo::Person.new({:integration_id => "123" })
78
+ person.parse_name_to_firstname_lastname_se "Billy Bob"
79
+
80
+ # when
81
+ todo.person = person
82
+
83
+ # then
84
+ todo.person.is_a?(MoveToGo::Person).should eq true
85
+ todo.instance_variable_get(:@person_reference).is_a?(MoveToGo::PersonReference).should eq true
86
+ end
87
+
88
+ it "will set coworker ref when coworker is assigned" do
89
+ # given
90
+ coworker = MoveToGo::Coworker.new({:integration_id => "123" })
91
+ coworker.parse_name_to_firstname_lastname_se "Billy Bob"
92
+
93
+ # when
94
+ todo.created_by = coworker
95
+
96
+ # then
97
+ todo.created_by.is_a?(MoveToGo::Coworker).should eq true
98
+ todo.instance_variable_get(:@created_by_reference).is_a?(MoveToGo::CoworkerReference).should eq true
99
+ end
100
+
101
+ it "will set deal ref when deal is assigned" do
102
+ # given
103
+ deal = MoveToGo::Deal.new({:integration_id => "123" })
104
+ deal.name = "The new deal"
105
+
106
+ # when
107
+ todo.deal = deal
108
+
109
+ # then
110
+ todo.deal.is_a?(MoveToGo::Deal).should eq true
111
+ todo.instance_variable_get(:@deal_reference).is_a?(MoveToGo::DealReference).should eq true
112
+ end
113
+
114
+ it "should remove form feed from text" do
115
+ # given
116
+ textWithFormFeed = "Text with form feed"
117
+ textWithoutFormFeed = "Text with form feed"
118
+
119
+ # when
120
+ todo.text = textWithFormFeed
121
+
122
+ # then
123
+ todo.text.should eq textWithoutFormFeed
124
+ end
125
+
126
+ it "should remove vertical tab from text" do
127
+ # given
128
+ textWithVerticalTab = "Text with \vvertical tab"
129
+ textWithoutVerticalTab = "Text with vertical tab"
130
+
131
+ # when
132
+ todo.text = textWithVerticalTab
133
+
134
+ # then
135
+ todo.text.should eq textWithoutVerticalTab
136
+ end
137
+
138
+ it "should remove backspace from text" do
139
+ # given
140
+ textWithBackSpace = "Text with \bbackspace"
141
+ textWithoutBackSpace = "Text with backspace"
142
+
143
+ # when
144
+ todo.text = textWithBackSpace
145
+
146
+ # then
147
+ todo.text.should eq textWithoutBackSpace
148
+ end
149
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: move-to-go
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petter Sandholdt
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2018-04-05 00:00:00.000000000 Z
17
+ date: 2018-04-10 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: iso_country_codes
@@ -205,6 +205,7 @@ files:
205
205
  - lib/move-to-go/model/history.rb
206
206
  - lib/move-to-go/model/history_classification.rb
207
207
  - lib/move-to-go/model/link.rb
208
+ - lib/move-to-go/model/meeting.rb
208
209
  - lib/move-to-go/model/organization.rb
209
210
  - lib/move-to-go/model/organizations.rb
210
211
  - lib/move-to-go/model/person.rb
@@ -215,6 +216,7 @@ files:
215
216
  - lib/move-to-go/model/settings.rb
216
217
  - lib/move-to-go/model/tag.rb
217
218
  - lib/move-to-go/model/talkedto.rb
219
+ - lib/move-to-go/model/todo.rb
218
220
  - lib/move-to-go/model/triedtoreach.rb
219
221
  - lib/move-to-go/model_helpers.rb
220
222
  - lib/move-to-go/phone_helper.rb
@@ -312,11 +314,13 @@ files:
312
314
  - spec/helpers/xsd_validate_spec.rb
313
315
  - spec/history_spec.rb
314
316
  - spec/link_spec.rb
317
+ - spec/meeting_spec.rb
315
318
  - spec/organization_spec.rb
316
319
  - spec/organizations_spec.rb
317
320
  - spec/person_spec.rb
318
321
  - spec/rootmodel_spec.rb
319
322
  - spec/spec_helper.rb
323
+ - spec/todo_spec.rb
320
324
  homepage:
321
325
  licenses: []
322
326
  metadata:
@@ -360,8 +364,10 @@ test_files:
360
364
  - spec/helpers/xsd_validate_spec.rb
361
365
  - spec/history_spec.rb
362
366
  - spec/link_spec.rb
367
+ - spec/meeting_spec.rb
363
368
  - spec/organizations_spec.rb
364
369
  - spec/organization_spec.rb
365
370
  - spec/person_spec.rb
366
371
  - spec/rootmodel_spec.rb
367
372
  - spec/spec_helper.rb
373
+ - spec/todo_spec.rb