marketo-api-ruby 0.8 → 0.9
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.tar.gz.sig +2 -2
- data/.coveralls.yml +2 -0
- data/.hoerc +2 -0
- data/.travis.yml +33 -0
- data/History.rdoc +11 -0
- data/Manifest.txt +3 -5
- data/README.rdoc +7 -2
- data/lib/marketo_api.rb +1 -1
- data/lib/marketo_api/campaigns.rb +19 -10
- data/lib/marketo_api/client.rb +12 -11
- data/lib/marketo_api/lead.rb +14 -14
- data/lib/marketo_api/leads.rb +5 -5
- data/lib/marketo_api/lists.rb +7 -7
- data/lib/marketo_api/mobject.rb +13 -12
- data/lib/marketo_api/mobjects.rb +3 -3
- data/test/marketo_api/test_campaigns.rb +37 -32
- data/test/marketo_api/test_lead.rb +10 -10
- data/test/marketo_api/test_leads.rb +4 -4
- data/test/marketo_api/test_lists.rb +17 -17
- data/test/marketo_api/test_mobject.rb +25 -19
- data/test/marketo_api/test_mobjects.rb +4 -4
- data/test/minitest_helper.rb +13 -0
- metadata +45 -12
- metadata.gz.sig +1 -3
- checksums.yaml +0 -15
- checksums.yaml.gz.sig +0 -0
- data/spec/marketo/authentication_header_spec.rb +0 -66
- data/spec/marketo/client_spec.rb +0 -363
- data/spec/marketo/lead_key_spec.rb +0 -40
- data/spec/marketo/lead_record_spec.rb +0 -86
- data/spec/spec_helper.rb +0 -4
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
module Rapleaf
|
4
|
-
module Marketo
|
5
|
-
describe LeadKeyType do
|
6
|
-
it "should define the correct types" do
|
7
|
-
LeadKeyType::IDNUM.should == 'IDNUM'
|
8
|
-
LeadKeyType::COOKIE.should == 'COOKIE'
|
9
|
-
LeadKeyType::EMAIL.should == 'EMAIL'
|
10
|
-
LeadKeyType::LEADOWNEREMAIL.should == 'LEADOWNEREMAIL'
|
11
|
-
LeadKeyType::SFDCACCOUNTID.should == 'SFDCACCOUNTID'
|
12
|
-
LeadKeyType::SFDCCONTACTID.should == 'SFDCCONTACTID'
|
13
|
-
LeadKeyType::SFDCLEADID.should == 'SFDCLEADID'
|
14
|
-
LeadKeyType::SFDCLEADOWNERID.should == 'SFDCLEADOWNERID'
|
15
|
-
LeadKeyType::SFDCOPPTYID.should == 'SFDCOPPTYID'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe LeadKey do
|
20
|
-
it "should store type and value on construction" do
|
21
|
-
KEY_VALUE = 'a value'
|
22
|
-
KEY_TYPE = LeadKeyType::IDNUM
|
23
|
-
lead_key = LeadKey.new(KEY_TYPE, KEY_VALUE)
|
24
|
-
lead_key.key_type.should == KEY_TYPE
|
25
|
-
lead_key.key_value.should == KEY_VALUE
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should to_hash correctly" do
|
29
|
-
KEY_VALUE = 'a value'
|
30
|
-
KEY_TYPE = LeadKeyType::IDNUM
|
31
|
-
lead_key = LeadKey.new(KEY_TYPE, KEY_VALUE)
|
32
|
-
|
33
|
-
lead_key.to_hash.should == {
|
34
|
-
:key_type => KEY_TYPE,
|
35
|
-
:key_value => KEY_VALUE
|
36
|
-
}
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
2
|
-
|
3
|
-
module Rapleaf
|
4
|
-
module Marketo
|
5
|
-
EMAIL = 'some@email.com'
|
6
|
-
IDNUM = 93480938
|
7
|
-
|
8
|
-
describe LeadRecord do
|
9
|
-
it "should store the idnum" do
|
10
|
-
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
11
|
-
lead_record.idnum.should == IDNUM
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should store the email" do
|
15
|
-
LeadRecord.new(EMAIL, IDNUM).email.should == EMAIL
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should implement == sensibly" do
|
19
|
-
lead_record1 = LeadRecord.new(EMAIL, IDNUM)
|
20
|
-
lead_record1.set_attribute('favourite color', 'red')
|
21
|
-
lead_record1.set_attribute('age', '100')
|
22
|
-
|
23
|
-
lead_record2 = LeadRecord.new(EMAIL, IDNUM)
|
24
|
-
lead_record2.set_attribute('favourite color', 'red')
|
25
|
-
lead_record2.set_attribute('age', '100')
|
26
|
-
|
27
|
-
lead_record1.should == lead_record2
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should store when attributes are set" do
|
31
|
-
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
32
|
-
lead_record.set_attribute('favourite color', 'red')
|
33
|
-
lead_record.get_attribute('favourite color').should == 'red'
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should store when attributes are updated" do
|
37
|
-
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
38
|
-
lead_record.set_attribute('favourite color', 'red')
|
39
|
-
lead_record.set_attribute('favourite color', 'green')
|
40
|
-
lead_record.get_attribute('favourite color').should == 'green'
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should yield all attributes through each_attribute_pair" do
|
44
|
-
lead_record = LeadRecord.new(EMAIL, IDNUM)
|
45
|
-
lead_record.set_attribute('favourite color', 'red')
|
46
|
-
lead_record.set_attribute('favourite color', 'green')
|
47
|
-
lead_record.set_attribute('age', '99')
|
48
|
-
|
49
|
-
pairs = []
|
50
|
-
lead_record.each_attribute_pair do |attribute_name, attribute_value|
|
51
|
-
pairs << [attribute_name, attribute_value]
|
52
|
-
end
|
53
|
-
|
54
|
-
pairs.size.should == 3
|
55
|
-
pairs.should include(['favourite color', 'green'])
|
56
|
-
pairs.should include(['age', '99'])
|
57
|
-
pairs.should include(['Email', EMAIL])
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should be instantiable from a savon hash" do
|
61
|
-
savon_hash = {
|
62
|
-
:email => EMAIL,
|
63
|
-
:foreign_sys_type => nil,
|
64
|
-
:lead_attribute_list => {
|
65
|
-
:attribute => [
|
66
|
-
{ :attr_name => 'Company', :attr_type => 'string', :attr_value => 'Rapleaf'},
|
67
|
-
{ :attr_name => 'FirstName', :attr_type => 'string', :attr_value => 'James'},
|
68
|
-
{ :attr_name => 'LastName', :attr_type => 'string', :attr_value => 'O\'Brien'}
|
69
|
-
]
|
70
|
-
},
|
71
|
-
:foreign_sys_person_id => nil,
|
72
|
-
:id => IDNUM
|
73
|
-
}
|
74
|
-
|
75
|
-
actual = LeadRecord.from_hash(savon_hash)
|
76
|
-
|
77
|
-
expected = LeadRecord.new(EMAIL, IDNUM)
|
78
|
-
expected.set_attribute('Company', 'Rapleaf')
|
79
|
-
expected.set_attribute('FirstName', 'James')
|
80
|
-
expected.set_attribute('LastName', 'O\'Brien')
|
81
|
-
|
82
|
-
actual.should == expected
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
data/spec/spec_helper.rb
DELETED