go_import 3.0.25 → 3.0.26

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.
@@ -0,0 +1,380 @@
1
+ # encoding: UTF-8
2
+ require 'go_import'
3
+
4
+ # Customize this file to suit your LIME Pro database structure.
5
+ #
6
+ # Documentation go_import can be found at
7
+ # http://rubygems.org/gems/go_import
8
+ #
9
+ # go_import contains all objects in LIME Go such as organization,
10
+ # people, deals, etc. What properties each object has is described in
11
+ # the documentation.
12
+ #
13
+ # *** NOTE:
14
+ #
15
+ # Integration-ID and LIME-links are automatically created for each
16
+ # object
17
+
18
+ # *** TODO:
19
+ #
20
+ # You must customize this template so it works with your LIME Pro
21
+ # database. Modify each to_* method and set properties on the LIME Go
22
+ # object.
23
+ #
24
+
25
+ ############################################################################
26
+ # Constants
27
+ # Edit these constants to fit your needs
28
+
29
+ # Connection to the SQL-server
30
+ # You can use either an AD-account or SQL-user credentials to authenticate.
31
+ # You will be prompted for the password when you run the import.
32
+ #
33
+ # Remove SQL_SERVER_USER or leave it empty if you want to connect with
34
+ # the user that is running go-import.
35
+ SQL_SERVER = ''
36
+ SQL_SERVER_DATABASE = ''
37
+ SQL_SERVER_USER = ''
38
+
39
+ # LIME Server
40
+ LIME_SERVER = ''
41
+ LIME_DATABASE = ''
42
+ LIME_LANGUAGE = 'sv' # Used for the values in set and option fields
43
+
44
+ # Companies
45
+ # Set the name of the relation field to the responsible coworker
46
+ ORGANIZATION_RESPONSIBLE_FIELD = 'coworker'
47
+
48
+ # Deals
49
+ # Set if deals should be imported and name of relationfields.
50
+ # Defaults should work well.
51
+ IMPORT_DEALS = false
52
+ DEAL_RESPONSIBLE_FIELD = 'coworker'
53
+ DEAL_COMPANY_FIELD = 'company'
54
+
55
+ # Notes
56
+ # Set if notes should be imported and name of relationfields.
57
+ # Defaults should work well
58
+ IMPORT_NOTES = true
59
+ NOTE_COWORKER_FIELD = 'coworker'
60
+ NOTE_COMPANY_FIELD = 'company'
61
+ NOTE_PERSON_FIELD = 'person'
62
+ NOTE_DEAL_FIELD = 'business'
63
+
64
+ ############################################################################
65
+
66
+ class Converter
67
+
68
+ # The to_coworker, to_organization, etc methods takes a LIME Go
69
+ # object (a coworker or organization etc) where some basic
70
+ # properties already has been set. The methods will also have a
71
+ # row argument that represents the database row in LIME Pro. Some
72
+ # methods will also get the rootmodel. You can use the rootmodel
73
+ # if you need to lookup coworkers or other object.
74
+ #
75
+ # The to_ methods should return the object that is provided as argument.
76
+ #
77
+ # We have included some sample code that shows how to set
78
+ # different properties. However, the goal is that you should NOT
79
+ # have to modify anything to get a basic import of a LIME Pro Core
80
+ # database.
81
+
82
+
83
+ # The following properties are set on the coworker by default:
84
+ #
85
+ # LIME Go field LIME Pro field label
86
+ # coworker.first_name and coworker.last_name Name
87
+ # coworker.email PrimaryEmail
88
+ # coworker.direct_phone_number BusinessTelephoneNumber
89
+ # coworker.mobile_phone_number MobileTelephoneNumber
90
+ def to_coworker(coworker, row)
91
+ # If your database dont have fields with the specifed labels,
92
+ # you must set properties as below.
93
+
94
+ # coworker.first_name = row["firstname"]
95
+ # coworker.last_name = row["lastname"]
96
+ # coworker.direct_phone_number = row["phone"]
97
+ # coworker.mobile_phone_number = row["cellphone"]
98
+ # coworker.email = row["email"]
99
+
100
+ return coworker
101
+ end
102
+
103
+ # The following properties are set on the organization by default:
104
+ #
105
+ # LIME Go field LIME Pro field label
106
+ # organization.name Name
107
+ # organization.organization_number CompanyNumber
108
+ # organization.email PrimaryEmailAddress
109
+ # organization.web_site BusinessHomePage
110
+ # organization.central_phone_number BusinessTelephoneNumber
111
+ # organization.postal_address.street StreetAddress + StreetAddress2
112
+ # organization.postal_address.zip_code ZipCode
113
+ # organization.postal_address.city City
114
+ # organization.postal_address.country Country
115
+ # organization.visit_address.street VisitingAddressStreetAddress + VisitingAddressStreetAddress2
116
+ # organization.visit_address.zip_code VisitingAddressZipCode
117
+ # organization.visit_address.city VisitingAddressCity
118
+ # organization.visit_address.country VisitingAddressCountry
119
+ def to_organization(organization, row)
120
+ # If your database dont have fields with the specifed labels,
121
+ # you must set properties as below.
122
+
123
+ # organization.name = row['name']
124
+ # organization.organization_number = row['registrationno']
125
+
126
+ ####################################################################
127
+ ## Bisnode ID fields
128
+
129
+ # NOTE!!! If a bisnode-id is present you dont need to set
130
+ # fields like address or website since they are reterived from
131
+ # PAR.
132
+
133
+ # bisnode_id = row['parid']
134
+
135
+ # if bisnode_id && !bisnode_id.empty?
136
+ # organization.with_source do |source|
137
+ # source.par_se(bisnode_id)
138
+ # end
139
+ # end
140
+
141
+ # If a company is missing a bisnode ID then you should do this
142
+ # in order to capture any possible data that is written manually
143
+ # on that company.
144
+
145
+ # if bisnode_id && bisnode_id.empty?
146
+ # organization.web_site = row['website']
147
+ # organization.central_phone_number = row['phone']
148
+
149
+
150
+ # ####################################################################
151
+ # # Address fields.
152
+ # # Addresses consists of several parts in LIME Go. Lots of other
153
+ # # systems have the address all in one line, to be able to
154
+ # # match when importing it is way better to split the addresses
155
+
156
+ # organization.with_postal_address do |address|
157
+ # address.street = row['potstaladdress1']
158
+ # address.zip_code = row['postalzipcode']
159
+ # address.city = row['postalcity']
160
+ # address.location = row['country']
161
+ # end
162
+
163
+ # # Same as visting address
164
+
165
+ # organization.with_visit_address do |addr|
166
+ # addr.street = row['visitingaddress1']
167
+ # addr.zip_code = row['visitingzipcode']
168
+ # addr.city = row['visitingcity']
169
+ # end
170
+ # end
171
+ #####################################################################
172
+ ## Tags.
173
+ # Set tags for the organization. All organizations will get
174
+ # the tag "import" automagically
175
+
176
+ # organization.set_tag("Guldkund")
177
+
178
+ #####################################################################
179
+ ## Option fields.
180
+ # Option fields are normally translated into tags
181
+ # The option field customer category for instance,
182
+ # has the options "A-customer", "B-customer", and "C-customer"
183
+
184
+ # case row['businessarea']
185
+ # when 'Marketing', 'Sales'
186
+ # organization.set_tag(row['businessarea'])
187
+ # end
188
+
189
+ #####################################################################
190
+ ## Set fields.
191
+ # Set fields are normally translated into tags
192
+ # A field is a ";"- separated list. We must first split them into
193
+ # an array.
194
+
195
+ # values = row["mailings"].split(";")
196
+ # values.each do |value|
197
+ # if value = "Newsletter"
198
+ # organization.set_tag(value)
199
+ # end
200
+ # end
201
+
202
+ #####################################################################
203
+ ## LIME Go Relation.
204
+ # let's say that there is a option field in Easy called 'Customer relation'
205
+ # with the options '1.Customer', '2.Prospect' '3.Partner' and '4.Lost customer'
206
+
207
+ # case row['relation']
208
+ # when '1.Customer'
209
+ # We have made a deal with this organization.
210
+ # organization.relation = GoImport::Relation::IsACustomer
211
+ # when '2.Prospect'
212
+ # Something is happening with this organization, we might have
213
+ # booked a meeting with them or created a deal, etc.
214
+ # organization.relation = GoImport::Relation::WorkingOnIt
215
+ # when '4.Lost customer'
216
+ # We had something going with this organization but we
217
+ # couldn't close the deal and we don't think they will be a
218
+ # customer to us in the foreseeable future.
219
+ # organization.relation = GoImport::Relation::BeenInTouch
220
+ # else
221
+ # organization.relation = GoImport::Relation::NoRelation
222
+ # end
223
+
224
+ return organization
225
+ end
226
+
227
+ # The following properties are set on the person by default:
228
+ #
229
+ # LIME Go field LIME Pro field label
230
+ # person.first_name Name
231
+ # person.last_name Name
232
+ # person.direct_phone_number BusinessTelephoneNumber
233
+ # person.mobile_phone_number MobileTelephoneNumber
234
+ # person.position JobTitle
235
+ # person.email PrimaryEmailAddress
236
+ def to_person(person, row)
237
+ ## Here are some standard fields that are present
238
+ # on a LIME Go person that might be represented as custom
239
+ # fields in Pro.
240
+ # person.first_name = row["firstname"]
241
+ # person.last_name = row["lastname"]
242
+
243
+ # person.direct_phone_number = row['phone']
244
+ # person.mobile_phone_number = row['cellphone']
245
+ # person.email = row['email']
246
+ # person.position = row['position']
247
+
248
+ #####################################################################
249
+ ## Tags.
250
+ # Set tags for the person
251
+ # person.set_tag("VIP")
252
+
253
+ #####################################################################
254
+ ## Checkbox fields.
255
+ # Checkbox fields are normally translated into tags
256
+ # Xmas card field is a checkbox in Easy
257
+
258
+ # if row['Xmascard'] == "1"
259
+ # person.set_tag("Xmas card")
260
+ # end
261
+
262
+ #####################################################################
263
+ ## Multioption fields or "Set"- fields.
264
+ # Set fields are normally translated into multiple tags in LIME Go
265
+ # interests is an example of a set field in LIME Pro.
266
+
267
+ # if row['intrests']
268
+ # intrests = row['intrests'].split(';')
269
+ # intrests.each do |intrest|
270
+ # person.set_tag(intrest)
271
+ # end
272
+ # end
273
+
274
+ #####################################################################
275
+ ## LIME Go custom fields.
276
+ # This is how you populate a LIME Go custom field that was created in
277
+ # the configure method.
278
+
279
+ # person.set_custom_value("shoe_size", row['shoe size'])
280
+
281
+ return person
282
+ end
283
+
284
+ # The following properties are set on the person by default:
285
+ #
286
+ # LIME Go field LIME Pro field NAME
287
+ # deal.name name
288
+ # deal.description wonlostreason
289
+ # deal.value businessvalue
290
+ def to_deal(deal, row)
291
+
292
+ # deal.name = row['name']
293
+ ## Here are some standard fields that are present
294
+ # on a LIME Go deal and are usually represented
295
+ # as custom fields in Pro.
296
+
297
+ # deal.order_date = row['orderdate']
298
+
299
+ # Deal.value should be integer
300
+ # The currency used in Pro should match the one used in Go
301
+
302
+ # deal.value = row['value']
303
+
304
+ # should be between 0 - 100
305
+ # remove everything that is not an intiger
306
+
307
+ # deal.probability = row['probability'].gsub(/[^\d]/,"").to_i unless row['probability'].nil?
308
+
309
+ # Sets the deal's status to the value of the Pro field. This
310
+ # assumes that the status is already created in LIME Go. To
311
+ # create statuses during import add them to the settings
312
+ # during configure.
313
+
314
+ # if !row['businessstatus'].nil? && !row['businessstatus'].empty?
315
+ # deal.status = row['status']
316
+ # end
317
+
318
+ #####################################################################
319
+ ## Tags.
320
+ # Set tags for the deal
321
+
322
+ # deal.set_tag("productname")
323
+
324
+ return deal
325
+ end
326
+
327
+ # Reads a row from the History table
328
+ # and ads custom fields to the go_import note.
329
+
330
+ # NOTE!!! You should customize this method to include
331
+ # and transform the fields you want to import to LIME Go.
332
+ # The method includes examples of different types of
333
+ # fields and how you should handle them.
334
+ # Sometimes it's enough to uncomment some code and
335
+ # change the row name but in most cases you need to
336
+ # do some thinking of your own.
337
+ def to_note(note, row)
338
+
339
+ # note.text = row['text']
340
+
341
+ # Set the note classification. The value must be a value from the
342
+ # GoImport::NoteClassification enum. If no classification is
343
+ # set the note will get the default classification 'Comment'
344
+
345
+ # case row['type']
346
+ # when 'Sales call'
347
+ # note.classification = GoImport::NoteClassification::SalesCall
348
+ # when 'Customer Visit'
349
+ # note.classification = GoImport::NoteClassification::ClientVisit
350
+ # when 'No answer'
351
+ # note.classification = GoImport::NoteClassification::TriedToReach
352
+ # else
353
+ # note.classification = GoImport::NoteClassification::Comment
354
+ # end
355
+
356
+ return note
357
+ end
358
+
359
+
360
+ def configure(rootmodel)
361
+ #####################################################################
362
+ ## LIME Go custom fields.
363
+ # This is how you add a custom field in LIME Go.
364
+ # Custom fields can be added to organization, deal and person.
365
+ # Valid types are :String and :Link. If no type is specified
366
+ # :String is used as default.
367
+
368
+ # rootmodel.settings.with_person do |person|
369
+ # person.set_custom_field( { :integration_id => 'shoe_size', :title => 'Shoe size', :type => :String} )
370
+ # end
371
+
372
+ # rootmodel.settings.with_deal do |deal|
373
+ # assessment is default DealState::NoEndState
374
+ # deal.add_status( {:label => '1. Kvalificering' })
375
+ # deal.add_status( {:label => '2. Deal closed', :assessment => GoImport::DealState::PositiveEndState })
376
+ # deal.add_status( {:label => '4. Deal lost', :assessment => GoImport::DealState::NegativeEndState })
377
+ # end
378
+ end
379
+ end
380
+
@@ -1,48 +1,48 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- diff-lcs (1.2.5)
5
- global_phone (1.0.1)
6
- go_import (3.0.18)
7
- bundler
8
- global_phone
9
- iso_country_codes
10
- nokogiri
11
- roo
12
- sixarm_ruby_email_address_validation
13
- thor
14
- iso_country_codes (0.6.1)
15
- mini_portile (0.6.1)
16
- nokogiri (1.6.4.1-x86-mingw32)
17
- mini_portile (~> 0.6.0)
18
- roo (1.13.2)
19
- nokogiri
20
- rubyzip
21
- spreadsheet (> 0.6.4)
22
- rspec (3.1.0)
23
- rspec-core (~> 3.1.0)
24
- rspec-expectations (~> 3.1.0)
25
- rspec-mocks (~> 3.1.0)
26
- rspec-core (3.1.7)
27
- rspec-support (~> 3.1.0)
28
- rspec-expectations (3.1.2)
29
- diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.1.0)
31
- rspec-mocks (3.1.3)
32
- rspec-support (~> 3.1.0)
33
- rspec-support (3.1.2)
34
- ruby-ole (1.2.11.7)
35
- rubyzip (1.1.6)
36
- sixarm_ruby_email_address_validation (2.0.0)
37
- spreadsheet (1.0.0)
38
- ruby-ole (>= 1.0)
39
- thor (0.19.1)
40
-
41
- PLATFORMS
42
- x86-mingw32
43
-
44
- DEPENDENCIES
45
- go_import
46
- rspec
47
- rubyzip
48
- thor
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.2.5)
5
+ global_phone (1.0.1)
6
+ go_import (3.0.18)
7
+ bundler
8
+ global_phone
9
+ iso_country_codes
10
+ nokogiri
11
+ roo
12
+ sixarm_ruby_email_address_validation
13
+ thor
14
+ iso_country_codes (0.6.1)
15
+ mini_portile (0.6.1)
16
+ nokogiri (1.6.4.1-x86-mingw32)
17
+ mini_portile (~> 0.6.0)
18
+ roo (1.13.2)
19
+ nokogiri
20
+ rubyzip
21
+ spreadsheet (> 0.6.4)
22
+ rspec (3.1.0)
23
+ rspec-core (~> 3.1.0)
24
+ rspec-expectations (~> 3.1.0)
25
+ rspec-mocks (~> 3.1.0)
26
+ rspec-core (3.1.7)
27
+ rspec-support (~> 3.1.0)
28
+ rspec-expectations (3.1.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.1.0)
31
+ rspec-mocks (3.1.3)
32
+ rspec-support (~> 3.1.0)
33
+ rspec-support (3.1.2)
34
+ ruby-ole (1.2.11.7)
35
+ rubyzip (1.1.6)
36
+ sixarm_ruby_email_address_validation (2.0.0)
37
+ spreadsheet (1.0.0)
38
+ ruby-ole (>= 1.0)
39
+ thor (0.19.1)
40
+
41
+ PLATFORMS
42
+ x86-mingw32
43
+
44
+ DEPENDENCIES
45
+ go_import
46
+ rspec
47
+ rubyzip
48
+ thor
data/spec/deal_spec.rb CHANGED
@@ -221,4 +221,12 @@ describe "Deal" do
221
221
  }.to raise_error(GoImport::InvalidDealStatusError)
222
222
  end
223
223
 
224
+ it "will warn on validation if status is unknown" do
225
+ # given
226
+ deal.name = "Deal"
227
+ deal.status = "required status"
228
+
229
+ # when, then
230
+ deal.validate[1].length.should be > 0
231
+ end
224
232
  end
data/spec/file_spec.rb CHANGED
@@ -150,4 +150,29 @@ describe "File" do
150
150
  file.created_by.is_a?(GoImport::Coworker).should eq true
151
151
  file.instance_variable_get(:@created_by_reference).is_a?(GoImport::CoworkerReference).should eq true
152
152
  end
153
+
154
+ describe "is large" do
155
+ before(:all) do
156
+ n = 100
157
+ File.open("spec/sample_data/large.mpeg", 'w') do |f|
158
+ contents = "x" * (1024*1024)
159
+ n.to_i.times { f.write(contents) }
160
+ end
161
+ end
162
+
163
+ after(:all) do
164
+ File.delete "spec/sample_data/large.mpeg"
165
+ end
166
+
167
+ it "is not valid" do
168
+ # must be less than 100 Mb
169
+ file.path = "spec/sample_data/large.mpeg"
170
+ file.created_by = GoImport::CoworkerReference.new( { :integration_id => "123" } )
171
+ file.organization = GoImport::OrganizationReference.new( { :integration_id => "456" } )
172
+
173
+ # when, then
174
+ file.validate.length.should be > 0
175
+ end
176
+ end
177
+
153
178
  end
metadata CHANGED
@@ -1,9 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.25
4
+ version: 3.0.26
5
5
  platform: ruby
6
6
  authors:
7
+ - Petter Sandholdt
7
8
  - Oskar Gewalli
8
9
  - Peter Wilhelmsson
9
10
  - Anders Pålsson
@@ -11,7 +12,7 @@ authors:
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2015-01-12 00:00:00.000000000 Z
15
+ date: 2015-03-06 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: iso_country_codes
@@ -213,12 +214,6 @@ files:
213
214
  - sources/custom/.go_import/runner.rb
214
215
  - sources/custom/converter.rb
215
216
  - sources/custom/Gemfile
216
- - sources/easy/.gitignore
217
- - sources/easy/.go_import/readme.txt
218
- - sources/easy/.go_import/runner.rb
219
- - sources/easy/converter.rb
220
- - sources/easy/Export/readme.txt
221
- - sources/easy/Gemfile
222
217
  - sources/excel/.gitignore
223
218
  - sources/excel/.go_import/readme.txt
224
219
  - sources/excel/.go_import/runner.rb
@@ -241,6 +236,17 @@ files:
241
236
  - sources/excel-basic/files/offert-2.docx
242
237
  - sources/excel-basic/files/offert.docx
243
238
  - sources/excel-basic/Gemfile
239
+ - sources/lime-easy/.gitignore
240
+ - sources/lime-easy/.go_import/readme.txt
241
+ - sources/lime-easy/.go_import/runner.rb
242
+ - sources/lime-easy/converter.rb
243
+ - sources/lime-easy/Export/readme.txt
244
+ - sources/lime-easy/Gemfile
245
+ - sources/lime-pro-basic/.gitignore
246
+ - sources/lime-pro-basic/.go_import/readme.txt
247
+ - sources/lime-pro-basic/.go_import/runner.rb
248
+ - sources/lime-pro-basic/converter.rb
249
+ - sources/lime-pro-basic/Gemfile
244
250
  - sources/salesforce/.gitignore
245
251
  - sources/salesforce/.go_import/readme.txt
246
252
  - sources/salesforce/.go_import/runner.rb
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes