fail_mail 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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/fail_mail.gemspec +25 -0
- data/lib/fail_mail/base.rb +14 -0
- data/lib/fail_mail/client.rb +19 -0
- data/lib/fail_mail/configurable.rb +16 -0
- data/lib/fail_mail/list.rb +8 -0
- data/lib/fail_mail/member.rb +71 -0
- data/lib/fail_mail/subscription.rb +26 -0
- data/lib/fail_mail/version.rb +3 -0
- data/lib/fail_mail.rb +31 -0
- data/spec/fail_mail/list_spec.rb +4 -0
- data/spec/fail_mail/member_spec.rb +84 -0
- data/spec/fail_mail/subscription_spec.rb +49 -0
- data/spec/fail_mail_spec.rb +22 -0
- data/spec/spec_helper.rb +2 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4fb832f8a06a77964741782ed647222f6e07b699
|
4
|
+
data.tar.gz: 35c92f64211ff1ce04051f3c400e8c2ad2a6ab5e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dc10894079897b1558b98819fb7be8329de159380fdb7b3f715c623cdd24331500048a37dbfed2b82a5ce1121348075f08261f7c40b61c6365db3f4bd987baa
|
7
|
+
data.tar.gz: adbc33c69f9bc0d56e98b48c4729cce0c5a285432f39130cd0ff8160fa5bac5360a2e6aca09e9085fee839e709d6cbc6d09da9f1e7c8ada0fa28f9e1cf967f9c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Adam Zaninovich
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Fail Mail
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'fail_mail'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install fail_mail
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/fail_mail.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fail_mail/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fail_mail"
|
8
|
+
spec.version = FailMail::VERSION
|
9
|
+
spec.authors = ['Adam Zaninovich']
|
10
|
+
spec.email = ['adam.zaninovich@gmail.com']
|
11
|
+
spec.homepage = ""
|
12
|
+
spec.summary = %q{Lyris is an enterprise email service. FailMail makes it easy for Ruby to talk to Lyris's API.}
|
13
|
+
spec.description = %q{Lyris is an enterprise email service. FailMail makes it easy for Ruby to talk to Lyris's API.}
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
|
24
|
+
spec.add_dependency "savon", "~> 2.2.0"
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'savon'
|
2
|
+
|
3
|
+
module FailMail
|
4
|
+
class Client
|
5
|
+
def initialize options={}
|
6
|
+
options[:convert_request_keys_to] = :none
|
7
|
+
@lyris_client = Savon.client options
|
8
|
+
end
|
9
|
+
|
10
|
+
def call *args, &block
|
11
|
+
@lyris_client.call *args, &block
|
12
|
+
end
|
13
|
+
|
14
|
+
def operations
|
15
|
+
@lyris_client.operations
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module FailMail
|
2
|
+
class Member < Base
|
3
|
+
attr_reader :email, :name
|
4
|
+
|
5
|
+
def initialize email, name, client=FailMail.client
|
6
|
+
super client
|
7
|
+
@email = email
|
8
|
+
@name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
def subscribe! list_name
|
12
|
+
create_member list_name
|
13
|
+
rescue Savon::SOAPFault => exception
|
14
|
+
member_id = extract_member_id_from_exception exception.message, list_name
|
15
|
+
subscribe_member member_id, list_name if member_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def unsubscribe! list_name
|
19
|
+
subscription = subscriptions.find { |sub| sub.list_name == list_name }
|
20
|
+
subscription.unsubscribe! if subscription
|
21
|
+
end
|
22
|
+
|
23
|
+
def subscriptions
|
24
|
+
@subscriptions ||= begin
|
25
|
+
response = call :select_members_ex, message: {
|
26
|
+
FieldsToFetch: { string: %w[MemberID ListName MemberType] },
|
27
|
+
FilterCriteriaArray: { string: ["EmailAddress = #{email}", "MemberType = normal"] }
|
28
|
+
}
|
29
|
+
subscriptions = response.body[:select_members_ex_response][:return][:item]
|
30
|
+
subscriptions.shift
|
31
|
+
subscriptions.map do |list|
|
32
|
+
member_id, list_name, _ = list[:item]
|
33
|
+
FailMail::Subscription.new list_name, member_id, self
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def create_member list_name
|
41
|
+
response = call :create_single_member, message: {
|
42
|
+
EmailAddress: email,
|
43
|
+
FullName: name,
|
44
|
+
ListName: list_name
|
45
|
+
}
|
46
|
+
member_id = response.body[:create_single_member_response][:return]
|
47
|
+
FailMail::Subscription.new list_name, member_id, self
|
48
|
+
end
|
49
|
+
|
50
|
+
def subscribe_member member_id, list_name
|
51
|
+
response = call :update_member_status, message: {
|
52
|
+
MemberStatus: 'needs-confirm',
|
53
|
+
SimpleMemberStructIn: {
|
54
|
+
MemberID: member_id,
|
55
|
+
EmailAddress: email,
|
56
|
+
ListName: list_name
|
57
|
+
}
|
58
|
+
}
|
59
|
+
if response.body[:update_member_status_response][:return]
|
60
|
+
FailMail::Subscription.new list_name, member_id, self
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def extract_member_id_from_exception message, list_name
|
65
|
+
e_list_name, e_email, member_id = message.scan(/'([^']*)'/).map &:first
|
66
|
+
member_id if e_list_name == list_name && e_email == email
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module FailMail
|
2
|
+
class Subscription < Base
|
3
|
+
attr_reader :list_name, :member_id, :member
|
4
|
+
|
5
|
+
def initialize list_name, member_id, member, client=FailMail.client
|
6
|
+
super client
|
7
|
+
@list_name = list_name
|
8
|
+
@member_id = member_id
|
9
|
+
@member = member
|
10
|
+
end
|
11
|
+
|
12
|
+
def unsubscribe!
|
13
|
+
response = call :unsubscribe, message: {
|
14
|
+
SimpleMemberStructArrayIn: {
|
15
|
+
item: {
|
16
|
+
MemberID: member_id,
|
17
|
+
EmailAddress: member.email,
|
18
|
+
ListName: list_name
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
response.body[:unsubscribe_response][:return] == "1"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
data/lib/fail_mail.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "fail_mail/version"
|
2
|
+
require "fail_mail/configurable"
|
3
|
+
require "fail_mail/base"
|
4
|
+
require "fail_mail/client"
|
5
|
+
require "fail_mail/member"
|
6
|
+
require "fail_mail/subscription"
|
7
|
+
require "fail_mail/list"
|
8
|
+
|
9
|
+
# Configuration Example
|
10
|
+
#
|
11
|
+
# FailMail.configure do |config|
|
12
|
+
# config.wsdl = "http://example.com/?wsdl"
|
13
|
+
# config.basic_auth = ["username", "password"]
|
14
|
+
# end
|
15
|
+
|
16
|
+
module FailMail
|
17
|
+
extend FailMail::Configurable
|
18
|
+
|
19
|
+
def self.client
|
20
|
+
FailMail::Client.new options
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.options
|
24
|
+
options = {}
|
25
|
+
FailMail::Configurable.keys.each do |key|
|
26
|
+
options[key] = send key
|
27
|
+
end
|
28
|
+
options
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'savon/mock/spec_helper'
|
3
|
+
|
4
|
+
describe FailMail::Member do
|
5
|
+
include Savon::SpecHelper
|
6
|
+
|
7
|
+
before(:all) { savon.mock! }
|
8
|
+
after(:all) { savon.unmock! }
|
9
|
+
let(:email) { 'test@example.com' }
|
10
|
+
let(:name) { 'Example User' }
|
11
|
+
let(:member) { FailMail::Member.new email, name }
|
12
|
+
|
13
|
+
describe "initialization" do
|
14
|
+
it "initializes with an email" do
|
15
|
+
member.email.should == email
|
16
|
+
end
|
17
|
+
|
18
|
+
it "initializes with an name" do
|
19
|
+
member.name.should == name
|
20
|
+
end
|
21
|
+
|
22
|
+
it "has a client" do
|
23
|
+
member.client.should be_a FailMail::Client
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#subscribe!" do
|
28
|
+
let(:email) { "test@example.com" }
|
29
|
+
let(:list_name) { "my-awesome-list" }
|
30
|
+
let(:member_id) { "123456789" }
|
31
|
+
|
32
|
+
context "when the member is not already on the list" do
|
33
|
+
let(:xml_response) { %Q|<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://tempuri.org/ns1.xsd" xmlns:ns="http://www.lyris.com/lmapi"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns:CreateSingleMemberResponse><return xsi:type="xsd:int">#{member_id}</return></ns:CreateSingleMemberResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>| }
|
34
|
+
let(:options) { { message: { EmailAddress: email, FullName: name, ListName: list_name } } }
|
35
|
+
|
36
|
+
it "calls create_single_member and returns something" do
|
37
|
+
savon.expects(:create_single_member).with(options).returns xml_response
|
38
|
+
member.subscribe!(list_name).member_id.should == member_id
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when the member is already on the list" do
|
43
|
+
let(:create_xml_response) { %Q|<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://tempuri.org/ns1.xsd" xmlns:ns="http://www.lyris.com/lmapi"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring xsi:type="xsd:string">A member already exists on list '#{list_name}' with email address '#{email}', with ID '#{member_id}'</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>| }
|
44
|
+
let(:update_xml_response) { %Q|<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://tempuri.org/ns1.xsd" xmlns:ns="http://www.lyris.com/lmapi"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns:UpdateMemberStatusResponse><return xsi:type="xsd:boolean">true</return></ns:UpdateMemberStatusResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>| }
|
45
|
+
let(:create_options) { { message: { EmailAddress: email, FullName: name, ListName: list_name } } }
|
46
|
+
let(:update_options) { { message: { MemberStatus: 'needs-confirm', SimpleMemberStructIn: { MemberID: member_id, EmailAddress: email, ListName: list_name } } } }
|
47
|
+
|
48
|
+
it "calls both create_single_member and update_member_status which returns true" do
|
49
|
+
savon.expects(:create_single_member).with(create_options).returns create_xml_response
|
50
|
+
savon.expects(:update_member_status).with(update_options).returns update_xml_response
|
51
|
+
member.subscribe!(list_name).member_id.should == member_id
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#unsubscribe!" do
|
58
|
+
let(:subscription) { FailMail::Subscription.new 'example_list', '1234', member }
|
59
|
+
|
60
|
+
it "calls subscriptions" do
|
61
|
+
subscription.stub :unsubscribe!
|
62
|
+
member.should_receive(:subscriptions).and_return [subscription]
|
63
|
+
member.unsubscribe! 'example_list'
|
64
|
+
end
|
65
|
+
|
66
|
+
it "calls unsubscribe! on the subscription" do
|
67
|
+
subscription.should_receive :unsubscribe!
|
68
|
+
member.stub subscriptions: [subscription]
|
69
|
+
member.unsubscribe! 'example_list'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#subscriptions" do
|
74
|
+
let(:options) { { message: { FieldsToFetch: { string: %w[MemberID ListName MemberType] }, FilterCriteriaArray: { string: ["EmailAddress = #{email}", "MemberType = normal"] } } } }
|
75
|
+
let(:xml_response) { "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:ns1=\"http://tempuri.org/ns1.xsd\" xmlns:ns=\"http://www.lyris.com/lmapi\"><SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><ns:SelectMembersExResponse><return xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:string[][2]\"><item xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:string[3]\"><item xsi:type=\"xsd:string\">memberid</item><item xsi:type=\"xsd:string\">listname</item><item xsi:type=\"xsd:string\">membertype</item></item><item xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:string[3]\"><item xsi:type=\"xsd:string\">114376836</item><item xsi:type=\"xsd:string\">active-trainer2</item><item xsi:type=\"xsd:string\">normal</item></item></return></ns:SelectMembersExResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>" }
|
76
|
+
|
77
|
+
it "returns an array of Subscriptions" do
|
78
|
+
savon.expects(:select_members_ex).with(options).returns xml_response
|
79
|
+
member.subscriptions.first.should be_a FailMail::Subscription
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'savon/mock/spec_helper'
|
3
|
+
|
4
|
+
describe FailMail::Subscription do
|
5
|
+
include Savon::SpecHelper
|
6
|
+
|
7
|
+
before(:all) { savon.mock! }
|
8
|
+
after(:all) { savon.unmock! }
|
9
|
+
let(:email) { "test@example.com" }
|
10
|
+
let(:member_id) { "123456789" }
|
11
|
+
let(:list_name) { "my-awesome-list" }
|
12
|
+
let(:member) { FailMail::Member.new email, 'Name' }
|
13
|
+
let(:subscription) { FailMail::Subscription.new list_name, member_id, member }
|
14
|
+
|
15
|
+
describe "initialization" do
|
16
|
+
it "initializes with a list name" do
|
17
|
+
subscription.list_name.should == "my-awesome-list"
|
18
|
+
end
|
19
|
+
it "initializes with a member id" do
|
20
|
+
subscription.member_id.should == "123456789"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "has a client" do
|
24
|
+
subscription.client.should be_a FailMail::Client
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#unsubscribe!" do
|
29
|
+
let(:options) { { message: { SimpleMemberStructArrayIn: { item: { MemberID: member_id, EmailAddress: member.email, ListName: list_name } } } } }
|
30
|
+
context "when the response is 1" do
|
31
|
+
let(:xml_response) { "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:ns1=\"http://tempuri.org/ns1.xsd\" xmlns:ns=\"http://www.lyris.com/lmapi\"><SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><ns:UnsubscribeResponse><return xsi:type=\"xsd:int\">1</return></ns:UnsubscribeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>" }
|
32
|
+
|
33
|
+
it "is true" do
|
34
|
+
savon.expects(:unsubscribe).with(options).returns xml_response
|
35
|
+
response = subscription.unsubscribe!
|
36
|
+
response.should be_true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
context "when the response is 0" do
|
40
|
+
let(:xml_response) { "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:ns1=\"http://tempuri.org/ns1.xsd\" xmlns:ns=\"http://www.lyris.com/lmapi\"><SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><ns:UnsubscribeResponse><return xsi:type=\"xsd:int\">0</return></ns:UnsubscribeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>" }
|
41
|
+
it "is false" do
|
42
|
+
savon.expects(:unsubscribe).with(options).returns xml_response
|
43
|
+
response = subscription.unsubscribe!
|
44
|
+
response.should be_false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FailMail do
|
4
|
+
|
5
|
+
describe '.client' do
|
6
|
+
it "returns a FailMail::Client" do
|
7
|
+
FailMail.client.should be_a FailMail::Client
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '.configure' do
|
12
|
+
FailMail::Configurable.keys.each do |key|
|
13
|
+
it "sets the #{key}" do
|
14
|
+
FailMail.configure do |config|
|
15
|
+
config.send "#{key}=", key
|
16
|
+
end
|
17
|
+
FailMail.send(key).should == key
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fail_mail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Zaninovich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: savon
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.2.0
|
69
|
+
description: Lyris is an enterprise email service. FailMail makes it easy for Ruby
|
70
|
+
to talk to Lyris's API.
|
71
|
+
email:
|
72
|
+
- adam.zaninovich@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- fail_mail.gemspec
|
83
|
+
- lib/fail_mail.rb
|
84
|
+
- lib/fail_mail/base.rb
|
85
|
+
- lib/fail_mail/client.rb
|
86
|
+
- lib/fail_mail/configurable.rb
|
87
|
+
- lib/fail_mail/list.rb
|
88
|
+
- lib/fail_mail/member.rb
|
89
|
+
- lib/fail_mail/subscription.rb
|
90
|
+
- lib/fail_mail/version.rb
|
91
|
+
- spec/fail_mail/list_spec.rb
|
92
|
+
- spec/fail_mail/member_spec.rb
|
93
|
+
- spec/fail_mail/subscription_spec.rb
|
94
|
+
- spec/fail_mail_spec.rb
|
95
|
+
- spec/spec_helper.rb
|
96
|
+
homepage: ''
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.0.5
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: Lyris is an enterprise email service. FailMail makes it easy for Ruby to
|
120
|
+
talk to Lyris's API.
|
121
|
+
test_files:
|
122
|
+
- spec/fail_mail/list_spec.rb
|
123
|
+
- spec/fail_mail/member_spec.rb
|
124
|
+
- spec/fail_mail/subscription_spec.rb
|
125
|
+
- spec/fail_mail_spec.rb
|
126
|
+
- spec/spec_helper.rb
|