acpc_poker_basic_proxy 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dd5fdde51e23ff54d74e6c3f3628e510912c06c
4
- data.tar.gz: 651839fb4c6c3853f53bb13397ffee5dcfb1a348
3
+ metadata.gz: 47020c0a9aa82a5b58e245fedcfbdb04d73d2aad
4
+ data.tar.gz: 6df9cf1e633ecb1b2a3b5138f99461eaf2f87ce0
5
5
  SHA512:
6
- metadata.gz: 2f8c7c72235a8a833c0896ed15401d6f1583e27a0273ebeba4101e7439969ca9190c807ce5c7c32985c97437268d3a91a1dbcbcc53aeb4a27fbbd4d40f28cbfb
7
- data.tar.gz: a2cc8d365785bd41dd02ece30fe5eaf5e0f1901f7dea5e99bd4dabcb392a5e30c452c88e804823c92f3cebfe189b477e7823926ad1a64cff22d225db9cd3d73b
6
+ metadata.gz: 3a7501ed9aa2e6e438990cc91d6e41cfb80d82cac8ee8620d6a9ab59d5ef19d6770ab8cb54abf908a546ee588bf6d11662fd7cdca9240914ab4bafb05ea42d98
7
+ data.tar.gz: 7e7861566bbbb349a0fc7afa6c37ec29d3330ef12af197446434ab0a14cf180fcb02f0d0aacbf9f82af9a77b4f424af1545817cd55ce8473ceea54ed29d7fc43
@@ -25,5 +25,5 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency 'awesome_print', '~> 1.0'
26
26
  s.add_development_dependency 'pry-rescue', '~> 1.0'
27
27
  s.add_development_dependency 'simplecov', '~> 0.7'
28
- s.add_development_dependency 'acpc_dealer', '~> 1.0'
28
+ s.add_development_dependency 'acpc_dealer', '~> 2.0'
29
29
  end
@@ -41,7 +41,10 @@ module AcpcPokerBasicProxy
41
41
 
42
42
  # @param [AcpcDealer::ConnectionInformation] dealer_information Information about the dealer to which this bot should connect.
43
43
  def initialize(dealer_information)
44
- @dealer_communicator = DealerStream.new dealer_information.port_number, dealer_information.host_name, dealer_information.millisecond_response_timeout
44
+ @dealer_communicator = DealerStream.new(
45
+ dealer_information.port_number,
46
+ dealer_information.host_name
47
+ )
45
48
  end
46
49
 
47
50
  # @param [PokerAction] action The action to be sent.
@@ -59,19 +59,12 @@ module AcpcPokerBasicProxy
59
59
 
60
60
  # @param [Integer] port The port on which to connect to the dealer.
61
61
  # @param [String] host_name The host on which the dealer is running. Defaults to 'localhost'
62
- # @param [Integer] millisecond_response_timeout The dealer's response timeout, in milliseconds.
63
62
  # @raise AcpcDealerConnectionError, UnableToWriteToDealer
64
- def initialize(port, host_name='localhost', millisecond_response_timeout=nil)
63
+ def initialize(port, host_name='localhost')
65
64
  begin
66
65
  @dealer_socket = TCPSocket.new(host_name, port)
67
66
  super @dealer_socket
68
67
 
69
- @response_timeout_in_seconds = if millisecond_response_timeout
70
- millisecond_response_timeout/(10**3).to_r
71
- else
72
- nil
73
- end
74
-
75
68
  send_version_string_to_dealer
76
69
  rescue UnableToWriteToDealer
77
70
  raise
@@ -107,12 +100,12 @@ module AcpcPokerBasicProxy
107
100
 
108
101
  # @see TCPSocket#ready_to_write?
109
102
  def ready_to_write?
110
- @dealer_socket.ready_to_write? @response_timeout_in_seconds
103
+ @dealer_socket.ready_to_write?
111
104
  end
112
105
 
113
106
  # @see TCPSocket#ready_to_read?
114
107
  def ready_to_read?
115
- @dealer_socket.ready_to_read? @response_timeout_in_seconds
108
+ @dealer_socket.ready_to_read?
116
109
  end
117
110
 
118
111
  private
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerBasicProxy
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
@@ -17,10 +17,10 @@ describe BasicProxy do
17
17
  port_number = 9001
18
18
  host_name = 'localhost'
19
19
  millisecond_response_timeout = 0
20
- delaer_info = AcpcDealer::ConnectionInformation.new port_number, host_name, millisecond_response_timeout
20
+ delaer_info = AcpcDealer::ConnectionInformation.new port_number, host_name
21
21
  @dealer_communicator = mock 'DealerStream'
22
22
 
23
- DealerStream.expects(:new).once.with(port_number, host_name, millisecond_response_timeout).returns(@dealer_communicator)
23
+ DealerStream.expects(:new).once.with(port_number, host_name).returns(@dealer_communicator)
24
24
 
25
25
  @patient = BasicProxy.new delaer_info
26
26
 
@@ -14,7 +14,7 @@
14
14
  <img src="./assets/0.7.1/loading.gif" alt="loading"/>
15
15
  </div>
16
16
  <div id="wrapper" style="display:none;">
17
- <div class="timestamp">Generated <abbr class="timeago" title="2013-05-16T14:30:23-06:00">2013-05-16T14:30:23-06:00</abbr></div>
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2013-06-07T17:36:13-06:00">2013-06-07T17:36:13-06:00</abbr></div>
18
18
  <ul class="group_tabs"></ul>
19
19
 
20
20
  <div id="content">
@@ -24,10 +24,6 @@ describe DealerStream do
24
24
  end
25
25
  end
26
26
  describe "#ready_to_read?" do
27
- it 'lets the caller know that there is not new input from the dealer' do
28
- connect_successfully!
29
- @patient.ready_to_read?.must_equal false
30
- end
31
27
  it 'lets the caller know that there is new input from the dealer' do
32
28
  connect_successfully!
33
29
  @client_connection.puts "New input"
@@ -55,12 +51,6 @@ describe DealerStream do
55
51
  @client_connection.puts @match_state
56
52
  @patient.gets.must_equal(@match_state)
57
53
  end
58
- it 'disconnects if the timeout is reached' do
59
- [0, 100].each do |t|
60
- start_test_connection! t
61
- -> { @patient.gets }.must_raise DealerStream::UnableToGetFromDealer
62
- end
63
- end
64
54
  end
65
55
 
66
56
  def end_test_connection!
@@ -68,12 +58,11 @@ describe DealerStream do
68
58
  @client_connection.close if @client_connection && !@client_connection.closed?
69
59
  end
70
60
 
71
- def start_test_connection!(millisecond_response_timeout = 0, port = 0)
61
+ def start_test_connection!(port = 0)
72
62
  fake_dealer = TCPServer.open(port)
73
63
  @patient = DealerStream.new(
74
64
  fake_dealer.addr[1],
75
- 'localhost',
76
- millisecond_response_timeout
65
+ 'localhost'
77
66
  )
78
67
  @client_connection = fake_dealer.accept
79
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_poker_basic_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-05 00:00:00.000000000 Z
11
+ date: 2013-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acpc_poker_types
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: '1.0'
131
+ version: '2.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: '1.0'
138
+ version: '2.0'
139
139
  description: Basic proxy to connect to the ACPC Dealer.
140
140
  email:
141
141
  - morrill@ualberta.ca