interfax 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/interfax/incoming.rb +25 -6
- data/spec/incoming_helper.rb +15 -3
- data/spec/incoming_spec.rb +2 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/interfax/incoming.rb
CHANGED
@@ -93,7 +93,7 @@ module Interfax
|
|
93
93
|
|
94
94
|
return [] if result.nil? || !defined?(result.objMessageItem)
|
95
95
|
[*result.objMessageItem.messageItem].map do |fax|
|
96
|
-
self.new(fax
|
96
|
+
self.new(fax)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -157,17 +157,36 @@ module Interfax
|
|
157
157
|
|
158
158
|
end
|
159
159
|
|
160
|
+
# class methods
|
160
161
|
|
161
|
-
|
162
|
-
|
162
|
+
attr_accessor :username, :password, :mark_as_read, :chunk_size, :message_id, :message_size, :image,
|
163
|
+
:interfax_number, :remote_csid, :message_status, :pages, :message_type, :receive_time, :caller_id,
|
164
|
+
:duration
|
163
165
|
|
164
|
-
|
166
|
+
# Normally this is instantied for you as a result of calling one of the
|
167
|
+
# querying class methods. If you want to instantiate an object yourself,
|
168
|
+
# you can pass it the results of the GetList API call, or any object that
|
169
|
+
# looks like it.
|
170
|
+
# See: http://www.interfax.net/en/dev/webservice/reference/getlist
|
171
|
+
def initialize(params = nil)
|
165
172
|
@username = self.class.username
|
166
173
|
@password = self.class.password
|
167
174
|
@mark_as_read = self.class.mark_as_read || false
|
168
175
|
@chunk_size = 100000
|
169
|
-
|
170
|
-
|
176
|
+
|
177
|
+
unless params.nil?
|
178
|
+
@message_id = params.messageID
|
179
|
+
@message_size = params.messageSize.to_i
|
180
|
+
@interfax_number = params.phoneNumber
|
181
|
+
@remote_csid = params.remoteCSID
|
182
|
+
@message_status = params.messageStatus
|
183
|
+
@pages = params.pages
|
184
|
+
@message_type = params.messageType
|
185
|
+
@receive_time = params.receiveTime
|
186
|
+
@caller_id = params.callerID
|
187
|
+
@duration = params.messageRecordingDuration
|
188
|
+
end
|
189
|
+
|
171
190
|
@image = nil
|
172
191
|
end
|
173
192
|
|
data/spec/incoming_helper.rb
CHANGED
@@ -1,11 +1,23 @@
|
|
1
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
|
+
|
2
15
|
|
3
16
|
class MockInterfaxResponse < Struct.new(:objMessageItem); end
|
4
17
|
class ObjMessageItem < Struct.new(:messageItem); end
|
5
|
-
class MessageItem < Struct.new(
|
6
|
-
|
18
|
+
class MessageItem < Struct.new(*INTERFAX_RESPONSE.keys); end
|
7
19
|
|
8
20
|
def mock_getlist_response(count = 1)
|
9
|
-
MockInterfaxResponse.new(ObjMessageItem.new([MessageItem.new(
|
21
|
+
MockInterfaxResponse.new(ObjMessageItem.new([MessageItem.new(*INTERFAX_RESPONSE.values)]* count))
|
10
22
|
end
|
11
23
|
end
|
data/spec/incoming_spec.rb
CHANGED
@@ -79,7 +79,8 @@ describe Interfax::Incoming do
|
|
79
79
|
context "fetching images" do
|
80
80
|
|
81
81
|
before(:each) do
|
82
|
-
|
82
|
+
details = mock_getlist_response.objMessageItem.messageItem[0]
|
83
|
+
@fax = Interfax::Incoming.new(details)
|
83
84
|
end
|
84
85
|
|
85
86
|
it "should fetch the image when asked" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sascha Brink
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-04
|
17
|
+
date: 2011-05-04 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|