alma 0.2.0 → 0.2.1
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/README.md +2 -2
- data/lib/alma/loan.rb +1 -1
- data/lib/alma/renewal_response.rb +15 -11
- data/lib/alma/user.rb +5 -12
- data/lib/alma/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: f6514577bde1155ebeaac6f1c1b0b6e18c615b32
|
4
|
+
data.tar.gz: 8fbceca83bc75f49fc1aa5890c84ce1c9b8944ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30f11ef82444e7cbf6a581cd7ad8adbad12d795f67396331663cac62c2da58e873b043e8e5078c6163103fbc3b2363a139ddaf8dad0513b45ddf34caa01c01f0
|
7
|
+
data.tar.gz: c450a1b9be6e4c603b836d4b879fba1c90eee5d815fb2d98b8a8230038efbd10bdb7f5fb016f0694763d5c55753365f32b3b510ad482aac6966a69aee3d0a7d6
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ A client for Web Services provided by the Ex Libris's Alma Library System.
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem 'alma'
|
10
|
+
gem 'alma'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -16,7 +16,7 @@ And then execute:
|
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
19
|
-
$ gem install
|
19
|
+
$ gem install alma
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
data/lib/alma/loan.rb
CHANGED
@@ -1,30 +1,34 @@
|
|
1
1
|
module Alma
|
2
2
|
class RenewalResponse
|
3
3
|
|
4
|
-
def initialize(response
|
5
|
-
@
|
6
|
-
@
|
7
|
-
@
|
8
|
-
@renewed = @error.nil?
|
4
|
+
def initialize(response)
|
5
|
+
@success = response.fetch('item_loan', {})
|
6
|
+
@error = response.fetch('web_service_result', {})
|
7
|
+
@renewed = @error.empty?
|
9
8
|
end
|
10
9
|
|
11
10
|
def renewed?
|
12
11
|
@renewed
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
16
|
-
|
14
|
+
def due_date
|
15
|
+
@success.fetch('due_date', '')
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def due_date_pretty
|
20
|
+
Time.parse(due_date).strftime('%m-%e-%y %H:%M')
|
17
21
|
end
|
18
22
|
|
19
23
|
def error_message
|
20
|
-
@error['errorList']['error']['errorMessage']
|
24
|
+
(renewed?) ? '' : @error['errorList']['error']['errorMessage']
|
21
25
|
end
|
22
26
|
|
23
27
|
def item_title
|
24
|
-
if @
|
25
|
-
@
|
28
|
+
if @success
|
29
|
+
@success['title']
|
26
30
|
else
|
27
|
-
|
31
|
+
'This Item'
|
28
32
|
end
|
29
33
|
end
|
30
34
|
|
data/lib/alma/user.rb
CHANGED
@@ -23,8 +23,8 @@ module Alma
|
|
23
23
|
@loans
|
24
24
|
end
|
25
25
|
|
26
|
-
def renew_loan(
|
27
|
-
response = self.class.renew_loan({user_id: self.id,
|
26
|
+
def renew_loan(loan_id)
|
27
|
+
response = self.class.renew_loan({user_id: self.id, loan_id: loan_id})
|
28
28
|
@recheck_loans = true if response.renewed?
|
29
29
|
response
|
30
30
|
end
|
@@ -95,21 +95,14 @@ module Alma
|
|
95
95
|
# Attempts to renew a single item for a user
|
96
96
|
# @param [Hash] args
|
97
97
|
# @option args [String] :user_id The unique id of the user
|
98
|
-
# @option args [String] :loan_id The unique id of the loan
|
99
|
-
# @option args [String] :
|
100
|
-
# @option args [String] :user_id_type Type of identifier being used to search
|
98
|
+
# @option args [String] :loan_id The unique id of the loan
|
99
|
+
# @option args [String] :user_id_type Type of identifier being used to search. OPTIONAL
|
101
100
|
# @return [RenewalResponse] Object indicating the renewal message
|
102
101
|
def renew_loan(args)
|
103
102
|
args.merge!({op: 'renew'})
|
104
|
-
|
105
|
-
# If a loan object is passed in args, us its id as loan_id
|
106
|
-
loan = args.delete(:loan)
|
107
|
-
if loan
|
108
|
-
args[:loan_id] = loan.loan_id
|
109
|
-
end
|
110
103
|
params = query_merge args
|
111
104
|
response = resources.almaws_v1_users.user_id_loans_loan_id.post(params)
|
112
|
-
RenewalResponse.new(response
|
105
|
+
RenewalResponse.new(response)
|
113
106
|
end
|
114
107
|
|
115
108
|
|
data/lib/alma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ezwadl
|