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.
@@ -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
@@ -1,4 +0,0 @@
1
- require "rubygems"
2
- require "rspec"
3
-
4
- require File.expand_path('../lib/marketo', File.dirname(__FILE__))