sip2 0.0.8 → 0.0.9
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 +4 -4
- data/.rubocop.yml +3 -0
- data/lib/sip2/patron_information.rb +107 -13
- data/lib/sip2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66c5b3c4ac6909954ad5e3c0b11577cb97d17e91
|
4
|
+
data.tar.gz: 47985f7e545caec1d2d71e7fdeda15dbf099af7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c59b28ec3bfb1c1e4604e0dc8e5196c91b994c0015c11a5badfc54e6cce2a4f45a4e4bbcae42fea24e0ee28a73f609353c609eaeb53a7109ed54d91f7b567c0c
|
7
|
+
data.tar.gz: 6cab90f0952d40cc71664db95b746014ad4f996049523789be36d663539f44ddcae6f36420f496befc0c8f297bebbdccc483b1f6b98b9b4936fd025458282de2
|
data/.rubocop.yml
CHANGED
@@ -9,13 +9,64 @@ module Sip2
|
|
9
9
|
@raw_response = patron_response
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
14
|
-
status.strip if status
|
12
|
+
def charge_privileges_denied?
|
13
|
+
parse_patron_status 0
|
15
14
|
end
|
16
15
|
|
17
|
-
def
|
18
|
-
|
16
|
+
def renewal_privileges_denied?
|
17
|
+
parse_patron_status 1
|
18
|
+
end
|
19
|
+
|
20
|
+
def recall_privileges_denied?
|
21
|
+
parse_patron_status 2
|
22
|
+
end
|
23
|
+
|
24
|
+
def hold_privileges_denied?
|
25
|
+
parse_patron_status 3
|
26
|
+
end
|
27
|
+
|
28
|
+
def card_reported_lost?
|
29
|
+
parse_patron_status 4
|
30
|
+
end
|
31
|
+
|
32
|
+
def too_many_items_charged?
|
33
|
+
parse_patron_status 5
|
34
|
+
end
|
35
|
+
|
36
|
+
def too_many_items_overdue?
|
37
|
+
parse_patron_status 6
|
38
|
+
end
|
39
|
+
|
40
|
+
def too_many_renewals?
|
41
|
+
parse_patron_status 7
|
42
|
+
end
|
43
|
+
|
44
|
+
def too_many_claims_of_items_returned?
|
45
|
+
parse_patron_status 8
|
46
|
+
end
|
47
|
+
|
48
|
+
def too_many_items_lost?
|
49
|
+
parse_patron_status 9
|
50
|
+
end
|
51
|
+
|
52
|
+
def excessive_outstanding_fines?
|
53
|
+
parse_patron_status 10
|
54
|
+
end
|
55
|
+
|
56
|
+
def excessive_outstanding_fees?
|
57
|
+
parse_patron_status 11
|
58
|
+
end
|
59
|
+
|
60
|
+
def recall_overdue?
|
61
|
+
parse_patron_status 12
|
62
|
+
end
|
63
|
+
|
64
|
+
def too_many_items_billed?
|
65
|
+
parse_patron_status 13
|
66
|
+
end
|
67
|
+
|
68
|
+
def language
|
69
|
+
LANGUAGE_LOOKUP_TABLE[parse_fixed_response(14, 3)]
|
19
70
|
end
|
20
71
|
|
21
72
|
def transaction_date
|
@@ -30,19 +81,23 @@ module Sip2
|
|
30
81
|
end
|
31
82
|
|
32
83
|
def patron_valid?
|
33
|
-
parse_boolean
|
84
|
+
parse_boolean 'BL'
|
34
85
|
end
|
35
86
|
|
36
87
|
def authenticated?
|
37
|
-
parse_boolean
|
88
|
+
parse_boolean 'CQ'
|
38
89
|
end
|
39
90
|
|
40
91
|
def email
|
41
|
-
parse_text
|
92
|
+
parse_text 'BE'
|
42
93
|
end
|
43
94
|
|
44
95
|
def location
|
45
|
-
parse_text
|
96
|
+
parse_text 'AQ'
|
97
|
+
end
|
98
|
+
|
99
|
+
def screen_message
|
100
|
+
parse_text 'AF'
|
46
101
|
end
|
47
102
|
|
48
103
|
def inspect
|
@@ -59,12 +114,20 @@ module Sip2
|
|
59
114
|
|
60
115
|
private
|
61
116
|
|
62
|
-
def parse_boolean(
|
63
|
-
|
117
|
+
def parse_boolean(message_id)
|
118
|
+
raw_response[/\|#{message_id}([YN])\|/, 1] == 'Y'
|
119
|
+
end
|
120
|
+
|
121
|
+
def parse_text(message_id)
|
122
|
+
raw_response[/\|#{message_id}(.*?)\|/, 1]
|
64
123
|
end
|
65
124
|
|
66
|
-
def
|
67
|
-
|
125
|
+
def parse_patron_status(position)
|
126
|
+
parse_fixed_response(position) == 'Y'
|
127
|
+
end
|
128
|
+
|
129
|
+
def parse_fixed_response(position, count = 1)
|
130
|
+
raw_response[/\A64.{#{position}}(.{#{count}})/, 1]
|
68
131
|
end
|
69
132
|
|
70
133
|
def offset_from_zone(zone)
|
@@ -101,5 +164,36 @@ module Sip2
|
|
101
164
|
'+12:00' => %w[M NZST],
|
102
165
|
'+13:00' => %w[NZDT]
|
103
166
|
}.freeze
|
167
|
+
|
168
|
+
LANGUAGE_LOOKUP_TABLE = {
|
169
|
+
'000' => 'Unknown',
|
170
|
+
'001' => 'English',
|
171
|
+
'002' => 'French',
|
172
|
+
'003' => 'German',
|
173
|
+
'004' => 'Italian',
|
174
|
+
'005' => 'Dutch',
|
175
|
+
'006' => 'Swedish',
|
176
|
+
'007' => 'Finnish',
|
177
|
+
'008' => 'Spanish',
|
178
|
+
'009' => 'Danish',
|
179
|
+
'010' => 'Portuguese',
|
180
|
+
'011' => 'Canadian-French',
|
181
|
+
'012' => 'Norwegian',
|
182
|
+
'013' => 'Hebrew',
|
183
|
+
'014' => 'Japanese',
|
184
|
+
'015' => 'Russian',
|
185
|
+
'016' => 'Arabic',
|
186
|
+
'017' => 'Polish',
|
187
|
+
'018' => 'Greek',
|
188
|
+
'019' => 'Chinese',
|
189
|
+
'020' => 'Korean',
|
190
|
+
'021' => 'North American Spanish',
|
191
|
+
'022' => 'Tamil',
|
192
|
+
'023' => 'Malay',
|
193
|
+
'024' => 'United Kingdom',
|
194
|
+
'025' => 'Icelandic',
|
195
|
+
'026' => 'Belgian',
|
196
|
+
'027' => 'Taiwanese'
|
197
|
+
}.freeze
|
104
198
|
end
|
105
199
|
end
|
data/lib/sip2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sip2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- abrom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|