ihunter-whatcounts 0.3.4 → 0.3.5

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.
@@ -4,23 +4,71 @@
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- FIX (describe your package)
7
+ Ruby library with Rails Mailer class for working with WhatCounts mail provider.
8
+
9
+ 1) Make sure to configure WhatCounts:
10
+
11
+ WhatCounts::HttpClient.configure do
12
+ realm "my_realm"
13
+ password "foobar"
14
+ end
15
+
16
+ Then to use (better usages soon):
17
+
18
+ Lists
19
+ WhatCounts::List.create! { :name => 'name', :template_id => 'template',
20
+ :from_address => '', :reply_to_address => '', :bounce_address => '',
21
+ :track_clicks => true, :track_opens => true }
22
+
23
+ One Off Messages
24
+ WhatCounts::OneOffMessage.new :list_id => 1234, :template_id => 5678, :to => 'person@example.com', :format => 99
25
+
26
+ WhatCounts::OneOffMessage.send! :list_id => 1234, :template_id => 5678, :format => 99,
27
+ :to => "recipient@test.com", :from => "sender@example.com",
28
+ :subject => headline,
29
+ :data => { :url => "http://example.com",
30
+ :some_number => 1234
31
+ }
32
+
33
+ Rails Integration (place in environments/#{RAILS_ENV}.rb)
34
+ config.after_initialize do
35
+ module ::WhatCounts
36
+ Rails::Mailer.default_url_options = {:host => 'assets.example.com'} # needed for url_for to work
37
+ HttpClient.configure do
38
+ realm "my_realm"
39
+ password "foobar"
40
+ end
41
+ end
42
+ end
43
+
44
+ Then extend the WhatCounts::Rails::Mailer class and use similar to ActionMailer::Base
45
+ class SomeMailer < WhatCounts::Rails::Mailer
46
+ # I will be adding method_missing logic so you can call the mailer like you would in Rails.
47
+ class << self
48
+ def deliver_something(*args)
49
+ self.new.something(*args)
50
+ end
51
+ end
52
+
53
+ def something(*args)
54
+ # do yer mailing
55
+ end
56
+ end
57
+
58
+ It's still largely incomplete as it was designed to serve specific needs. Feel free to contribute.
8
59
 
9
60
  == FEATURES/PROBLEMS:
10
61
 
11
- * FIX (list of features or problems)
12
-
13
62
  == SYNOPSIS:
14
63
 
15
- FIX (code sample of usage)
16
-
17
64
  == REQUIREMENTS:
18
65
 
19
- * FIX (list of requirements)
66
+ * curb
67
+ * fastercsv
20
68
 
21
69
  == INSTALL:
22
70
 
23
- * FIX (sudo gem install, anything else)
71
+ gem install ihunter-whatcounts
24
72
 
25
73
  == LICENSE:
26
74
 
@@ -1,23 +1,12 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
- # begin
5
- require 'curb'
6
- # rescue Exception => e
7
- # puts "curb is required for whatcounts gem\n"
8
- # puts "gem install curb"
9
- # exit
10
- # end
11
- #
12
- # begin
13
- require 'fastercsv'
14
- # rescue
15
- # puts "fastercsv is required for whatcounts gem\n"
16
- # exit
17
- # end
4
+ require 'curb'
5
+ require 'cgi'
6
+ # require 'fastercsv'
18
7
 
19
8
  module WhatCounts
20
- VERSION = '0.3.4'
9
+ VERSION = '0.3.5'
21
10
  class WhatCountsError < StandardError; end
22
11
 
23
12
  class CreationError < WhatCountsError; end
@@ -3,7 +3,7 @@ module WhatCounts
3
3
 
4
4
  private
5
5
  OPTIONS_TO_HTTP_PARAMS_MAP = {:list_id => :list_id, :template_id => :template_id, :format => :format, :to => :to, :from => :from,
6
- :subject => :subject, :body => :body, :data => :data}
6
+ :subject => :subject, :body => :body, :data => :data, :virtual_mta => :vmta}
7
7
  attr_writer *(OPTIONS_TO_HTTP_PARAMS_MAP.keys)
8
8
 
9
9
  public
@@ -26,7 +26,7 @@ module WhatCounts
26
26
  end
27
27
  end
28
28
 
29
- def success?; self.result end
29
+ def success?; !!self.result end
30
30
  def failure?; !self.result end
31
31
  end
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ihunter-whatcounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Hunter
@@ -74,6 +74,6 @@ rubyforge_project: whatcounts
74
74
  rubygems_version: 1.2.0
75
75
  signing_key:
76
76
  specification_version: 3
77
- summary: FIX (describe your package)
77
+ summary: WhatCounts HTTP API interface
78
78
  test_files: []
79
79