alma 0.2.6 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/alma/fine_set.rb +7 -3
- data/lib/alma/loan.rb +10 -1
- data/lib/alma/loan_set.rb +8 -3
- data/lib/alma/renewal_response.rb +5 -1
- data/lib/alma/request_options.rb +4 -0
- data/lib/alma/request_set.rb +7 -3
- data/lib/alma/user.rb +16 -7
- data/lib/alma/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e3079955feac35f5665cae0f49298159c6739f8e
|
4
|
+
data.tar.gz: ada299082a4b7c0a15e8126b3417e4d8264d66f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 267aa00bed5ba01ab29862986d549fc637ebe3ea26fefd7236728fe49c4a90c2f607608c8c44f52cbfcb8e4098403ee4d18f1094d51421ae289e81e41af46fb8
|
7
|
+
data.tar.gz: 9babb4fda07c15927e659af938c3038f261082f70db8a7d102004dd323620f33565d3b5d5d19b9497987608d7acbd8651cefcac3ed6786da47952b02c7a531ce
|
data/lib/alma/fine_set.rb
CHANGED
@@ -5,7 +5,6 @@ module Alma
|
|
5
5
|
#include Alma::Error
|
6
6
|
|
7
7
|
attr_reader :response
|
8
|
-
def_delegators :list, :each, :size
|
9
8
|
def_delegators :response, :[], :fetch
|
10
9
|
|
11
10
|
def initialize(response_body_hash)
|
@@ -16,8 +15,13 @@ module Alma
|
|
16
15
|
'fee'
|
17
16
|
end
|
18
17
|
|
19
|
-
def
|
20
|
-
fetch(key, [])
|
18
|
+
def each
|
19
|
+
@response.fetch(key, []).map{|item| Alma::AlmaRecord.new(item)}
|
20
|
+
end
|
21
|
+
alias list each
|
22
|
+
|
23
|
+
def size
|
24
|
+
each.count
|
21
25
|
end
|
22
26
|
|
23
27
|
def sum
|
data/lib/alma/loan.rb
CHANGED
data/lib/alma/loan_set.rb
CHANGED
@@ -5,16 +5,21 @@ module Alma
|
|
5
5
|
#include Alma::Error
|
6
6
|
|
7
7
|
attr_reader :response
|
8
|
-
def_delegators :list, :each, :size
|
9
8
|
def_delegators :response, :[], :fetch
|
10
9
|
|
11
10
|
def initialize(response_body_hash)
|
12
11
|
@response = response_body_hash
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
16
|
-
fetch(key, [])
|
14
|
+
def each
|
15
|
+
@response.fetch(key, []).map{|item| Alma::Loan.new(item)}
|
17
16
|
end
|
17
|
+
alias list each
|
18
|
+
|
19
|
+
def size
|
20
|
+
each.count
|
21
|
+
end
|
22
|
+
|
18
23
|
|
19
24
|
def key
|
20
25
|
'item_loan'
|
data/lib/alma/request_options.rb
CHANGED
@@ -23,6 +23,10 @@ module Alma
|
|
23
23
|
!request_options.select {|option| option["type"]["value"] == "HOLD" }.empty?
|
24
24
|
end
|
25
25
|
|
26
|
+
def digitization_allowed?
|
27
|
+
!request_options.select {|option| option["type"]["value"] == "DIGITIZATION" }.empty?
|
28
|
+
end
|
29
|
+
|
26
30
|
private
|
27
31
|
|
28
32
|
def self.region
|
data/lib/alma/request_set.rb
CHANGED
@@ -5,15 +5,19 @@ module Alma
|
|
5
5
|
#include Alma::Error
|
6
6
|
|
7
7
|
attr_reader :response
|
8
|
-
def_delegators :list, :each, :size
|
9
8
|
def_delegators :response, :[], :fetch
|
10
9
|
|
11
10
|
def initialize(response_body_hash)
|
12
11
|
@response = response_body_hash
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
16
|
-
fetch(key, [])
|
14
|
+
def each
|
15
|
+
@response.fetch(key, []).map{|item| Alma::AlmaRecord.new(item)}
|
16
|
+
end
|
17
|
+
alias list each
|
18
|
+
|
19
|
+
def size
|
20
|
+
each.count
|
17
21
|
end
|
18
22
|
|
19
23
|
def total_record_count
|
data/lib/alma/user.rb
CHANGED
@@ -86,11 +86,10 @@ module Alma
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def renew_loan(loan_id)
|
89
|
-
response = send_loan_renewal_request({user_id: id, loan_id: loan_id})
|
89
|
+
response = self.class.send_loan_renewal_request({user_id: id, loan_id: loan_id})
|
90
90
|
if response.renewed?
|
91
91
|
@recheck_loans ||= true
|
92
92
|
end
|
93
|
-
get_body_from response
|
94
93
|
end
|
95
94
|
|
96
95
|
|
@@ -136,14 +135,24 @@ module Alma
|
|
136
135
|
# @option args [String] :loan_id The unique id of the loan
|
137
136
|
# @option args [String] :user_id_type Type of identifier being used to search. OPTIONAL
|
138
137
|
# @return [RenewalResponse] Object indicating the renewal message
|
139
|
-
def send_loan_renewal_request(args)
|
140
|
-
user_id = args.delete(:user_id) { raise ArgumentError }
|
138
|
+
def self.send_loan_renewal_request(args)
|
141
139
|
loan_id = args.delete(:loan_id) { raise ArgumentError }
|
140
|
+
user_id = args.delete(:user_id) { raise ArgumentError }
|
142
141
|
params = {op: 'renew'}
|
143
|
-
response = HTTParty.post("#{users_base_path}/#{
|
144
|
-
RenewalResponse.new(
|
142
|
+
response = HTTParty.post("#{users_base_path}/#{user_id}/loans/#{loan_id}", query: params, headers: headers)
|
143
|
+
RenewalResponse.new(JSON.parse(response.body))
|
145
144
|
end
|
146
145
|
|
146
|
+
# Attempts to renew multiple items for a user
|
147
|
+
# @param [Hash] args
|
148
|
+
# @option args [String] :user_id The unique id of the user
|
149
|
+
# @option args [Array<String>] :loan_ids The unique ids of the loans
|
150
|
+
# @option args [String] :user_id_type Type of identifier being used to search. OPTIONAL
|
151
|
+
# @return [Array<RenewalResponse>] Array of Objects indicating the renewal messages
|
152
|
+
def self.send_multiple_loan_renewal_requests(args)
|
153
|
+
loan_ids = args.delete(:loan_ids) { raise ArgumentError }
|
154
|
+
loan_ids.map { |id| Alma::User.send_loan_renewal_request(args.merge(loan_id: id))}
|
155
|
+
end
|
147
156
|
|
148
157
|
def get_body_from(response)
|
149
158
|
JSON.parse(response.body)
|
@@ -174,5 +183,5 @@ module Alma
|
|
174
183
|
Alma.configuration.apikey
|
175
184
|
end
|
176
185
|
|
177
|
-
end
|
178
186
|
end
|
187
|
+
end
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ezwadl
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
187
|
+
rubygems_version: 2.6.11
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: Client for Ex Libris Alma Web Services
|