go_import 3.0.40 → 3.0.42

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.
@@ -10,7 +10,7 @@ describe "RootModel" do
10
10
  rootmodel.find_coworker_by_integration_id("import").first_name.should eq "Import"
11
11
  rootmodel.coworkers.length.should eq 1
12
12
  end
13
-
13
+
14
14
  it "can add a coworker from a new coworker" do
15
15
  # given
16
16
  coworker = GoImport::Coworker.new
@@ -39,7 +39,7 @@ describe "RootModel" do
39
39
  # then
40
40
  coworker.is_immutable.should eq true
41
41
  end
42
-
42
+
43
43
 
44
44
  it "will only add coworkers" do
45
45
  # given
@@ -49,7 +49,7 @@ describe "RootModel" do
49
49
  expect {
50
50
  rootmodel.add_coworker(not_a_coworker)
51
51
  }.to raise_error(ArgumentError)
52
- rootmodel.coworkers.length.should eq 1
52
+ rootmodel.coworkers.length.should eq 1
53
53
  end
54
54
 
55
55
  it "will not add a new coworker when the coworker is already added (same integration id)" do
@@ -104,7 +104,7 @@ describe "RootModel" do
104
104
  # then
105
105
  organization.is_immutable.should eq true
106
106
  end
107
-
107
+
108
108
  it "will only add organizations" do
109
109
  # given
110
110
  not_an_organization = { :integration_id => "123", :name => "This is not a note"}
@@ -115,7 +115,7 @@ describe "RootModel" do
115
115
  }.to raise_error(ArgumentError)
116
116
  rootmodel.organizations.length.should eq 0
117
117
  end
118
-
118
+
119
119
  it "will not add a new organization when the organization is already added (same integration id)" do
120
120
  # given
121
121
  org = GoImport::Organization.new({
@@ -187,7 +187,7 @@ describe "RootModel" do
187
187
 
188
188
  # then
189
189
  deal.is_immutable.should eq true
190
- end
190
+ end
191
191
 
192
192
  it "will only add deals" do
193
193
  # given
@@ -234,7 +234,7 @@ describe "RootModel" do
234
234
  deal = GoImport::Deal.new
235
235
  deal.integration_id = "123key"
236
236
  deal.name = "Big Deal"
237
-
237
+
238
238
  rootmodel.configuration[:allow_deals_without_responsible] = true
239
239
 
240
240
  # when
@@ -249,7 +249,7 @@ describe "RootModel" do
249
249
  deal = GoImport::Deal.new
250
250
  deal.integration_id = "123key"
251
251
  deal.name = "Big Deal"
252
-
252
+
253
253
  rootmodel.configuration[:allow_deals_without_responsible] = false
254
254
 
255
255
  # when
@@ -318,7 +318,7 @@ describe "RootModel" do
318
318
 
319
319
  it "will make note immutable after it has been added" do
320
320
  # given
321
- note = GoImport::Note.new
321
+ note = GoImport::Note.new
322
322
  note.text = "this is a note"
323
323
 
324
324
  # when
@@ -327,7 +327,7 @@ describe "RootModel" do
327
327
  # then
328
328
  note.is_immutable.should eq true
329
329
  end
330
-
330
+
331
331
  it "can add a note from a new note" do
332
332
  # given
333
333
  note = GoImport::Note.new
@@ -474,6 +474,27 @@ describe "RootModel" do
474
474
  found_person.last_name.should eq "Bob"
475
475
  end
476
476
 
477
+ it "Will will not find a person by wrong integration id" do
478
+ # given
479
+ organization = GoImport::Organization.new
480
+ organization.name = "Hubba Bubba"
481
+ organization.integration_id = "321"
482
+ organization.add_employee({
483
+ :integration_id => "123",
484
+ :first_name => "Billy",
485
+ :last_name => "Bob"
486
+ })
487
+
488
+ rootmodel.add_organization(organization)
489
+
490
+ # when
491
+ found_person = rootmodel.find_person_by_integration_id("321")
492
+
493
+ # then
494
+ found_person.should eq nil
495
+
496
+ end
497
+
477
498
  it "Will find a person by integration id from an organization with many employees" do
478
499
  # given
479
500
  organization = GoImport::Organization.new
@@ -501,6 +522,32 @@ describe "RootModel" do
501
522
  found_person.last_name.should eq "Bob"
502
523
  end
503
524
 
525
+ it "will have correct count on number of persons" do
526
+ # given
527
+ organization = GoImport::Organization.new
528
+ organization.name = "Hubba Bubba"
529
+ organization.integration_id = "321"
530
+ organization.add_employee({
531
+ :integration_id => "123",
532
+ :first_name => "Billy",
533
+ :last_name => "Bob"
534
+ })
535
+ organization.add_employee({
536
+ :integration_id => "456",
537
+ :first_name => "Vincent",
538
+ :last_name => "Vega"
539
+ })
540
+
541
+ rootmodel.add_organization(organization)
542
+
543
+ # when
544
+ persons = rootmodel.persons
545
+
546
+ # then
547
+ persons.length.should eq 2
548
+
549
+ end
550
+
504
551
  it "will report when two links has the same integration id during sanity check" do
505
552
  # given
506
553
  link1 = GoImport::Link.new
@@ -518,4 +565,364 @@ describe "RootModel" do
518
565
  # then
519
566
  rootmodel.sanity_check.should eq "Duplicate link integration_id: 1."
520
567
  end
568
+
569
+ it "will find an organization based on a property" do
570
+ # given
571
+ organization = GoImport::Organization.new
572
+ organization.name = "Hubba Bubba"
573
+ organization.integration_id = "321"
574
+ rootmodel.add_organization(organization)
575
+
576
+ organization2 = GoImport::Organization.new
577
+ organization2.name = "Bongo bong"
578
+ organization2.integration_id = "123"
579
+ rootmodel.add_organization(organization2)
580
+
581
+ # when
582
+ result = rootmodel.find_organization{|org| org.name == "Hubba Bubba"}
583
+
584
+ # then
585
+ result.should eq organization
586
+ end
587
+
588
+ it "will return nil if it doesn't find an organization on a property" do
589
+ # given
590
+ organization = GoImport::Organization.new
591
+ organization.name = "Hubba Bubba"
592
+ organization.integration_id = "321"
593
+ rootmodel.add_organization(organization)
594
+
595
+ organization2 = GoImport::Organization.new
596
+ organization2.name = "Bongo bong"
597
+ organization2.integration_id = "123"
598
+ rootmodel.add_organization(organization2)
599
+
600
+ # when
601
+ result = rootmodel.find_organization{|org| org.name == "Nope"}
602
+
603
+ # then
604
+ result.should eq nil
605
+ end
606
+
607
+ it "will find an person based on a property" do
608
+ # given
609
+ organization = GoImport::Organization.new
610
+ organization.name = "Hubba Bubba"
611
+ organization.integration_id = "321"
612
+ rootmodel.add_organization(organization)
613
+
614
+ person = GoImport::Person.new
615
+ person.first_name = "Kalle"
616
+ person.email = "kalle@kula.se"
617
+
618
+ organization.add_employee(person)
619
+
620
+ # when
621
+ result = rootmodel.find_person{|per| per.email == "kalle@kula.se"}
622
+
623
+ # then
624
+ result.should eq person
625
+ end
626
+
627
+ it "will return nil if it doesn't find a person on a property" do
628
+ # given
629
+ organization = GoImport::Organization.new
630
+ organization.name = "Hubba Bubba"
631
+ organization.integration_id = "321"
632
+ rootmodel.add_organization(organization)
633
+
634
+ person = GoImport::Person.new
635
+ person.first_name = "Kalle"
636
+ person.email = "kalle@kula.se"
637
+
638
+ organization.add_employee(person)
639
+
640
+ # when
641
+ result = rootmodel.find_person{|per| per.email == "john@appleseed.com"}
642
+
643
+ # then
644
+ result.should eq nil
645
+ end
646
+
647
+ it "will find an deal based on a property" do
648
+ # given
649
+ deal = GoImport::Deal.new
650
+ deal.name = "Big Deal"
651
+ deal.integration_id = "321"
652
+ deal.value = 23456789
653
+ rootmodel.add_deal(deal)
654
+
655
+ # when
656
+ result = rootmodel.find_deal{|d| d.name == "Big Deal"}
657
+
658
+ # then
659
+ result.should eq deal
660
+ end
661
+
662
+ it "will return nil if it doesn't find a deal on a property" do
663
+ # given
664
+ deal = GoImport::Deal.new
665
+ deal.name = "Big Deal"
666
+ deal.integration_id = "321"
667
+ deal.value = 23456789
668
+ rootmodel.add_deal(deal)
669
+
670
+ # when
671
+ result = rootmodel.find_deal{|d| d.value == 0}
672
+
673
+ # then
674
+ result.should eq nil
675
+ end
676
+
677
+ it "will find an note based on a property" do
678
+ # given
679
+ organization = GoImport::Organization.new
680
+ organization.name = "Hubba Bubba"
681
+ organization.integration_id = "321"
682
+ rootmodel.add_organization(organization)
683
+
684
+ note = GoImport::Note.new
685
+ note.text = "Hello!"
686
+ note.organization = organization
687
+
688
+ rootmodel.add_note(note)
689
+ # when
690
+ result = rootmodel.find_note{|n| n.text == "Hello!"}
691
+
692
+ # then
693
+ result.should eq note
694
+ end
695
+
696
+ it "will return nil if it doesn't find a note on a property" do
697
+ # given
698
+ organization = GoImport::Organization.new
699
+ organization.name = "Hubba Bubba"
700
+ organization.integration_id = "321"
701
+ rootmodel.add_organization(organization)
702
+
703
+ note = GoImport::Note.new
704
+ note.text = "Hello!"
705
+ note.organization = organization
706
+
707
+ rootmodel.add_note(note)
708
+ # when
709
+ result = rootmodel.find_note{|n| n.text == "Goodbye!"}
710
+
711
+ # then
712
+ result.should eq nil
713
+ end
714
+
715
+ it "will find an document based on a property" do
716
+ # given
717
+ organization = GoImport::Organization.new
718
+ organization.name = "Hubba Bubba"
719
+ organization.integration_id = "321"
720
+ rootmodel.add_organization(organization)
721
+
722
+ link = GoImport::Link.new
723
+ link.name = "Tender"
724
+ link.integration_id = "123"
725
+ link.url = "https://go.lime-go.com"
726
+ link.organization = organization
727
+
728
+ rootmodel.documents.add_link(link)
729
+ # when
730
+ result = rootmodel.find_document(:link){|l| l.url == "https://go.lime-go.com"}
731
+
732
+ # then
733
+ result.should eq link
734
+ end
735
+
736
+ it "will return nil if it doesn't find a document on a property" do
737
+ # given
738
+ organization = GoImport::Organization.new
739
+ organization.name = "Hubba Bubba"
740
+ organization.integration_id = "321"
741
+ rootmodel.add_organization(organization)
742
+
743
+ link = GoImport::Link.new
744
+ link.name = "Tender"
745
+ link.integration_id = "123"
746
+ link.url = "https://go.lime-go.com"
747
+ link.organization = organization
748
+
749
+ rootmodel.documents.add_link(link)
750
+ # when
751
+ result = rootmodel.find_document(:link){|l| l.name == "Contract"}
752
+
753
+ # then
754
+ result.should eq nil
755
+ end
756
+
757
+ it "will find companies based on their property" do
758
+ # given
759
+ organization = GoImport::Organization.new
760
+ organization.name = "Hubba Bubba"
761
+ organization.integration_id = "321"
762
+ rootmodel.add_organization(organization)
763
+
764
+ organization = GoImport::Organization.new
765
+ organization.name = "Hubba Bubba"
766
+ organization.integration_id = "123"
767
+ rootmodel.add_organization(organization)
768
+ # when
769
+ result = rootmodel.select_organizations{|org| org.name == "Hubba Bubba"}
770
+
771
+ # then
772
+ result.length.should eq 2
773
+ end
774
+
775
+ it "will return empty array if it doesn't find any organization on a property" do
776
+ # given
777
+ organization = GoImport::Organization.new
778
+ organization.name = "Hubba Bubba"
779
+ organization.integration_id = "321"
780
+ rootmodel.add_organization(organization)
781
+
782
+ organization = GoImport::Organization.new
783
+ organization.name = "Hubba Bubba"
784
+ organization.integration_id = "123"
785
+ rootmodel.add_organization(organization)
786
+ # when
787
+ result = rootmodel.select_organizations{|org| org.name == "Hubba"}
788
+
789
+ # then
790
+ result.should eq []
791
+ end
792
+
793
+ it "will find persons based on their property" do
794
+ # given
795
+ organization = GoImport::Organization.new
796
+ organization.name = "Hubba Bubba"
797
+ organization.integration_id = "321"
798
+ rootmodel.add_organization(organization)
799
+ person = GoImport::Person.new
800
+ person.first_name = "Kalle"
801
+ person.email = "kalle@kula.se"
802
+ person.position = "Chief"
803
+ organization.add_employee(person)
804
+
805
+ organization = GoImport::Organization.new
806
+ organization.name = "Bongo Bong"
807
+ organization.integration_id = "123"
808
+ rootmodel.add_organization(organization)
809
+ person = GoImport::Person.new
810
+ person.first_name = "Nisse"
811
+ person.email = "nisse@elf.com"
812
+ person.position = "Chief"
813
+ organization.add_employee(person)
814
+
815
+ # when
816
+ result = rootmodel.select_persons{|per| per.position == "Chief"}
817
+ # then
818
+ result.length.should eq 2
819
+ end
820
+
821
+ it "will return empty array if it doesn't find any persons on their property" do
822
+ # given
823
+ organization = GoImport::Organization.new
824
+ organization.name = "Hubba Bubba"
825
+ organization.integration_id = "321"
826
+ rootmodel.add_organization(organization)
827
+ person = GoImport::Person.new
828
+ person.first_name = "Kalle"
829
+ person.email = "kalle@kula.se"
830
+ person.position = "Chief"
831
+ organization.add_employee(person)
832
+
833
+ organization = GoImport::Organization.new
834
+ organization.name = "Bongo Bong"
835
+ organization.integration_id = "123"
836
+ rootmodel.add_organization(organization)
837
+ person = GoImport::Person.new
838
+ person.first_name = "Nisse"
839
+ person.email = "nisse@elf.com"
840
+ person.position = "Chief"
841
+ organization.add_employee(person)
842
+
843
+ # when
844
+ result = rootmodel.select_persons{|per| per.position == "Slave"}
845
+
846
+ # then
847
+ result.should eq []
848
+ end
849
+
850
+ it "will find coworker based on their property" do
851
+ # when
852
+ coworker1 = GoImport::Coworker.new({
853
+ :integration_id => "111key",
854
+ :first_name => "Kalle",
855
+ :last_name => "Anka",
856
+ :email => "kalle.anka@vonanka.com"
857
+ })
858
+ coworker2 = GoImport::Coworker.new({
859
+
860
+ :integration_id => "222key",
861
+ :first_name => "Knatte",
862
+ :last_name => "Anka",
863
+ :email => "knatte.anka@vonanka.com"
864
+ })
865
+ rootmodel.add_coworker(coworker1)
866
+ rootmodel.add_coworker(coworker2)
867
+
868
+ # then
869
+ result = rootmodel.find_coworker{|coworker| coworker.email == "knatte.anka@vonanka.com"}
870
+ result.should eq coworker2
871
+ end
872
+
873
+ it "will return nil if it doesn't find an coworker on a property" do
874
+ # when
875
+ coworker1 = GoImport::Coworker.new({
876
+ :integration_id => "111key",
877
+ :first_name => "Kalle",
878
+ :last_name => "Anka",
879
+ :email => "kalle.anka@vonanka.com"
880
+ })
881
+ rootmodel.add_coworker(coworker1)
882
+
883
+ # then
884
+ result = rootmodel.find_coworker{|coworker| coworker.email == "Kall"}
885
+ result.should eq nil
886
+ end
887
+
888
+ it "will find deals based on their property" do
889
+ # given
890
+ deal = GoImport::Deal.new
891
+ deal.name = "Big Deal"
892
+ deal.value = 1234
893
+ deal.integration_id = "1"
894
+ rootmodel.add_deal deal
895
+
896
+ deal = GoImport::Deal.new
897
+ deal.name = "Bigger Deal"
898
+ deal.value = 1234
899
+ deal.integration_id = "2"
900
+ rootmodel.add_deal deal
901
+
902
+ # when
903
+ result = rootmodel.select_deals{|d| d.value == "1234"}
904
+ # then
905
+ result.length.should eq 2
906
+ end
907
+
908
+ it "will return empty array if it doesn't find any persons on their property" do
909
+ # given
910
+ deal = GoImport::Deal.new
911
+ deal.name = "Big Deal"
912
+ deal.value = 1234
913
+ deal.integration_id = "1"
914
+ rootmodel.add_deal deal
915
+
916
+ deal = GoImport::Deal.new
917
+ deal.name = "Bigger Deal"
918
+ deal.value = 1234
919
+ deal.integration_id = "2"
920
+ rootmodel.add_deal deal
921
+
922
+ # when
923
+ result = rootmodel.select_deals{|d| d.name == "Small deal"}
924
+
925
+ # then
926
+ result.should eq []
927
+ end
521
928
  end
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.40
4
+ version: 3.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petter Sandholdt
@@ -9,10 +9,11 @@ authors:
9
9
  - Peter Wilhelmsson
10
10
  - Anders Pålsson
11
11
  - Ahmad Game
12
+ - Rickard Helldin
12
13
  autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2016-04-06 00:00:00.000000000 Z
16
+ date: 2016-05-03 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: iso_country_codes
@@ -221,6 +222,16 @@ files:
221
222
  - sources/VISMA/Database/KUND.DBF
222
223
  - sources/VISMA/Gemfile
223
224
  - sources/VISMA/converter.rb
225
+ - sources/base-crm/.go_import/runner.rb
226
+ - sources/base-crm/Gemfile
227
+ - sources/base-crm/README.md
228
+ - sources/base-crm/converter.rb
229
+ - sources/base-crm/data/contacts.csv
230
+ - sources/base-crm/data/coworkers.csv
231
+ - sources/base-crm/data/deals.csv
232
+ - sources/base-crm/data/leads.csv
233
+ - sources/base-crm/data/notes.csv
234
+ - sources/base-crm/data/tasks.csv
224
235
  - sources/csv/.gitignore
225
236
  - sources/csv/.go_import/readme.txt
226
237
  - sources/csv/.go_import/runner.rb