alma 0.2.3 → 0.2.4

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: 316ebba20b5a706207cddb4ee76d9d251818962e
4
- data.tar.gz: 12e04c4098d691b638db38bc1c3069bb429ae928
3
+ metadata.gz: a61f0bfe79181cdb4d99e0eca51ba16b1be6550f
4
+ data.tar.gz: 8f024c368175b3a8ac0fe2e6eb836f436516a566
5
5
  SHA512:
6
- metadata.gz: 412d40632aab83eb6f04aaaadef075bc459ce9857843ca0b9fcf5f41ce4943804b6c4045ce47b12e0283ed49132e0d658cfe04599a3367a71ab87565fdd208c1
7
- data.tar.gz: df34319fded3aab0bc210c3aab996837b501d32a20003fd1219b9a341880dfdff6f1bd048bb957e2b6ab6e19d303f2e6a68b3fba0283c20ac4c01f45e3bd770a
6
+ metadata.gz: 58b8bcfbe9b5c4f6ccd688df845bfb86e3fe8115199b06862c03b6faeaf31e08e4f9a33cca5209c082fa69f8416461dc9c45bef34a9c57179a48d4f29f7b2397
7
+ data.tar.gz: 60e8ea0221d2dce2001e53afd41d0f046cb822e56c74f2e07ecffcacc7fa9e94ce9c4730572f79cd0463d12c09506e64a4af9b52ed871cefa2be625a650e6cbb
data/README.md CHANGED
@@ -80,6 +80,8 @@ Now you can access those configuration attributes with `Alma.configuration.apike
80
80
 
81
81
  ```
82
82
 
83
+ Each fine object reflects the available fields in the returned XML,[as documented on the Ex Libris Api docs](https://developers.exlibrisgroup.com/alma/apis/xsd/rest_fees.xsd?tags=GET)
84
+
83
85
  #### Get details on a users loans
84
86
 
85
87
  ```ruby
@@ -101,6 +103,7 @@ loans.list.first.due_date
101
103
  "2016-12-26z
102
104
 
103
105
  ```
106
+ Each loan object reflects the available fields in the returned XML,[as documented on the Ex Libris Api docs](https://developers.exlibrisgroup.com/alma/apis/xsd/rest_item_loans.xsd?tags=GET)
104
107
 
105
108
  To renew an item you can can call the Loan objects renew method
106
109
 
@@ -137,7 +140,8 @@ requests.list.first.request_status
137
140
  > "In Process"
138
141
 
139
142
  ```
140
-
143
+ Each request object reflects the available fields in the returned XML,[as documented on the Ex Libris Api docs](https://developers.exlibrisgroup.com/alma/apis/xsd/rest_user_requests.xsd?tags=GET)
144
+
141
145
  Loans, fines and Requests can also be accessed statically
142
146
 
143
147
  ```ruby
@@ -32,7 +32,7 @@ module Alma
32
32
 
33
33
  def message
34
34
  if @success
35
- "#{item_title} is now due #{new_due_date}"
35
+ "#{item_title} is now due #{due_date}"
36
36
  else
37
37
  "#{item_title} could not be renewed."
38
38
  end
@@ -2,9 +2,10 @@ module Alma
2
2
  class ResultSet
3
3
  extend Forwardable
4
4
 
5
+ include Enumerable
5
6
  include Alma::Error
6
7
 
7
- def_delegators :list, :size, :each, :map
8
+ def_delegators :list, :each, :size
8
9
 
9
10
  def initialize(ws_response)
10
11
  @response = ws_response
@@ -46,4 +47,4 @@ module Alma
46
47
  end
47
48
  end
48
49
  end
49
- end
50
+ end
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  module Alma
4
2
  class User < AlmaRecord
5
3
  extend Alma::Api
@@ -25,10 +23,20 @@ module Alma
25
23
 
26
24
  def renew_loan(loan_id)
27
25
  response = self.class.renew_loan({user_id: self.id, loan_id: loan_id})
28
- @recheck_loans = true if response.renewed?
26
+ if response.renewed?
27
+ @recheck_loans ||= true
28
+ end
29
29
  response
30
30
  end
31
31
 
32
+ def renew_multiple_loans(loan_ids)
33
+ loan_ids.map { |id| renew_loan(id) }
34
+ end
35
+
36
+ def renew_all_loans
37
+ renew_multiple_loans(loans.map(&:loan_id))
38
+ end
39
+
32
40
  def recheck_loans?
33
41
  @recheck_loans
34
42
  end
@@ -105,6 +113,25 @@ module Alma
105
113
  RenewalResponse.new(response)
106
114
  end
107
115
 
116
+ # Attempts to renew a multiple items for a user
117
+ # @param [Hash] args
118
+ # @option args [String] :user_id The unique id of the user
119
+ # @option args [Array<String>] :loan_ids Array of loan ids
120
+ # @option args [String] :user_id_type Type of identifier being used to search. OPTIONAL
121
+ # @return [Array<RenewalResponse>] Object indicating the renewal message
122
+ def renew_multiple_loans(args)
123
+
124
+ if args.fetch(:loans_ids, nil).respond_to? :map
125
+ args.delete(:loan_ids).map do |loan_id|
126
+ renew_loan(args.merge(loan_id: loan_id))
127
+ end
128
+ else
129
+ []
130
+ end
131
+ end
132
+
133
+
134
+
108
135
 
109
136
  def set_wadl_filename
110
137
  'user.wadl'
@@ -1,3 +1,3 @@
1
1
  module Alma
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
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.3
4
+ version: 0.2.4
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-02-07 00:00:00.000000000 Z
11
+ date: 2017-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ezwadl