gbip 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ v0.8.0 (7th November)
2
+ - Add checks for additional error codes, and raise an appropriate error
3
+ - overhauled specs
4
+
5
+ v0.7.1 (14th October)
6
+ - Correctly parse API responses that contain a # in their data
7
+ - Use ISBN13s in queries. No change to user API (we accept ISBN10s or ISBN13s)
8
+
1
9
  v0.7 (2nd October 2008)
2
10
  - Moved out of the RBook namespace
3
11
  - Added GBIP::Title#to_yaml
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/testtask'
5
5
  require "rake/gempackagetask"
6
6
  require 'spec/rake/spectask'
7
7
 
8
- PKG_VERSION = "0.7.1"
8
+ PKG_VERSION = "0.8.0"
9
9
  PKG_NAME = "gbip"
10
10
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
11
11
  RUBYFORGE_PROJECT = 'rbook'
@@ -18,5 +18,8 @@ require 'rbook/isbn'
18
18
  # puts gbip.find("0091835135").inspect
19
19
  #
20
20
  module GBIP
21
- class InvalidLoginError < RuntimeError; end
21
+ class Error < RuntimeError; end
22
+ class InvalidRequestError < Error; end
23
+ class InvalidLoginError < Error; end
24
+ class SystemUnavailableError < Error; end
22
25
  end
@@ -15,10 +15,9 @@ module GBIP
15
15
  POS_PORT = 7052
16
16
 
17
17
  # creates a new POS object ready to perform a search
18
- def initialize(username, password, socket_class = nil)
18
+ def initialize(username, password)
19
19
  @username = username
20
20
  @password = password
21
- @socket_class = socket_class || TCPSocket
22
21
  end
23
22
 
24
23
  # search for the specified ISBN on globalbooksinprint.com.
@@ -37,7 +36,7 @@ module GBIP
37
36
  options = {:timeout => 10}.merge(options)
38
37
 
39
38
  isbn = RBook::ISBN.convert_to_isbn13(isbn.to_s) || isbn.to_s
40
- return default_return if isbn.nil?
39
+ return default_return unless RBook::ISBN.valid_isbn13?(isbn)
41
40
 
42
41
  request_format = "POS"
43
42
  account_type = "3"
@@ -60,11 +59,25 @@ module GBIP
60
59
  request_string << "#{version}\t#{supplier}\t#{request}\t#{filters}\t#{records}\t#{sort_order}\t"
61
60
  request_string << "#{markets}\t"
62
61
 
63
- sock = @socket_class.new(POS_SERVER, POS_PORT)
62
+ sock = TCPSocket.new(POS_SERVER, POS_PORT)
64
63
  sock.print request_string
65
64
  response = Timeout::timeout(options[:timeout]) { sock.gets(nil) }
66
65
  sock.close
67
66
 
67
+ # error handling
68
+ case response.to_s[0,1]
69
+ when "5"
70
+ raise GBIP::InvalidRequestError, "Unknown Account Type or Request Version"
71
+ when "6"
72
+ raise GBIP::InvalidLoginError, "Invalid username or password"
73
+ when "7"
74
+ raise GBIP::InvalidRequestError, "Bad Data"
75
+ when "8"
76
+ raise GBIP::InvalidRequestError, "Invalid Request Version"
77
+ when "9"
78
+ raise GBIP::SystemUnavailableError, "System Unavailable"
79
+ end
80
+
68
81
  # split the response into header/body
69
82
  idx = response.index("#")
70
83
  if idx.nil?
@@ -86,11 +99,6 @@ module GBIP
86
99
  #titles_arr[-1] = titles_arr.last[1,titles_arr.last.size-1]
87
100
  end
88
101
 
89
- # raise an exception if incorrect login details were provided
90
- if header.first.eql?("66")
91
- raise GBIP::InvalidLoginError, "Invalid username or password"
92
- end
93
-
94
102
  if titles_arr.size == 0
95
103
  # return nil if no matching records found
96
104
  return nil
@@ -1,78 +1,151 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
2
2
 
3
3
  require 'gbip'
4
- require File.dirname(__FILE__) + "/mock_tcpsocket"
4
+ require File.dirname(__FILE__) + "/spec_helper"
5
5
  require File.dirname(__FILE__) + "/timeout_tcpsocket"
6
6
 
7
7
  context "A new POS object" do
8
8
 
9
9
  setup do
10
- @valid_username = "user"
11
- @valid_password = "pass"
12
- @invalid_password = "word"
13
- @valid_isbn10 = "1741146712"
14
- @valid_isbn13 = "9781741146714"
15
- @valid_isbn13_hash = "9781590599358"
16
- @notfound_isbn10 = "0571228526"
17
- @notfound_isbn13 = "9780571228522"
18
- @valid_isbn10_with_no_warehouses = "0732282721"
10
+ @username = "user"
11
+ @password = "pass"
12
+ @isbn10 = "1741146712"
13
+ @isbn13 = "9781741146714"
19
14
  end
20
15
 
21
16
  #####################
22
17
  # :first searches
23
18
  #####################
19
+
20
+ specify "should raise an exception when an invalid request is made" do
21
+ # Mock TCPSocket to return an invalid request error code
22
+ data = File.read(File.dirname(__FILE__) + "/responses/invalid_account.txt").strip
23
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
24
+ TCPSocket.stub_method(:new => socket)
25
+
26
+ pos = GBIP::POS.new(@username, @password)
27
+ lambda { pos.find(:first, @isbn10) }.should raise_error(GBIP::InvalidRequestError)
28
+ end
29
+
24
30
  specify "should raise an exception when an invalid username or password is supplied" do
25
- pos = GBIP::POS.new(@valid_username, @invalid_password, MockTCPSocket)
26
- lambda { pos.find(:first, @valid_isbn10) }.should raise_error(GBIP::InvalidLoginError)
31
+ # Mock TCPSocket to return an invalid login error code
32
+ data = File.read(File.dirname(__FILE__) + "/responses/invalid_login.txt").strip
33
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
34
+ TCPSocket.stub_method(:new => socket)
35
+
36
+ pos = GBIP::POS.new(@valid_username, @invalid_password)
37
+ lambda { pos.find(:first, @isbn10) }.should raise_error(GBIP::InvalidLoginError)
38
+ end
39
+
40
+ specify "should raise an exception when an bad data is requested" do
41
+ # Mock TCPSocket to return a bad data error code
42
+ data = File.read(File.dirname(__FILE__) + "/responses/invalid_bad_data.txt").strip
43
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
44
+ TCPSocket.stub_method(:new => socket)
45
+
46
+ pos = GBIP::POS.new(@valid_username, @invalid_password)
47
+ lambda { pos.find(:first, @isbn10) }.should raise_error(GBIP::InvalidRequestError)
48
+ end
49
+
50
+ specify "should raise an exception when an invalid request version is used" do
51
+ # Mock TCPSocket to return an invalid request version error code
52
+ data = File.read(File.dirname(__FILE__) + "/responses/invalid_request.txt").strip
53
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
54
+ TCPSocket.stub_method(:new => socket)
55
+
56
+ pos = GBIP::POS.new(@valid_username, @invalid_password)
57
+ lambda { pos.find(:first, @isbn10) }.should raise_error(GBIP::InvalidRequestError)
58
+ end
59
+
60
+ specify "should raise an exception when a the GBIP API system is unavailable" do
61
+ # Mock TCPSocket to return a system unavailable error code
62
+ data = File.read(File.dirname(__FILE__) + "/responses/invalid_system_unavailable.txt").strip
63
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
64
+ TCPSocket.stub_method(:new => socket)
65
+
66
+ pos = GBIP::POS.new(@valid_username, @invalid_password)
67
+ lambda { pos.find(:first, @isbn10) }.should raise_error(GBIP::SystemUnavailableError)
27
68
  end
28
69
 
29
70
  specify "should return a GBIP::Title object when queried for a single valid ISBN10" do
30
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
31
- result = pos.find(:first, @valid_isbn10)
71
+ # Mock TCPSocket to return a single matching title
72
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
73
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
74
+ TCPSocket.stub_method(:new => socket)
75
+
76
+ pos = GBIP::POS.new(@username, @password)
77
+ result = pos.find(:first, @isbn10)
78
+
79
+ # check that a singlular result is returned, not an array
32
80
  result.should be_a_kind_of(GBIP::Title)
81
+
82
+ # TODO: check that our request was for an isbn13
83
+ socket.should have_received(:print)
33
84
  end
34
85
 
35
86
  specify "should return a GBIP::Title object when queried for a single valid ISBN13" do
36
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
37
- result = pos.find(:first, @valid_isbn13)
87
+ # Mock TCPSocket to return a single matching title
88
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
89
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
90
+ TCPSocket.stub_method(:new => socket)
91
+
92
+ pos = GBIP::POS.new(@valid_username, @valid_password)
93
+ result = pos.find(:first, @isbn13)
38
94
  result.should be_a_kind_of(GBIP::Title)
95
+
96
+ # TODO: check that our request was for an isbn13
97
+ socket.should have_received(:print)
39
98
  end
40
99
 
41
100
  specify "should return a GBIP::Title object when the response contains an extra #" do
42
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
43
- result = pos.find(:first, @valid_isbn13_hash)
101
+ # Mock TCPSocket to return a single matching title that uses a # for its currency
102
+ # sign, as well as a record seperator
103
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result2.txt").strip
104
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
105
+ TCPSocket.stub_method(:new => socket)
106
+
107
+ pos = GBIP::POS.new(@username, @password)
108
+ result = pos.find(:first, @isbn13)
44
109
  result.should be_a_kind_of(GBIP::Title)
45
110
  result.title.should eql("Pro EDI in BizTalk Server 2006 R2:Electronic Document Interchange Solutions")
46
111
  end
47
112
 
48
113
  specify "should return a GBIP::Title object when querying for a single valid ISBN10 that has no warehouse data" do
49
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
50
- result = pos.find(:first, @valid_isbn10_with_no_warehouses)
51
- result.should be_a_kind_of(GBIP::Title)
52
- result.warehouses.should be_empty
53
- end
114
+ # Mock TCPSocket to return a single matching title that lists no warehouses
115
+ data = File.read(File.dirname(__FILE__) + "/responses/no_warehouses.txt").strip
116
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
117
+ TCPSocket.stub_method(:new => socket)
54
118
 
55
- specify "should return a GBIP::Title object when querying for a single valid ISBN10 that has no warehouse data" do
56
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
57
- result = pos.find(:first, @valid_isbn10_with_no_warehouses)
119
+ pos = GBIP::POS.new(@username, @password)
120
+ result = pos.find(:first, @isbn10)
58
121
  result.should be_a_kind_of(GBIP::Title)
59
122
  result.warehouses.should be_empty
60
123
  end
61
124
 
62
125
  specify "should return nil when a single ISBN10 not recognised by GBIP is requested" do
63
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
64
- result = pos.find(:first, @notfound_isbn10)
126
+ # Mock TCPSocket to return a valid response with no matching titles
127
+ data = File.read(File.dirname(__FILE__) + "/responses/no_result.txt").strip
128
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
129
+ TCPSocket.stub_method(:new => socket)
130
+
131
+ pos = GBIP::POS.new(@username, @password)
132
+ result = pos.find(:first, @isbn10)
65
133
  result.should eql(nil)
66
134
  end
67
135
 
68
136
  specify "should return nil when a single ISBN13 not recognised by GBIP is requested" do
69
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
70
- result = pos.find(:first, @notfound_isbn13)
137
+ # Mock TCPSocket to return a valid response with no matching titles
138
+ data = File.read(File.dirname(__FILE__) + "/responses/no_result.txt").strip
139
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
140
+ TCPSocket.stub_method(:new => socket)
141
+
142
+ pos = GBIP::POS.new(@username, @password)
143
+ result = pos.find(:first, @isbn13)
71
144
  result.should eql(nil)
72
145
  end
73
146
 
74
147
  specify "should return nil when any object is supplied as an ISBN when searching for :first" do
75
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
148
+ pos = GBIP::POS.new(@username, @password)
76
149
  result = pos.find(:first, nil)
77
150
  result.should eql(nil)
78
151
 
@@ -84,49 +157,81 @@ context "A new POS object" do
84
157
  end
85
158
 
86
159
  specify "should perform a successful query if the ISBN is provided as a number" do
87
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
88
- result = pos.find(:first, @valid_isbn13)
160
+ # Mock TCPSocket to return a valid response with no matching titles
161
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
162
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
163
+ TCPSocket.stub_method(:new => socket)
164
+
165
+ pos = GBIP::POS.new(@username, @password)
166
+ result = pos.find(:first, @isbn13.to_i)
89
167
  result.should be_a_kind_of(GBIP::Title)
90
168
  end
91
169
 
92
170
  specify "should raise an exception if no reponse is received in a certain amount of time" do
93
- pos = GBIP::POS.new(@valid_username, @valid_password, TimeoutTCPSocket)
94
- lambda { pos.find(:first, @valid_isbn13, :timeout => 2) }.should raise_error(Timeout::Error)
171
+ # Mock TCPSocket to take 5 seconds to generate a response
172
+ socket = TCPSocket.stub_instance(:print => true, :close => true)
173
+ socket.stub_method(:gets) do
174
+ sleep 5
175
+ end
176
+ TCPSocket.stub_method(:new => socket)
177
+
178
+ pos = GBIP::POS.new(@username, @password)
179
+ lambda { pos.find(:first, @isbn13, :timeout => 2) }.should raise_error(Timeout::Error)
95
180
  end
96
181
 
97
182
  #####################
98
183
  # :all searches
99
184
  #####################
100
185
  specify "should return a non-empty Array when queried for a single valid ISBN10" do
101
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
102
- result = pos.find(:all, @valid_isbn10)
186
+ # Mock TCPSocket to return a valid response with a single result
187
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
188
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
189
+ TCPSocket.stub_method(:new => socket)
190
+
191
+ pos = GBIP::POS.new(@username, @password)
192
+ result = pos.find(:all, @isbn10)
103
193
  result.should be_a_kind_of(Array)
104
194
  result.should_not be_empty
105
195
  end
106
196
 
107
197
  specify "should return a non-empty Array when queried for a single valid ISBN13" do
108
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
109
- result = pos.find(:all, @valid_isbn13)
198
+ # Mock TCPSocket to return a valid response with a single result
199
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
200
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
201
+ TCPSocket.stub_method(:new => socket)
202
+
203
+ pos = GBIP::POS.new(@valid_username, @valid_password)
204
+ result = pos.find(:all, @isbn13)
110
205
  result.should be_a_kind_of(Array)
111
206
  result.should_not be_empty
112
207
  end
113
208
 
114
209
  specify "should return an empty Array when a single ISBN10 not recognised by GBIP is requested" do
115
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
116
- result = pos.find(:all, @notfound_isbn10)
210
+ # Mock TCPSocket to return a valid response with no matches
211
+ data = File.read(File.dirname(__FILE__) + "/responses/no_result.txt").strip
212
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
213
+ TCPSocket.stub_method(:new => socket)
214
+
215
+ pos = GBIP::POS.new(@username, @password)
216
+ result = pos.find(:all, @isbn10)
117
217
  result.should be_a_kind_of(Array)
118
218
  result.should be_empty
119
219
  end
120
220
 
121
221
  specify "should return an empty Array when a single ISBN13 not recognised by GBIP is requested" do
122
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
123
- result = pos.find(:all, @notfound_isbn13)
222
+ # Mock TCPSocket to return a valid response with no matches
223
+ data = File.read(File.dirname(__FILE__) + "/responses/no_result.txt").strip
224
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
225
+ TCPSocket.stub_method(:new => socket)
226
+
227
+ pos = GBIP::POS.new(@username, @password)
228
+ result = pos.find(:all, @isbn13)
124
229
  result.should be_a_kind_of(Array)
125
230
  result.should be_empty
126
231
  end
127
232
 
128
233
  specify "should return an empty array when any object is supplied as an ISBN when searching for :all" do
129
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
234
+ pos = GBIP::POS.new(@username, @password)
130
235
  result = pos.find(:all, nil)
131
236
  result.should be_a_kind_of(Array)
132
237
  result.should be_empty
@@ -141,8 +246,13 @@ context "A new POS object" do
141
246
  end
142
247
 
143
248
  specify "should perform a successful query if the ISBN is provided as a number to an :all search" do
144
- pos = GBIP::POS.new(@valid_username, @valid_password, MockTCPSocket)
145
- result = pos.find(:all, 1741146712)
249
+ # Mock TCPSocket to return a valid response with a single result
250
+ data = File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
251
+ socket = TCPSocket.stub_instance(:print => true, :close => true, :gets => data)
252
+ TCPSocket.stub_method(:new => socket)
253
+
254
+ pos = GBIP::POS.new(@username, @password)
255
+ result = pos.find(:all, @isbn13.to_i)
146
256
  result.should be_a_kind_of(Array)
147
257
  result.should_not be_empty
148
258
  end
@@ -151,10 +261,10 @@ context "A new POS object" do
151
261
  # invalid searches
152
262
  #####################
153
263
  specify "should raise an exception when an invalid search type is supplied" do
154
- pos = GBIP::POS.new(@valid_username, @invalid_password, MockTCPSocket)
155
- lambda { pos.find(nil, @valid_isbn10) }.should raise_error(ArgumentError)
156
- lambda { pos.find(:last, @valid_isbn10) }.should raise_error(ArgumentError)
157
- lambda { pos.find(123456, @valid_isbn10) }.should raise_error(ArgumentError)
264
+ pos = GBIP::POS.new(@username, @password)
265
+ lambda { pos.find(nil, @isbn10) }.should raise_error(ArgumentError)
266
+ lambda { pos.find(:last, @isbn10) }.should raise_error(ArgumentError)
267
+ lambda { pos.find(123456, @isbn10) }.should raise_error(ArgumentError)
158
268
  end
159
269
 
160
270
  end
@@ -0,0 +1,5 @@
1
+ require 'not_a_mock'
2
+
3
+ Spec::Runner.configure do |config|
4
+ config.mock_with NotAMock::RspecMockFrameworkAdapter
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gbip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-14 00:00:00 +11:00
12
+ date: 2008-11-07 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,6 @@ files:
40
40
  - lib/gbip/pos.rb
41
41
  - lib/gbip/title.rb
42
42
  - lib/gbip/warehouse.rb
43
- - specs/mock_tcpsocket.rb
44
43
  - specs/pos_class_spec.rb
45
44
  - specs/responses
46
45
  - specs/responses/invalid_login.txt
@@ -48,7 +47,11 @@ files:
48
47
  - specs/responses/no_warehouses.txt
49
48
  - specs/responses/single_result.txt
50
49
  - specs/responses/single_result2.txt
51
- - specs/timeout_tcpsocket.rb
50
+ - specs/responses/invalid_account.txt
51
+ - specs/responses/invalid_bad_data.txt
52
+ - specs/responses/invalid_request.txt
53
+ - specs/responses/invalid_system_unavailable.txt
54
+ - specs/spec_helper.rb
52
55
  - Rakefile
53
56
  - CHANGELOG
54
57
  - README
@@ -85,6 +88,5 @@ signing_key:
85
88
  specification_version: 2
86
89
  summary: A library for access the globalbooksinprint.com API
87
90
  test_files:
88
- - specs/mock_tcpsocket.rb
89
91
  - specs/pos_class_spec.rb
90
- - specs/timeout_tcpsocket.rb
92
+ - specs/spec_helper.rb
@@ -1,44 +0,0 @@
1
- class MockTCPSocket
2
-
3
- def initialize(host,port)
4
- # do nothing
5
- end
6
-
7
- def print(query)
8
- query = query.to_s.split("\t")
9
- @username = query[3]
10
- @password = query[4]
11
- m, @isbn = *query[7].match(/bn=(\d\d\d\d\d\d\d\d\d\d\d\d\d)/)
12
- end
13
-
14
- def gets(placeholder)
15
-
16
- # if incorrect login details are supplied
17
- unless @username.eql?("user") && @password.eql?("pass")
18
- return File.read(File.dirname(__FILE__) + "/responses/invalid_login.txt").strip
19
- end
20
-
21
- # if the requested isbn isn't an isbn10
22
- unless RBook::ISBN.valid_isbn13?(@isbn)
23
- return File.read(File.dirname(__FILE__) + "/responses/no_result.txt").strip
24
- end
25
-
26
- # if the isbn10 is one we have available
27
- if @isbn.eql?("9781741146714")
28
- return File.read(File.dirname(__FILE__) + "/responses/single_result.txt").strip
29
- elsif @isbn.eql?("9781590599358")
30
- return File.read(File.dirname(__FILE__) + "/responses/single_result2.txt").strip
31
- elsif @isbn.eql?("9780732282721")
32
- return File.read(File.dirname(__FILE__) + "/responses/no_warehouses.txt").strip
33
- else
34
- return File.read(File.dirname(__FILE__) + "/responses/no_result.txt").strip
35
- end
36
- @username = nil
37
- @password = nil
38
- isbn = nil
39
- end
40
-
41
- def close
42
-
43
- end
44
- end
@@ -1,19 +0,0 @@
1
- class TimeoutTCPSocket
2
-
3
- def initialize(host,port)
4
- # do nothing
5
- end
6
-
7
- def print(query)
8
- # do nothing
9
- end
10
-
11
- def gets(placeholder)
12
- sleep 5
13
- ""
14
- end
15
-
16
- def close
17
- # do nothing
18
- end
19
- end