postmark_spamcheck 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in postmark_spamcheck.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,23 @@
1
+ require 'restfulie'
2
+
3
+ module PostmarkSpamcheck
4
+ class Error < StandardError; end
5
+
6
+ def self.client
7
+ @client ||= Restfulie.at('http://spamcheck.postmarkapp.com/filter').as("application/json").accepts("application/json")
8
+ end
9
+
10
+ def self.score_for(email)
11
+ resource = client.post(:email => email, :options => 'short').resource
12
+ raise Error, resource['message'] unless resource['success']
13
+
14
+ resource['score'].to_f
15
+ end
16
+
17
+ def self.report_for(email)
18
+ resource = client.post(:email => email, :options => 'long').resource
19
+ raise Error, resource['message'] unless resource['success']
20
+
21
+ resource['report']
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module PostmarkSpamcheck
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "postmark_spamcheck/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "postmark_spamcheck"
7
+ s.version = PostmarkSpamcheck::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Krasimir Angelov"]
10
+ s.email = ["krasio@codingspree.net"]
11
+ s.homepage = ""
12
+ s.summary = %q{Postmarks SpamCheck client}
13
+ s.description = %q{http://spamcheck.postmarkapp.com}
14
+
15
+ s.rubyforge_project = "postmark_spamcheck"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "restfulie"
23
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: postmark_spamcheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Krasimir Angelov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-17 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: restfulie
16
+ requirement: &82354780 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *82354780
25
+ description: http://spamcheck.postmarkapp.com
26
+ email:
27
+ - krasio@codingspree.net
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - lib/postmark_spamcheck.rb
36
+ - lib/postmark_spamcheck/version.rb
37
+ - postmark_spamcheck.gemspec
38
+ homepage: ''
39
+ licenses: []
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project: postmark_spamcheck
58
+ rubygems_version: 1.8.11
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: Postmarks SpamCheck client
62
+ test_files: []