contactology 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 { |response|
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 { |response|
80
- Campaign.new(response.values.first) unless response.nil?
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
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Contactology
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -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 be_instance_of Contactology::Campaign }
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 be_instance_of Contactology::Campaign }
39
+ it { should be_a Contactology::Campaign }
40
40
  its(:name) { should == campaign.name }
41
41
  end
42
42
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: contactology
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nathaniel Bibler