client_for_poslynx 1.0.1 → 1.0.2

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzFmYTkyYTMxMmQ2M2RiNDhmMGFiZDc1YTk5MmYwOWVkYmM3ZTgwMg==
4
+ MmRkZWUzM2U4MjE5MzlmZTJkODY2OGJiYzM3NjA0NDZhZTE1NjQ0NQ==
5
5
  data.tar.gz: !binary |-
6
- NDk0ZTUwMzJiNGJmMTlhZWUwNDY5OGI4MDQ5ZDFkNzdkMTgzMjBmMQ==
6
+ ZDNlNTBhYzgwOWQ3YTNjODc2NjNiZmNjMGQ5NjI0NzZiYTI0OThmZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzY3NDY0NzY2ZjA5NjRlYWUxYjUwOWM0Y2U3YTc0ODIyNDliNTFkOWU3ZDA3
10
- NmFmNDBhYzBmNzc3ZDQ5NjgxZDRkYmMzNmRlNWRkYzczMDEzMjk0ZmVlZjk5
11
- Yjk0MzdlYWQ4MDFjZjQwZGIzZWQ1Yjk4NjY0OGFjNGM5YTI2NGQ=
9
+ NGNlZGQxODM1M2I1NTVkZDdjMmUwNmNhNThlZWFlYzJhNThjYzY5YTYwNjYx
10
+ OGUxZGYyNDdiYzA1MTZkYTEwYzdmYmZkOTU0MGQ0MjNiOGY3NDdlNzY0ZDE5
11
+ MTMzZDU4NDNmZWZkMjI2N2Y3ZjE2YWU2YmE3ZDZiNzBlNjlkNzY=
12
12
  data.tar.gz: !binary |-
13
- ZTkxNjY5MTM4NGQyNGNmYWRiMDg1YmFiMzQ4NDNkMmUyYmI1ZjRhYzBhY2I4
14
- ODNhZjYzODEwMjdiMzkxZjE3NDZkNjllYjZhNjM4OGQxYTkzMDU1NDgxOGI1
15
- MDYwNTRkNzg5NzE1NjcyOGRjZjdlYmI3MTIxYjVlYjdjZjlmMTA=
13
+ OTFiOTZhZmJjZGQxNThiZDQ0YWU0ZDEwYTFjNTkxNDY5YjlkZTNmNDIwZjJm
14
+ YzQzNmFhNGYzNTY4OGIwZDEwZTM4NzM2NjBkOTc4NmIzOWE4YThiYjY3ZmYz
15
+ OGExOGE0MTM2YmFjN2YzOTgwMzliODBmMWIxZWQ1ODA1NzIxOGI=
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ Version 1.02
2
+ - Raise more specific RequestAfterDetachedError exception when
3
+ a detached EM_Session attempts to send a request to the
4
+ POSLynx unit.
5
+
1
6
  Version 1.0.1
2
7
  - Allow nested calls to EM_Session#exec_dissociated
3
8
 
@@ -28,7 +28,11 @@ module ClientForPoslynx
28
28
  # Raised when attempting to make a request while another
29
29
  # session is waiting for a response to a request of the
30
30
  # same type (other than PinPadReset).
31
- class ConflictingRequestError < Error ; end
31
+ class ConflictingRequestError < RequestError ; end
32
+
33
+ # Raised when a request is attempted from within a session
34
+ # that has been detached.
35
+ class RequestAfterDetachedError < RequestError ; end
32
36
 
33
37
  # Executes the given block in the context of a session
34
38
  # attached to the given Event Machine connector. The
@@ -76,10 +80,11 @@ module ClientForPoslynx
76
80
  #
77
81
  # If another session attempts to supplant this request, but
78
82
  # the response to this request is subsequently received,
79
- # then the response is returned as normal, but this
80
- # session's status is changed to detached, and any
81
- # subsequent request attempts made in this session will
82
- # result in <tt>RequestError</tt> being raised.
83
+ # then the response is returned as normal, but the
84
+ # current session's status is also changed to detached, so
85
+ # any subsequent request attempts made in the session will
86
+ # result in <tt>RequestAfterDetachedError</tt> being
87
+ # raised.
83
88
  #
84
89
  # If another session is already waiting for a response,
85
90
  # then this will attempt to usurp or supplant the other
@@ -89,7 +94,8 @@ module ClientForPoslynx
89
94
  # exception.
90
95
  def request(data)
91
96
  if status == :detached
92
- raise RequestError, "Session cannot make requests because it is detached"
97
+ msg = "Session cannot make requests because it is detached"
98
+ raise RequestAfterDetachedError, msg
93
99
  end
94
100
  if connector.request_pending?
95
101
  pending_request_data = connector.latest_request.request_data
@@ -98,7 +104,8 @@ module ClientForPoslynx
98
104
  pending_callbacks.call :on_failure
99
105
  was_successful, resp_data_or_ex = Fiber.yield( [:_get_response] )
100
106
  elsif data.class == pending_request_data.class
101
- raise ConflictingRequestError, "Attempted a request while another request of the same type is in progress"
107
+ msg = "Attempted a request while another request of the same type is in progress"
108
+ raise ConflictingRequestError, msg
102
109
  else
103
110
  was_successful, resp_data_or_ex = Fiber.yield( [:_request, data, connector.latest_request] )
104
111
  end
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module ClientForPoslynx
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
@@ -247,7 +247,7 @@ module ClientForPoslynx
247
247
  end
248
248
 
249
249
  expect( prev_on_failure ).to have_received( :call )
250
- expect( exception ).to be_kind_of( Net::EM_Session::RequestError )
250
+ expect( exception ).to be_kind_of( Net::EM_Session::RequestAfterDetachedError )
251
251
  end
252
252
  end
253
253
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_for_poslynx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Jorgensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri