contactology 0.1.0 → 0.1.1
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/Changelog.markdown
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
### 0.1.1 / 2011-08-25
|
|
2
|
+
|
|
3
|
+
[full changelog](http://github.com/nbibler/contactology/compare/v0.1.0...v0.1.1)
|
|
4
|
+
|
|
5
|
+
* Bug fixes
|
|
6
|
+
* Return the correct campaign class from Campaign#find and Campaign#find_by_name
|
|
7
|
+
|
|
1
8
|
### 0.1.0 / 2011-08-25
|
|
2
9
|
|
|
3
10
|
[full changelog](http://github.com/nbibler/contactology/compare/v0.0.2...v0.1.0)
|
|
@@ -65,9 +65,7 @@ module Contactology
|
|
|
65
65
|
def self.find(id, options = {})
|
|
66
66
|
query('Campaign_Get_Info', options.merge({
|
|
67
67
|
'campaignId' => id,
|
|
68
|
-
:on_success => Proc.new { |
|
|
69
|
-
Campaign.new(response) if response.kind_of?(Hash)
|
|
70
|
-
}
|
|
68
|
+
:on_success => Proc.new { |r| new_campaign_from_response(r) }
|
|
71
69
|
}))
|
|
72
70
|
end
|
|
73
71
|
|
|
@@ -76,8 +74,8 @@ module Contactology
|
|
|
76
74
|
'searchParameters' => {
|
|
77
75
|
'campaignName' => name
|
|
78
76
|
},
|
|
79
|
-
:on_success => Proc.new { |
|
|
80
|
-
|
|
77
|
+
:on_success => Proc.new { |r|
|
|
78
|
+
new_campaign_from_response(r.values.first) unless r.nil?
|
|
81
79
|
}
|
|
82
80
|
}))
|
|
83
81
|
end
|
|
@@ -125,5 +123,20 @@ module Contactology
|
|
|
125
123
|
:on_success => Proc.new { |response| Preview.new(response) }
|
|
126
124
|
}))
|
|
127
125
|
end
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
private
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def self.new_campaign_from_response(response)
|
|
132
|
+
case response['type']
|
|
133
|
+
when 'transactional'
|
|
134
|
+
Campaigns::Transactional.new(response)
|
|
135
|
+
when 'standard'
|
|
136
|
+
Campaigns::Standard.new(response)
|
|
137
|
+
else
|
|
138
|
+
Campaign.new(response)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
128
141
|
end
|
|
129
142
|
end
|
data/lib/contactology/version.rb
CHANGED
|
@@ -17,7 +17,7 @@ describe Contactology::Campaign do
|
|
|
17
17
|
subject { Contactology::Campaign.find campaign.id }
|
|
18
18
|
after(:each) { list.destroy; campaign.destroy }
|
|
19
19
|
|
|
20
|
-
it { should
|
|
20
|
+
it { should be_a Contactology::Campaign }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
context 'for an unknown campaign' do
|
|
@@ -36,7 +36,7 @@ describe Contactology::Campaign do
|
|
|
36
36
|
after(:each) { list.destroy; campaign.destroy }
|
|
37
37
|
subject { Contactology::Campaign.find_by_name campaign.name }
|
|
38
38
|
|
|
39
|
-
it { should
|
|
39
|
+
it { should be_a Contactology::Campaign }
|
|
40
40
|
its(:name) { should == campaign.name }
|
|
41
41
|
end
|
|
42
42
|
|