go_import 3.0.15 → 3.0.16

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.
@@ -76,6 +76,8 @@ module GoImport
76
76
  instance_variable_set("@" + myattr[:id].to_s, val) if val != nil
77
77
  end
78
78
  end
79
+
80
+ set_tag 'Import'
79
81
  end
80
82
 
81
83
  def to_s
@@ -75,7 +75,7 @@ module GoImport
75
75
  end
76
76
 
77
77
  def has_relative_path?()
78
- return Pathname.new(@path).relative?
78
+ return !@path.match(/[a-zA-Z]{1}\:[\\\/]/)&&Pathname.new(@path).relative?
79
79
  end
80
80
 
81
81
  def organization=(org)
@@ -61,6 +61,7 @@ module GoImport
61
61
  end
62
62
 
63
63
  @relation = Relation::NoRelation if @relation.nil?
64
+ set_tag 'Import'
64
65
  end
65
66
 
66
67
  def to_reference()
@@ -45,6 +45,8 @@ module GoImport
45
45
  instance_variable_set("@" + myattr[:id].to_s, val) if val != nil
46
46
  end
47
47
  end
48
+
49
+ set_tag 'Import'
48
50
  end
49
51
 
50
52
  def organization=(org)
@@ -42,6 +42,8 @@ module GoImport
42
42
  end
43
43
 
44
44
  module ModelHasTags
45
+ attr_reader :tags
46
+
45
47
  # @example
46
48
  # obj.set_tag("partner")
47
49
  def set_tag(str)
@@ -38,7 +38,6 @@ def convert_source
38
38
  if not row.nil?
39
39
  if not row["NAMN"] == ""
40
40
  organization = converter.to_organization(row, rootmodel)
41
- organization.set_tag "Import"
42
41
  rootmodel.add_organization(organization)
43
42
  end
44
43
  end
@@ -36,7 +36,6 @@ def convert_source
36
36
  if defined?(ORGANIZATION_FILE) && !ORGANIZATION_FILE.nil? && !ORGANIZATION_FILE.empty?
37
37
  process_rows ORGANIZATION_FILE do |row|
38
38
  organization = converter.to_organization(row, rootmodel)
39
- organization.set_tag "Import"
40
39
  rootmodel.add_organization(organization)
41
40
  end
42
41
  end
@@ -106,7 +106,6 @@ end
106
106
 
107
107
  def init_organization(row, rootmodel)
108
108
  organization = GoImport::Organization.new
109
- organization.set_tag "Import"
110
109
  # integration_id is typically the company Id in Easy
111
110
  # Must be set to be able to import the same file more
112
111
  # than once without creating duplicates
@@ -95,7 +95,6 @@ def convert_source
95
95
  puts "Trying to convert organizations..."
96
96
  organization_rows.each do |row|
97
97
  organization = converter.to_organization(row, rootmodel)
98
- organization.set_tag "Import"
99
98
  rootmodel.add_organization(organization)
100
99
  end
101
100
  end
@@ -49,7 +49,7 @@ class Converter
49
49
  # used as default.
50
50
 
51
51
  # rootmodel.settings.with_organization do |organization|
52
- # organization.set_custom_field( { :integrationid => 'source', :title => 'Källa', :type => :Link } )
52
+ # organization.set_custom_field( { :integration_id => 'source', :title => 'Källa', :type => :Link } )
53
53
  # end
54
54
  end
55
55
 
@@ -106,6 +106,9 @@ class Converter
106
106
 
107
107
  organization.name = row['Namn']
108
108
 
109
+ # Set responsible such as
110
+ # organization.responsible_coworker = rootmodel.find_coworker_by_integration_id(row['Medarbetare'])
111
+
109
112
  # Custom fields should be set like this.
110
113
  # organization.set_custom_value("source", "internet")
111
114
 
data/spec/deal_spec.rb CHANGED
@@ -6,6 +6,12 @@ describe "Deal" do
6
6
  GoImport::Deal.new
7
7
  }
8
8
 
9
+ it "should have import tag as default" do
10
+ # given, when, then
11
+ deal.tags.count.should eq 1
12
+ deal.tags[0].value.should eq 'Import'
13
+ end
14
+
9
15
  it "will set customer ref when customer is assigned" do
10
16
  # given
11
17
  org = GoImport::Organization.new({:integration_id => "123", :name => "Lundalogik"})
data/spec/file_spec.rb CHANGED
@@ -71,7 +71,7 @@ describe "File" do
71
71
 
72
72
  it "knows when a path is not relative" do
73
73
  # given
74
- file.path = "c:\files\myfile.doc"
74
+ file.path = "c:\\files\\myfile.doc"
75
75
 
76
76
  # when, then
77
77
  file.has_relative_path?().should eq false
@@ -54,7 +54,6 @@ describe GoImport::SerializeHelper do
54
54
  serialized.should_not match(/<Email>/)
55
55
  serialized.should_not match(/<Position>/)
56
56
  serialized.should_not match(/<AlternativeEmail>/)
57
- serialized.should_not match(/<Tags>/)
58
57
  serialized.should_not match(/<CustomValues>/)
59
58
  end
60
59
  it "should be utf-8" do
@@ -6,9 +6,17 @@ describe "Organization" do
6
6
  GoImport::Organization.new
7
7
  }
8
8
 
9
+ it "should have import tag as default" do
10
+ # given, when, then
11
+ organization.tags.count.should eq 1
12
+ organization.tags[0].value.should eq 'Import'
13
+ end
14
+
9
15
  it "must have a name" do
16
+ # given, when
10
17
  organization.name = "Lundalogik"
11
18
 
19
+ # then
12
20
  organization.validate.should eq ""
13
21
  end
14
22
 
data/spec/person_spec.rb CHANGED
@@ -6,6 +6,12 @@ describe "Person" do
6
6
  GoImport::Person.new
7
7
  }
8
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
+
9
15
  it "can set a customfield" do
10
16
  person.set_custom_field({:integration_id=>'the key',
11
17
  :value=> 'the value'})
@@ -55,11 +61,14 @@ describe "Person" do
55
61
  end
56
62
 
57
63
  it "will only set tag once" do
64
+ # we already have the default 'import' tag.
65
+ person.tags.length.should eq 1
66
+
58
67
  person.set_tag('tag1')
59
68
  person.set_tag('tag1')
60
- person.tags.length.should eq 1
61
- tag = person.tags[0]
62
- tag.value.should eq 'tag1'
69
+
70
+ person.tags.length.should eq 2
71
+ person.tags[1].value.should eq 'tag1'
63
72
  end
64
73
 
65
74
  it "should have a firstname if no lastname" do
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.15
4
+ version: 3.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-10-22 00:00:00.000000000 Z
15
+ date: 2014-10-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: iso_country_codes
@@ -271,12 +271,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
271
  - - ! '>='
272
272
  - !ruby/object:Gem::Version
273
273
  version: '0'
274
+ segments:
275
+ - 0
276
+ hash: 1057665117
274
277
  required_rubygems_version: !ruby/object:Gem::Requirement
275
278
  none: false
276
279
  requirements:
277
280
  - - ! '>='
278
281
  - !ruby/object:Gem::Version
279
282
  version: '0'
283
+ segments:
284
+ - 0
285
+ hash: 1057665117
280
286
  requirements: []
281
287
  rubyforge_project:
282
288
  rubygems_version: 1.8.24