rhoconnect-adapters 1.0.0.beta1
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.
- data/.gitignore +4 -0
- data/CHANGELOG +4 -0
- data/Gemfile +18 -0
- data/README.md +239 -0
- data/Rakefile +31 -0
- data/bin/rhoconnect-adapters +35 -0
- data/generators/crm/templates/application/application.rb +34 -0
- data/generators/crm/templates/source/source_adapter.rb +10 -0
- data/generators/crm/templates/source/source_spec.rb +25 -0
- data/generators/crm/templates/spec/spec_helper.rb +64 -0
- data/generators/crm/vendor/ms_dynamics/adapter.rb +301 -0
- data/generators/crm/vendor/ms_dynamics/application.rb +56 -0
- data/generators/crm/vendor/ms_dynamics/lib/crm_metadata_service.rb +43 -0
- data/generators/crm/vendor/ms_dynamics/lib/crm_service.rb +141 -0
- data/generators/crm/vendor/ms_dynamics/lib/discovery_service.rb +51 -0
- data/generators/crm/vendor/ms_dynamics/lib/wlid_service.rb +159 -0
- data/generators/crm/vendor/ms_dynamics/ms_dynamics.rb +45 -0
- data/generators/crm/vendor/ms_dynamics/settings/Account.yml +46 -0
- data/generators/crm/vendor/ms_dynamics/settings/Contact.yml +40 -0
- data/generators/crm/vendor/ms_dynamics/settings/GenericObject.yml +18 -0
- data/generators/crm/vendor/ms_dynamics/settings/Lead.yml +53 -0
- data/generators/crm/vendor/ms_dynamics/settings/Opportunity.yml +41 -0
- data/generators/crm/vendor/ms_dynamics/settings/settings.yml +9 -0
- data/generators/crm/vendor/ms_dynamics/spec/application_spec.rb +23 -0
- data/generators/crm/vendor/ms_dynamics/spec/sources/account_spec.rb +49 -0
- data/generators/crm/vendor/ms_dynamics/spec/sources/contact_spec.rb +49 -0
- data/generators/crm/vendor/ms_dynamics/spec/sources/lead_spec.rb +49 -0
- data/generators/crm/vendor/ms_dynamics/spec/sources/opportunity_spec.rb +62 -0
- data/generators/crm/vendor/ms_dynamics/spec/spec_helper.rb +78 -0
- data/generators/crm/vendor/ms_dynamics/spec_data/Account.yml +6 -0
- data/generators/crm/vendor/ms_dynamics/spec_data/Contact.yml +7 -0
- data/generators/crm/vendor/ms_dynamics/spec_data/GenericObject.yml +3 -0
- data/generators/crm/vendor/ms_dynamics/spec_data/Lead.yml +12 -0
- data/generators/crm/vendor/ms_dynamics/spec_data/Opportunity.yml +6 -0
- data/generators/crm/vendor/ms_dynamics/templates.rb +57 -0
- data/generators/crm/vendor/oracle_on_demand/adapter.rb +421 -0
- data/generators/crm/vendor/oracle_on_demand/application.rb +64 -0
- data/generators/crm/vendor/oracle_on_demand/settings/Account.yml +91 -0
- data/generators/crm/vendor/oracle_on_demand/settings/Contact.yml +54 -0
- data/generators/crm/vendor/oracle_on_demand/settings/GenericObject.yml +21 -0
- data/generators/crm/vendor/oracle_on_demand/settings/Lead.yml +72 -0
- data/generators/crm/vendor/oracle_on_demand/settings/Opportunity.yml +69 -0
- data/generators/crm/vendor/oracle_on_demand/settings/settings.yml +8 -0
- data/generators/crm/vendor/oracle_on_demand/spec/application_spec.rb +14 -0
- data/generators/crm/vendor/oracle_on_demand/spec/sources/account_spec.rb +50 -0
- data/generators/crm/vendor/oracle_on_demand/spec/sources/contact_spec.rb +50 -0
- data/generators/crm/vendor/oracle_on_demand/spec/sources/lead_spec.rb +51 -0
- data/generators/crm/vendor/oracle_on_demand/spec/sources/opportunity_spec.rb +51 -0
- data/generators/crm/vendor/oracle_on_demand/spec_data/Account.yml +8 -0
- data/generators/crm/vendor/oracle_on_demand/spec_data/Contact.yml +8 -0
- data/generators/crm/vendor/oracle_on_demand/spec_data/GenericObject.yml +4 -0
- data/generators/crm/vendor/oracle_on_demand/spec_data/Lead.yml +14 -0
- data/generators/crm/vendor/oracle_on_demand/spec_data/Opportunity.yml +6 -0
- data/generators/crm/vendor/oracle_on_demand/templates.rb +52 -0
- data/generators/crm/vendor/salesforce/adapter.rb +315 -0
- data/generators/crm/vendor/salesforce/application.rb +80 -0
- data/generators/crm/vendor/salesforce/settings/Account.yml +53 -0
- data/generators/crm/vendor/salesforce/settings/Contact.yml +61 -0
- data/generators/crm/vendor/salesforce/settings/GenericObject.yml +13 -0
- data/generators/crm/vendor/salesforce/settings/Lead.yml +73 -0
- data/generators/crm/vendor/salesforce/settings/Opportunity.yml +48 -0
- data/generators/crm/vendor/salesforce/settings/settings.yml +6 -0
- data/generators/crm/vendor/salesforce/spec/application_spec.rb +14 -0
- data/generators/crm/vendor/salesforce/spec/sources/account_spec.rb +50 -0
- data/generators/crm/vendor/salesforce/spec/sources/contact_spec.rb +50 -0
- data/generators/crm/vendor/salesforce/spec/sources/lead_spec.rb +51 -0
- data/generators/crm/vendor/salesforce/spec/sources/opportunity_spec.rb +51 -0
- data/generators/crm/vendor/salesforce/spec_data/Account.yml +14 -0
- data/generators/crm/vendor/salesforce/spec_data/Contact.yml +8 -0
- data/generators/crm/vendor/salesforce/spec_data/GenericObject.yml +3 -0
- data/generators/crm/vendor/salesforce/spec_data/Lead.yml +10 -0
- data/generators/crm/vendor/salesforce/spec_data/Opportunity.yml +10 -0
- data/generators/crm/vendor/salesforce/templates.rb +45 -0
- data/generators/crm/vendor/sugar/adapter.rb +291 -0
- data/generators/crm/vendor/sugar/application.rb +50 -0
- data/generators/crm/vendor/sugar/settings/Account.yml +49 -0
- data/generators/crm/vendor/sugar/settings/Contact.yml +62 -0
- data/generators/crm/vendor/sugar/settings/GenericObject.yml +12 -0
- data/generators/crm/vendor/sugar/settings/Lead.yml +76 -0
- data/generators/crm/vendor/sugar/settings/Opportunity.yml +49 -0
- data/generators/crm/vendor/sugar/settings/settings.yml +9 -0
- data/generators/crm/vendor/sugar/spec/application_spec.rb +25 -0
- data/generators/crm/vendor/sugar/spec/sources/account_spec.rb +53 -0
- data/generators/crm/vendor/sugar/spec/sources/contact_spec.rb +53 -0
- data/generators/crm/vendor/sugar/spec/sources/lead_spec.rb +54 -0
- data/generators/crm/vendor/sugar/spec/sources/opportunity_spec.rb +54 -0
- data/generators/crm/vendor/sugar/spec_data/Account.yml +13 -0
- data/generators/crm/vendor/sugar/spec_data/Contact.yml +8 -0
- data/generators/crm/vendor/sugar/spec_data/GenericObject.yml +3 -0
- data/generators/crm/vendor/sugar/spec_data/Lead.yml +16 -0
- data/generators/crm/vendor/sugar/spec_data/Opportunity.yml +10 -0
- data/generators/crm/vendor/sugar/sugar.rb +33 -0
- data/generators/crm/vendor/sugar/templates.rb +58 -0
- data/generators/rhoconnect-adapters.rb +217 -0
- data/lib/rhoconnect-adapters/crm/crm.rb +31 -0
- data/lib/rhoconnect-adapters/soap_service.rb +70 -0
- data/lib/rhoconnect-adapters/version.rb +3 -0
- data/lib/rhoconnect-adapters.rb +2 -0
- data/rhoconnect-adapters.gemspec +36 -0
- data/spec/apps/ms_dynamics_spec.rb +19 -0
- data/spec/apps/oracle_on_demand_spec.rb +20 -0
- data/spec/apps/salesforce_spec.rb +18 -0
- data/spec/apps/sugar_spec.rb +18 -0
- data/spec/generator/generator_spec.rb +113 -0
- data/spec/spec_helper.rb +57 -0
- metadata +288 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Query_Fields:
|
|
2
|
+
# This is just a sample list of fields
|
|
3
|
+
# that are used in query
|
|
4
|
+
id:
|
|
5
|
+
Label: Id
|
|
6
|
+
Type: Id
|
|
7
|
+
first_name:
|
|
8
|
+
Label: First Name
|
|
9
|
+
Type: textinput
|
|
10
|
+
last_name:
|
|
11
|
+
Label: Last Name
|
|
12
|
+
Type: textinput
|
|
13
|
+
title:
|
|
14
|
+
Label: Title
|
|
15
|
+
Type: textinput
|
|
16
|
+
department:
|
|
17
|
+
Label: Department
|
|
18
|
+
Type: textinput
|
|
19
|
+
account_name:
|
|
20
|
+
Label: Account Name
|
|
21
|
+
Type: object
|
|
22
|
+
Object: Account
|
|
23
|
+
account_id:
|
|
24
|
+
Label: Account Id
|
|
25
|
+
Type: object
|
|
26
|
+
Object: Account
|
|
27
|
+
phone_work:
|
|
28
|
+
Label: Office Phone
|
|
29
|
+
Type: textinput
|
|
30
|
+
email1:
|
|
31
|
+
Label: E-mail
|
|
32
|
+
Type: textinput
|
|
33
|
+
primary_address_street:
|
|
34
|
+
Label: Primary Address Street
|
|
35
|
+
Type: textinput
|
|
36
|
+
primary_address_city:
|
|
37
|
+
Label: Primary Address City
|
|
38
|
+
Type: textinput
|
|
39
|
+
primary_address_state:
|
|
40
|
+
Label: Primary Address State
|
|
41
|
+
Type: textinput
|
|
42
|
+
primary_address_postalcode:
|
|
43
|
+
Label: Primary Address Zip Code
|
|
44
|
+
Type: textinput
|
|
45
|
+
primary_address_country:
|
|
46
|
+
Label: Primary Address Country
|
|
47
|
+
Type: textinput
|
|
48
|
+
description:
|
|
49
|
+
Label: Description
|
|
50
|
+
Type: textarea
|
|
51
|
+
lead_source:
|
|
52
|
+
Label: Lead Source
|
|
53
|
+
Type: Picklist
|
|
54
|
+
|
|
55
|
+
ObjectFields:
|
|
56
|
+
# these are reference fields to the other objects
|
|
57
|
+
- account_name
|
|
58
|
+
- account_id
|
|
59
|
+
|
|
60
|
+
TitleFields:
|
|
61
|
+
- first_name
|
|
62
|
+
- last_name
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Query_Fields:
|
|
2
|
+
# This is just a sample list of fields
|
|
3
|
+
# that are used in query
|
|
4
|
+
id:
|
|
5
|
+
Label: Id
|
|
6
|
+
Type: Id
|
|
7
|
+
salutation:
|
|
8
|
+
Label: Salutation
|
|
9
|
+
Type: Picklist
|
|
10
|
+
first_name:
|
|
11
|
+
Label: First Name
|
|
12
|
+
Type: textinput
|
|
13
|
+
last_name:
|
|
14
|
+
Label: Last Name
|
|
15
|
+
Type: textinput
|
|
16
|
+
title:
|
|
17
|
+
Label: Title
|
|
18
|
+
Type: textinput
|
|
19
|
+
department:
|
|
20
|
+
Label: Department
|
|
21
|
+
Type: textinput
|
|
22
|
+
phone_work:
|
|
23
|
+
Label: Office Phone
|
|
24
|
+
Type: textinput
|
|
25
|
+
email1:
|
|
26
|
+
Label: E-mail
|
|
27
|
+
Type: textinput
|
|
28
|
+
primary_address_street:
|
|
29
|
+
Label: Primary Address Street
|
|
30
|
+
Type: textinput
|
|
31
|
+
primary_address_city:
|
|
32
|
+
Label: Primary Address City
|
|
33
|
+
Type: textinput
|
|
34
|
+
primary_address_state:
|
|
35
|
+
Label: Primary Address State
|
|
36
|
+
Type: textinput
|
|
37
|
+
primary_address_postalcode:
|
|
38
|
+
Label: Primary Address Zip Code
|
|
39
|
+
Type: textinput
|
|
40
|
+
primary_address_country:
|
|
41
|
+
Label: Primary Address Country
|
|
42
|
+
Type: textinput
|
|
43
|
+
description:
|
|
44
|
+
Label: Description
|
|
45
|
+
Type: textarea
|
|
46
|
+
lead_source:
|
|
47
|
+
Label: Lead Source
|
|
48
|
+
Type: Picklist
|
|
49
|
+
status:
|
|
50
|
+
Label: Status
|
|
51
|
+
Type: Picklist
|
|
52
|
+
account_name:
|
|
53
|
+
Label: Account Name
|
|
54
|
+
Type: object
|
|
55
|
+
Object: Account
|
|
56
|
+
opportunity_name:
|
|
57
|
+
Label: Opportunity Name
|
|
58
|
+
Type: object
|
|
59
|
+
Object: Opportunity
|
|
60
|
+
|
|
61
|
+
ObjectFields:
|
|
62
|
+
# these are reference fields to the other objects
|
|
63
|
+
- account_name
|
|
64
|
+
- opportunity_name
|
|
65
|
+
|
|
66
|
+
TitleFields:
|
|
67
|
+
- first_name
|
|
68
|
+
- last_name
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Query_Fields:
|
|
2
|
+
# This is just a sample list of fields
|
|
3
|
+
# that are used in query
|
|
4
|
+
id:
|
|
5
|
+
Label: Id
|
|
6
|
+
Type: Id
|
|
7
|
+
name:
|
|
8
|
+
Label: Opportunity Name
|
|
9
|
+
Type: textinput
|
|
10
|
+
opportunity_type:
|
|
11
|
+
Label: Type
|
|
12
|
+
Type: Picklist
|
|
13
|
+
amount:
|
|
14
|
+
Label: Opportunity Amount
|
|
15
|
+
Type: textinput
|
|
16
|
+
lead_source:
|
|
17
|
+
Label: Lead Source
|
|
18
|
+
Type: Picklist
|
|
19
|
+
account_name:
|
|
20
|
+
Label: Account Name
|
|
21
|
+
Type: object
|
|
22
|
+
Object: Account
|
|
23
|
+
account_id:
|
|
24
|
+
Label: Account Id
|
|
25
|
+
Type: object
|
|
26
|
+
Object: Account
|
|
27
|
+
sales_stage:
|
|
28
|
+
Label: Sales Stage
|
|
29
|
+
Type: Picklist
|
|
30
|
+
probability:
|
|
31
|
+
Label: Probability
|
|
32
|
+
Type: textinput
|
|
33
|
+
next_step:
|
|
34
|
+
Label: Next Step
|
|
35
|
+
Type: textinput
|
|
36
|
+
date_closed:
|
|
37
|
+
Label: Expected Close Date
|
|
38
|
+
Type: textinput
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
ObjectFields:
|
|
44
|
+
# these are reference fields to the other objects
|
|
45
|
+
- account_name
|
|
46
|
+
- account_id
|
|
47
|
+
|
|
48
|
+
TitleFields:
|
|
49
|
+
- name
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
:test:
|
|
2
|
+
:sugarcrm_uri: https://rhomobile.sugarondemand.com
|
|
3
|
+
:debug_enabled: false
|
|
4
|
+
:production:
|
|
5
|
+
:sugarcrm_uri: https://rhomobile.sugarondemand.com
|
|
6
|
+
:debug_enabled: false
|
|
7
|
+
:development:
|
|
8
|
+
:sugarcrm_uri: https://rhomobile.sugarondemand.com
|
|
9
|
+
:debug_enabled: false
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),'spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "Application" do
|
|
4
|
+
it_should_behave_like "SpecHelper" do
|
|
5
|
+
before(:each) do
|
|
6
|
+
if SugarCRM.sessions.size > 0
|
|
7
|
+
SugarCRM.disconnect!
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should authenticate" do
|
|
12
|
+
Application.authenticate(@test_user,@test_password,nil).should be_true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should authenticate using SugarCRM.reconnect" do
|
|
16
|
+
Application.authenticate(@test_user,@test_password,nil).should be_true
|
|
17
|
+
Application.authenticate(@test_user,@test_password,nil).should be_true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should not authenticate with wrong credentials" do
|
|
21
|
+
Application.should_receive(:warn).once.with(/Can't authenticate user wrong_user:/)
|
|
22
|
+
Application.authenticate('wrong_user','wrong_password',nil).should be_false
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "Account" do
|
|
4
|
+
it_should_behave_like "SpecHelper" do
|
|
5
|
+
before(:each) do
|
|
6
|
+
sample_data_file = File.join(File.dirname(__FILE__),'..','..','vendor','sugar','spec_data','Account.yml')
|
|
7
|
+
@sample_data = YAML.load_file(sample_data_file)['Account'] if sample_data_file and File.exist?(sample_data_file)
|
|
8
|
+
setup_test_for Account,@test_user
|
|
9
|
+
if SugarCRM.sessions.size > 0
|
|
10
|
+
SugarCRM.disconnect!
|
|
11
|
+
end
|
|
12
|
+
Application.authenticate(@test_user, @test_password,"")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
before(:each) do
|
|
16
|
+
@ss.adapter.login
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
after(:each) do
|
|
20
|
+
@ss.adapter.logoff
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should process Account query" do
|
|
24
|
+
result = test_query
|
|
25
|
+
puts result.length.inspect
|
|
26
|
+
query_errors.should == {}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should process Account create" do
|
|
30
|
+
create_hash = @sample_data
|
|
31
|
+
result = test_create(create_hash)
|
|
32
|
+
puts result.inspect
|
|
33
|
+
create_hash['id'] = result
|
|
34
|
+
TestHelpers.created_records = { result => create_hash }
|
|
35
|
+
create_errors.should == {}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should process Account update" do
|
|
39
|
+
TestHelpers.created_records.each do |key,value|
|
|
40
|
+
value["name"] = "Sample Update #{key.to_s}"
|
|
41
|
+
end
|
|
42
|
+
result = test_update(TestHelpers.created_records)
|
|
43
|
+
puts result.inspect
|
|
44
|
+
update_errors.should == {}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "should process Account delete" do
|
|
48
|
+
result = test_delete(TestHelpers.created_records)
|
|
49
|
+
puts result.inspect
|
|
50
|
+
delete_errors.should == {}
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "Contact" do
|
|
4
|
+
it_should_behave_like "SpecHelper" do
|
|
5
|
+
before(:each) do
|
|
6
|
+
sample_data_file = File.join(File.dirname(__FILE__),'..','..','vendor','sugar','spec_data','Contact.yml')
|
|
7
|
+
@sample_data = YAML.load_file(sample_data_file)['Contact'] if sample_data_file and File.exist?(sample_data_file)
|
|
8
|
+
setup_test_for Contact,@test_user
|
|
9
|
+
if SugarCRM.sessions.size > 0
|
|
10
|
+
SugarCRM.disconnect!
|
|
11
|
+
end
|
|
12
|
+
Application.authenticate(@test_user, @test_password,"")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
before(:each) do
|
|
16
|
+
@ss.adapter.login
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
after(:each) do
|
|
20
|
+
@ss.adapter.logoff
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should process Contact query" do
|
|
24
|
+
result = test_query
|
|
25
|
+
puts result.length.inspect
|
|
26
|
+
query_errors.should == {}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should process Contact create" do
|
|
30
|
+
create_hash = @sample_data
|
|
31
|
+
result = test_create(create_hash)
|
|
32
|
+
puts result.inspect
|
|
33
|
+
create_hash['id'] = result
|
|
34
|
+
TestHelpers.created_records = { result => create_hash }
|
|
35
|
+
create_errors.should == {}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should process Contact update" do
|
|
39
|
+
TestHelpers.created_records.each do |key,value|
|
|
40
|
+
value["last_name"] = "Sample Update #{key.to_s}"
|
|
41
|
+
end
|
|
42
|
+
result = test_update(TestHelpers.created_records)
|
|
43
|
+
puts result.inspect
|
|
44
|
+
update_errors.should == {}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "should process Contact delete" do
|
|
48
|
+
result = test_delete(TestHelpers.created_records)
|
|
49
|
+
puts result.inspect
|
|
50
|
+
delete_errors.should == {}
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "Lead" do
|
|
4
|
+
it_should_behave_like "SpecHelper" do
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
sample_data_file = File.join(File.dirname(__FILE__),'..','..','vendor','sugar','spec_data','Lead.yml')
|
|
8
|
+
@sample_data = YAML.load_file(sample_data_file)['Lead'] if sample_data_file and File.exist?(sample_data_file)
|
|
9
|
+
setup_test_for Lead,@test_user
|
|
10
|
+
if SugarCRM.sessions.size > 0
|
|
11
|
+
SugarCRM.disconnect!
|
|
12
|
+
end
|
|
13
|
+
Application.authenticate(@test_user, @test_password,"")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
before(:each) do
|
|
17
|
+
@ss.adapter.login
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
after(:each) do
|
|
21
|
+
@ss.adapter.logoff
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should process Lead query" do
|
|
25
|
+
result = test_query
|
|
26
|
+
puts result.length.inspect
|
|
27
|
+
query_errors.should == {}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should process Lead create" do
|
|
31
|
+
create_hash = @sample_data
|
|
32
|
+
result = test_create(create_hash)
|
|
33
|
+
puts result.inspect
|
|
34
|
+
create_hash['id'] = result
|
|
35
|
+
TestHelpers.created_records = { result => create_hash }
|
|
36
|
+
create_errors.should == {}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should process Lead update" do
|
|
40
|
+
TestHelpers.created_records.each do |key,value|
|
|
41
|
+
value["last_name"] = "Changed Lead Last Name #{key.to_s}"
|
|
42
|
+
end
|
|
43
|
+
result = test_update(TestHelpers.created_records)
|
|
44
|
+
puts result.inspect
|
|
45
|
+
update_errors.should == {}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should process Lead delete" do
|
|
49
|
+
result = test_delete(TestHelpers.created_records)
|
|
50
|
+
puts result.inspect
|
|
51
|
+
delete_errors.should == {}
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "Opportunity" do
|
|
4
|
+
it_should_behave_like "SpecHelper" do
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
sample_data_file = File.join(File.dirname(__FILE__),'..','..','vendor','sugar','spec_data','Opportunity.yml')
|
|
8
|
+
@sample_data = YAML.load_file(sample_data_file)['Opportunity'] if sample_data_file and File.exist?(sample_data_file)
|
|
9
|
+
setup_test_for Opportunity,@test_user
|
|
10
|
+
if SugarCRM.sessions.size > 0
|
|
11
|
+
SugarCRM.disconnect!
|
|
12
|
+
end
|
|
13
|
+
Application.authenticate(@test_user, @test_password,"")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
before(:each) do
|
|
17
|
+
@ss.adapter.login
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
after(:each) do
|
|
21
|
+
@ss.adapter.logoff
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should process Opportunity query" do
|
|
25
|
+
result = test_query
|
|
26
|
+
puts result.length.inspect
|
|
27
|
+
query_errors.should == {}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should process Opportunity create" do
|
|
31
|
+
create_hash = @sample_data
|
|
32
|
+
result = test_create(create_hash)
|
|
33
|
+
puts result.inspect
|
|
34
|
+
create_hash["id"] = result
|
|
35
|
+
TestHelpers.created_records = { result => create_hash }
|
|
36
|
+
create_errors.should == {}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should process Opportunity update" do
|
|
40
|
+
TestHelpers.created_records.each do |key,value|
|
|
41
|
+
value["name"] = "Changed Opportunity #{key.to_s}"
|
|
42
|
+
end
|
|
43
|
+
result = test_update(TestHelpers.created_records)
|
|
44
|
+
puts result.inspect
|
|
45
|
+
update_errors.should == {}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should process Opportunity delete" do
|
|
49
|
+
result = test_delete(TestHelpers.created_records)
|
|
50
|
+
puts result.inspect
|
|
51
|
+
delete_errors.should == {}
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Account:
|
|
2
|
+
name: My ACME Co.
|
|
3
|
+
account_type: Reseller
|
|
4
|
+
industry: Communications
|
|
5
|
+
annual_revenue: 500000
|
|
6
|
+
billing_address_street: 111 Main St. Suite 101
|
|
7
|
+
billing_address_city: San Francisco
|
|
8
|
+
billing_address_state: CA
|
|
9
|
+
billing_address_postalcode: 47999
|
|
10
|
+
billing_address_country: USA
|
|
11
|
+
phone_office: (333)-333-3333
|
|
12
|
+
website: www.acme.com
|
|
13
|
+
employees: 100
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Lead:
|
|
2
|
+
salutation: Ms.
|
|
3
|
+
first_name: Jessica
|
|
4
|
+
last_name: Thompson
|
|
5
|
+
title: VP Of Marketing
|
|
6
|
+
department: Marketing
|
|
7
|
+
phone_work: 333-444-7777
|
|
8
|
+
email1: jessica@email.com
|
|
9
|
+
primary_address_street: 222 Main St
|
|
10
|
+
primary_address_city: New York
|
|
11
|
+
primary_address_state: NY
|
|
12
|
+
primary_address_postalcode: 77888
|
|
13
|
+
primary_address_country: USA
|
|
14
|
+
account_name: ACME Co.
|
|
15
|
+
opportunity_name: 5000 Hard Drives
|
|
16
|
+
status: In Process
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Opportunity:
|
|
2
|
+
name: My Opportunity With Contact
|
|
3
|
+
opportunity_type: Existing Customer
|
|
4
|
+
account_name: d2c221d7-fea9-162b-7b72-4e52b61bf087
|
|
5
|
+
lead_source: Partner
|
|
6
|
+
amount: 25000
|
|
7
|
+
date_closed: 01/12/2011
|
|
8
|
+
next_step: Close the deal
|
|
9
|
+
sales_stage: Pre-sales
|
|
10
|
+
probability: 85%
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'sugarcrm'
|
|
2
|
+
|
|
3
|
+
if not RUBY_VERSION =~ /1\.8/
|
|
4
|
+
# this is patch to fix class name conflicts
|
|
5
|
+
# between Rhoconnect and SugarCRM gem code in Ruby 1.9.x
|
|
6
|
+
module SugarCRM
|
|
7
|
+
class Module
|
|
8
|
+
def registered?
|
|
9
|
+
@session.namespace_const.const_defined? @klass, false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_class
|
|
13
|
+
SugarCRM.const_get(@klass, false).new
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# this is a patch to fix incorrect 'logout' implementation
|
|
20
|
+
module SugarCRM; class Connection
|
|
21
|
+
RESPONSE_IS_NOT_JSON << :logout
|
|
22
|
+
# Logs out of the Sugar user session.
|
|
23
|
+
def logout
|
|
24
|
+
login! unless logged_in?
|
|
25
|
+
json = <<-EOF
|
|
26
|
+
{
|
|
27
|
+
"session": "#{@sugar_session_id}"
|
|
28
|
+
}
|
|
29
|
+
EOF
|
|
30
|
+
json.gsub!(/^\s{6}/,'')
|
|
31
|
+
send!(:logout, json)
|
|
32
|
+
end
|
|
33
|
+
end; end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# these are Sugar-specific Templater::Generator templates
|
|
2
|
+
module RhoconnectAdapters
|
|
3
|
+
module CRM
|
|
4
|
+
module Sugar
|
|
5
|
+
class << self
|
|
6
|
+
def configure_gemfile
|
|
7
|
+
# put all specific dependencies here
|
|
8
|
+
# in the form of hash {'gem' => 'version'}
|
|
9
|
+
{ 'activesupport' => '>= 3.0.9',
|
|
10
|
+
'i18n' => '>= 0.6.0',
|
|
11
|
+
'sugarcrm' => '>= 0.9.15'
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
RhoconnectAdapters::CRMAppGenerator.add_vendor_templates :file, :sugar_main_require do |file,name,crm|
|
|
20
|
+
file.source = File.join('..','..','vendor','sugar','sugar.rb')
|
|
21
|
+
file.destination = File.join("#{name}", 'vendor','sugar','sugar.rb')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
RhoconnectAdapters::CRMAppGenerator.add_vendor_templates :file, :settings_yml do |file,name,crm|
|
|
25
|
+
file.source = File.join('..','..','vendor','sugar','settings','settings.yml')
|
|
26
|
+
file.destination = File.join("#{name}", 'vendor','sugar','settings','settings.yml')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
RhoconnectAdapters::CRMAppGenerator.add_vendor_templates :file, :application_spec do |file,name,crm|
|
|
30
|
+
file.source = File.join('..','..','vendor','sugar','spec','application_spec.rb')
|
|
31
|
+
file.destination = File.join("#{name}", 'spec','application_spec.rb')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
RhoconnectAdapters::CRMSourceGenerator.add_vendor_templates :file, :object_yml do |file,name,crm|
|
|
35
|
+
source_name = name.gsub('-', '_').camel_case
|
|
36
|
+
source_filename = File.join('..','..','vendor','sugar','settings',"#{source_name}.yml")
|
|
37
|
+
if File.exists? File.join(CRMSourceGenerator.source_root, source_filename)
|
|
38
|
+
file.source = source_filename
|
|
39
|
+
else
|
|
40
|
+
file.source = File.join('..','..','vendor','sugar','settings',"GenericObject.yml")
|
|
41
|
+
end
|
|
42
|
+
file.destination = File.join('vendor','sugar','settings', "#{source_name}.yml")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
RhoconnectAdapters::CRMSourceGenerator.add_vendor_templates :template, :spec_data do |template,name,crm|
|
|
46
|
+
source_name = name.gsub('-', '_').camel_case
|
|
47
|
+
source_filename = File.join('..','..','vendor','sugar','spec_data',"#{source_name}.yml")
|
|
48
|
+
if File.exists? File.join(CRMSourceGenerator.source_root, source_filename)
|
|
49
|
+
template.source = source_filename
|
|
50
|
+
else
|
|
51
|
+
template.source = File.join('..','..','vendor','sugar','spec_data',"GenericObject.yml")
|
|
52
|
+
end
|
|
53
|
+
template.destination = File.join('vendor','sugar','spec_data', "#{source_name}.yml")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|