interfax 0.2.1 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +18 -17
- data/README.md +396 -0
- data/interfax.gemspec +20 -0
- data/lib/interfax.rb +13 -8
- data/lib/interfax/account.rb +10 -0
- data/lib/interfax/client.rb +124 -0
- data/lib/interfax/file.rb +31 -0
- data/lib/interfax/forwarding_email.rb +2 -0
- data/lib/interfax/image.rb +15 -0
- data/lib/interfax/inbound.rb +45 -0
- data/lib/interfax/inbound/fax.rb +21 -0
- data/lib/interfax/object.rb +15 -0
- data/lib/interfax/outbound.rb +58 -0
- data/lib/interfax/outbound/delivery.rb +52 -0
- data/lib/interfax/outbound/fax.rb +13 -0
- data/lib/interfax/version.rb +3 -0
- metadata +113 -75
- data/README.markdown +0 -134
- data/Rakefile +0 -46
- data/VERSION +0 -1
- data/lib/interfax/base.rb +0 -120
- data/lib/interfax/fax_item.rb +0 -13
- data/lib/interfax/incoming.rb +0 -223
- data/spec/incoming_helper.rb +0 -23
- data/spec/incoming_spec.rb +0 -108
- data/spec/interfax_spec.rb +0 -7
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -10
data/spec/incoming_helper.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module IncomingHelper
|
2
|
-
|
3
|
-
INTERFAX_RESPONSE = {:messageID => '2011',
|
4
|
-
:phoneNumber => '6145551212',
|
5
|
-
:remoteCSID => '923459129349',
|
6
|
-
:messageStatus => "0",
|
7
|
-
:pages => '1',
|
8
|
-
:messageSize => '58800',
|
9
|
-
:messageType => "1",
|
10
|
-
:receiveTime => "2011-01-01T09:08:11",
|
11
|
-
:callerID => '8005556666',
|
12
|
-
:messageRecordingDuration => "60"}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
class MockInterfaxResponse < Struct.new(:objMessageItem); end
|
17
|
-
class ObjMessageItem < Struct.new(:messageItem); end
|
18
|
-
class MessageItem < Struct.new(*INTERFAX_RESPONSE.keys); end
|
19
|
-
|
20
|
-
def mock_getlist_response(count = 1)
|
21
|
-
MockInterfaxResponse.new(ObjMessageItem.new([MessageItem.new(*INTERFAX_RESPONSE.values)]* count))
|
22
|
-
end
|
23
|
-
end
|
data/spec/incoming_spec.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
include IncomingHelper
|
3
|
-
|
4
|
-
describe Interfax::Incoming do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@client_mock = mock("SoapClient",
|
8
|
-
:GetList => true,
|
9
|
-
:GetImageChunk => true)
|
10
|
-
|
11
|
-
Interfax::Incoming.stub!(:soap_client).and_return(@client_mock)
|
12
|
-
end
|
13
|
-
|
14
|
-
context "querying for incoming faxes" do
|
15
|
-
|
16
|
-
it "should query for all messages" do
|
17
|
-
Interfax::Incoming.should_receive(:query).with('AllMessages', anything())
|
18
|
-
Interfax::Incoming.all
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should query for unread messages" do
|
22
|
-
Interfax::Incoming.should_receive(:query).with('NewMessages', anything())
|
23
|
-
Interfax::Incoming.unread
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should query for all users' unread messages" do
|
27
|
-
Interfax::Incoming.should_receive(:query).with('AccountNewMessages', anything())
|
28
|
-
Interfax::Incoming.account_unread
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should query for all users' messages" do
|
32
|
-
Interfax::Incoming.should_receive(:query).with('AccountAllMessages', anything())
|
33
|
-
Interfax::Incoming.account_all
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should respect the :limit argument over a class-defined limit" do
|
37
|
-
@client_mock.should_receive(:GetList).with(hash_including(:MaxItems => 24))
|
38
|
-
Interfax::Incoming.limit = 50
|
39
|
-
Interfax::Incoming.all(:limit => 24)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should use the class-specified limit over the default" do
|
43
|
-
@client_mock.should_receive(:GetList).with(hash_including(:MaxItems => 50))
|
44
|
-
Interfax::Incoming.limit = 50
|
45
|
-
Interfax::Incoming.all
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should respect the :mark_as_read argument over the class-defined value" do
|
49
|
-
@client_mock.should_receive(:GetList).with(hash_including(:MarkAsRead => true))
|
50
|
-
Interfax::Incoming.mark_as_read = false
|
51
|
-
Interfax::Incoming.all(:mark_as_read => true)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should use the class-specified mark_as_read over the default" do
|
55
|
-
@client_mock.should_receive(:GetList).with(hash_including(:MarkAsRead => true))
|
56
|
-
Interfax::Incoming.mark_as_read = true
|
57
|
-
Interfax::Incoming.all
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
it "should return instances of the base class when called on the base class" do
|
62
|
-
@client_mock.stub!(:GetList).and_return(mock_getlist_response)
|
63
|
-
Interfax::Incoming.all[0].class.should == Interfax::Incoming
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should return instances of the subclass when called on a subclass" do
|
67
|
-
class TestFax < Interfax::Incoming; end
|
68
|
-
|
69
|
-
@client_mock.
|
70
|
-
stub!(:GetList).
|
71
|
-
and_return(mock_getlist_response)
|
72
|
-
TestFax.stub!(:soap_client).and_return(@client_mock)
|
73
|
-
|
74
|
-
TestFax.all[0].class.should == TestFax
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
context "fetching images" do
|
80
|
-
|
81
|
-
before(:each) do
|
82
|
-
details = mock_getlist_response.objMessageItem.messageItem[0]
|
83
|
-
@fax = Interfax::Incoming.new(details)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should fetch the image when asked" do
|
87
|
-
@client_mock.should_receive(:GetImageChunk).at_least(:once)
|
88
|
-
@fax.image
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should cache the image once received" do
|
92
|
-
@client_mock.should_receive(:GetImageChunk).at_least(:once)
|
93
|
-
@fax.image
|
94
|
-
@client_mock.should_not_receive(:GetImageChunk)
|
95
|
-
@fax.image
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should respect the class-defined mark_as_read option" do
|
99
|
-
Interfax::Incoming.mark_as_read = true
|
100
|
-
@client_mock.should_receive(:GetImageChunk).with(hash_including(:MarkAsRead => true))
|
101
|
-
@fax.image
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
data/spec/interfax_spec.rb
DELETED
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED