alma 0.2.6 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +54 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.github/dependabot.yml +7 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +134 -0
- data/.ruby-version +1 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +4 -3
- data/Guardfile +75 -0
- data/README.md +136 -26
- data/Rakefile +3 -1
- data/alma.gemspec +21 -16
- data/lib/alma/alma_record.rb +3 -3
- data/lib/alma/api_defaults.rb +39 -0
- data/lib/alma/availability_response.rb +50 -53
- data/lib/alma/bib.rb +26 -42
- data/lib/alma/bib_holding.rb +25 -0
- data/lib/alma/bib_item.rb +28 -38
- data/lib/alma/bib_item_set.rb +72 -12
- data/lib/alma/bib_set.rb +7 -21
- data/lib/alma/config.rb +10 -4
- data/lib/alma/course.rb +47 -0
- data/lib/alma/course_set.rb +17 -0
- data/lib/alma/electronic/README.md +20 -0
- data/lib/alma/electronic/batch_utils.rb +224 -0
- data/lib/alma/electronic/business.rb +29 -0
- data/lib/alma/electronic.rb +167 -0
- data/lib/alma/error.rb +16 -4
- data/lib/alma/fine.rb +16 -0
- data/lib/alma/fine_set.rb +36 -21
- data/lib/alma/item_request_options.rb +23 -0
- data/lib/alma/library.rb +29 -0
- data/lib/alma/library_set.rb +21 -0
- data/lib/alma/loan.rb +31 -2
- data/lib/alma/loan_set.rb +62 -15
- data/lib/alma/location.rb +29 -0
- data/lib/alma/location_set.rb +21 -0
- data/lib/alma/renewal_response.rb +19 -11
- data/lib/alma/request.rb +167 -0
- data/lib/alma/request_options.rb +36 -17
- data/lib/alma/request_set.rb +64 -15
- data/lib/alma/response.rb +45 -0
- data/lib/alma/result_set.rb +27 -35
- data/lib/alma/user.rb +111 -92
- data/lib/alma/user_request.rb +19 -0
- data/lib/alma/user_set.rb +5 -6
- data/lib/alma/version.rb +3 -1
- data/lib/alma.rb +34 -22
- data/log/.gitignore +4 -0
- metadata +118 -10
- data/.travis.yml +0 -5
- data/lib/alma/api.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 210d45982a6c339d9b8c170a73077be4f56bcf4eaa989debe95d2f9d97897c0e
|
4
|
+
data.tar.gz: 1b988140c47bc0974e617cc1131aee0b82dfbcd50ce20d408fbd2a969cf180c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1667314072be96beb05c3f389c5240142ff5e0f44be0eed44d2240653ad4dd38f07a221b2ab3235921e37e7620e4518128e1b8806880daadffc9f570bbccd773
|
7
|
+
data.tar.gz: b98783202cf24c6a33c0c249f70d9f55a715b611c89a3249d4cf14a1352f2dca476123315649f9d3f624b1533fa0547d285605af309cfab8c537a1b6d81db85b
|
@@ -0,0 +1,54 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@1.2
|
4
|
+
|
5
|
+
workflows:
|
6
|
+
version: 2
|
7
|
+
test-deploy:
|
8
|
+
jobs:
|
9
|
+
- build
|
10
|
+
- deploy:
|
11
|
+
filters:
|
12
|
+
tags:
|
13
|
+
only: /.*/
|
14
|
+
branches:
|
15
|
+
ignore: /.*/
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
build:
|
19
|
+
docker:
|
20
|
+
- image: cimg/ruby:2.7.2-browsers
|
21
|
+
auth:
|
22
|
+
username: $DOCKERHUB_USER
|
23
|
+
password: $DOCKERHUB_PASSWORD
|
24
|
+
|
25
|
+
executor: ruby/default
|
26
|
+
steps:
|
27
|
+
- checkout
|
28
|
+
- run:
|
29
|
+
name: Which bundler?
|
30
|
+
command: bundle -v
|
31
|
+
- run: bundle install
|
32
|
+
- run:
|
33
|
+
name: lint
|
34
|
+
command: bundle exec rubocop
|
35
|
+
- run:
|
36
|
+
name: test
|
37
|
+
command: bundle exec rake
|
38
|
+
deploy:
|
39
|
+
docker:
|
40
|
+
- image: cimg/ruby:2.7.2-browsers
|
41
|
+
|
42
|
+
working_directory: ~/repo
|
43
|
+
|
44
|
+
steps:
|
45
|
+
- checkout
|
46
|
+
- run:
|
47
|
+
name: Setup Rubygems
|
48
|
+
command: bash .circleci/setup-rubygems.sh
|
49
|
+
|
50
|
+
- run:
|
51
|
+
name: Publish to Rubygems
|
52
|
+
command: |
|
53
|
+
gem build alma.gemspec
|
54
|
+
gem push "$(ls alma-*.gem)"
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rails
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
7
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
8
|
+
DisabledByDefault: true
|
9
|
+
Exclude:
|
10
|
+
- 'node_modules/**/*'
|
11
|
+
- '**/templates/**/*'
|
12
|
+
- '**/vendor/**/*'
|
13
|
+
- 'actionpack/lib/action_dispatch/journey/parser.rb'
|
14
|
+
- 'bin/*'
|
15
|
+
- 'solr/**/*'
|
16
|
+
|
17
|
+
# Prefer &&/|| over and/or.
|
18
|
+
Style/AndOr:
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
# Align `when` with `case`.
|
22
|
+
Layout/CaseIndentation:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
# Align comments with method definitions.
|
26
|
+
Layout/CommentIndentation:
|
27
|
+
Enabled: true
|
28
|
+
|
29
|
+
Layout/EmptyLineAfterMagicComment:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# In a regular class definition, no empty lines around the body.
|
33
|
+
Layout/EmptyLinesAroundClassBody:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
# In a regular method definition, no empty lines around the body.
|
37
|
+
Layout/EmptyLinesAroundMethodBody:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
# In a regular module definition, no empty lines around the body.
|
41
|
+
Layout/EmptyLinesAroundModuleBody:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
Layout/FirstArgumentIndentation:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
48
|
+
Style/HashSyntax:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
52
|
+
# extra level of indentation.
|
53
|
+
Layout/IndentationConsistency:
|
54
|
+
Enabled: true
|
55
|
+
EnforcedStyle: indented_internal_methods
|
56
|
+
|
57
|
+
# Two spaces, no tabs (for indentation).
|
58
|
+
Layout/IndentationWidth:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Layout/SpaceAfterColon:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
Layout/SpaceAfterComma:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Layout/SpaceAroundKeyword:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Layout/SpaceAroundOperators:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Layout/SpaceBeforeFirstArg:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
# Defining a method with parameters needs parentheses.
|
80
|
+
Style/MethodDefParentheses:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
Style/FrozenStringLiteralComment:
|
84
|
+
Enabled: true
|
85
|
+
EnforcedStyle: always
|
86
|
+
Exclude:
|
87
|
+
- 'app/models/traject_indexer.rb'
|
88
|
+
- 'db/schema.rb'
|
89
|
+
|
90
|
+
# Use `foo {}` not `foo{}`.
|
91
|
+
Layout/SpaceBeforeBlockBraces:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
# Use `foo { bar }` not `foo {bar}`.
|
95
|
+
Layout/SpaceInsideBlockBraces:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
99
|
+
Layout/SpaceInsideHashLiteralBraces:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Layout/SpaceInsideParens:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
# Check quotes usage according to lint rule below.
|
106
|
+
Style/StringLiterals:
|
107
|
+
Enabled: true
|
108
|
+
EnforcedStyle: double_quotes
|
109
|
+
|
110
|
+
# Detect hard tabs, no hard tabs.
|
111
|
+
Layout/IndentationStyle:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
# Blank lines should not have any spaces.
|
115
|
+
Layout/TrailingEmptyLines:
|
116
|
+
Enabled: true
|
117
|
+
|
118
|
+
# No trailing whitespace.
|
119
|
+
Layout/TrailingWhitespace:
|
120
|
+
Enabled: true
|
121
|
+
|
122
|
+
# Use quotes for string literals when they are enough.
|
123
|
+
Style/RedundantPercentQ:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
# Align `end` with the matching keyword or starting expression except for
|
127
|
+
# assignments, where it should be aligned with the LHS.
|
128
|
+
Layout/EndAlignment:
|
129
|
+
Enabled: true
|
130
|
+
EnforcedStyleAlignWith: variable
|
131
|
+
|
132
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
133
|
+
Lint/RequireParentheses:
|
134
|
+
Enabled: true
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.7.2
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at svc.libdev@temple.edu. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
7
|
+
# directories %w(app lib config test spec features) \
|
8
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
9
|
+
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
13
|
+
#
|
14
|
+
# $ mkdir config
|
15
|
+
# $ mv Guardfile config/
|
16
|
+
# $ ln -s config/Guardfile .
|
17
|
+
#
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
|
+
|
20
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
21
|
+
# rspec may be run, below are examples of the most common uses.
|
22
|
+
# * bundler: 'bundle exec rspec'
|
23
|
+
# * bundler binstubs: 'bin/rspec'
|
24
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
25
|
+
# installed the spring binstubs per the docs)
|
26
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
27
|
+
# * 'just' rspec: 'rspec'
|
28
|
+
|
29
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
30
|
+
require "guard/rspec/dsl"
|
31
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
32
|
+
|
33
|
+
# Feel free to open issues for suggestions and improvements
|
34
|
+
|
35
|
+
# RSpec files
|
36
|
+
rspec = dsl.rspec
|
37
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
38
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
39
|
+
watch(rspec.spec_files)
|
40
|
+
|
41
|
+
# Ruby files
|
42
|
+
ruby = dsl.ruby
|
43
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
44
|
+
|
45
|
+
# Rails files
|
46
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
47
|
+
dsl.watch_spec_files_for(rails.app_files)
|
48
|
+
dsl.watch_spec_files_for(rails.views)
|
49
|
+
|
50
|
+
watch(rails.controllers) do |m|
|
51
|
+
[
|
52
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
53
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
54
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Rails config changes
|
59
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
60
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
61
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
62
|
+
|
63
|
+
# Capybara features specs
|
64
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
65
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
66
|
+
|
67
|
+
# Turnip features and steps
|
68
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
69
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
70
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
71
|
+
end
|
72
|
+
|
73
|
+
# Specific files when defaults don't work (for some reason):
|
74
|
+
watch("lib/alma.rb") { "spec/alma_spec.rb" }
|
75
|
+
end
|
data/README.md
CHANGED
@@ -26,75 +26,81 @@ You'll need to configure the Alma gem to ensure you query the appropriate data.
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
Alma.configure do |config|
|
29
|
-
# You have to set
|
29
|
+
# You have to set the apikey
|
30
30
|
config.apikey = 'EXAMPLE_EL_DEV_NETWORK_APPLICATION_KEY'
|
31
|
-
# Alma gem defaults to querying Ex Libris's North American
|
32
|
-
config.region = "https://api-eu.hosted.exlibrisgroup.com
|
31
|
+
# Alma gem defaults to querying Ex Libris's North American API servers. You can override that here.
|
32
|
+
config.region = "https://api-eu.hosted.exlibrisgroup.com"
|
33
|
+
|
34
|
+
# By default enable_loggable is set to false
|
35
|
+
config.enable_loggable = false
|
36
|
+
|
37
|
+
# By default timeout is set to 5 seconds; can only provide integers
|
38
|
+
config.timeout = 10
|
33
39
|
end
|
34
40
|
```
|
35
41
|
|
36
42
|
Now you can access those configuration attributes with `Alma.configuration.apikey`
|
37
43
|
|
38
44
|
### Making Requests
|
39
|
-
|
45
|
+
|
40
46
|
#### Get a Single user
|
41
47
|
```ruby
|
42
48
|
user = Alma::User.find(123456789)
|
43
|
-
|
49
|
+
|
44
50
|
user.first_name
|
45
51
|
> Chad
|
46
|
-
|
52
|
+
|
47
53
|
user.email
|
48
54
|
> chad.nelson@fictional.edu
|
49
|
-
|
55
|
+
|
50
56
|
user.keys
|
51
57
|
>{first_name: "Chad",
|
52
58
|
...}
|
53
59
|
```
|
54
|
-
|
60
|
+
|
55
61
|
#### Get details on a users fines
|
56
|
-
|
62
|
+
|
57
63
|
```ruby
|
58
64
|
fines = user.fines
|
59
65
|
fines.sum
|
60
66
|
> "20.0"
|
61
|
-
|
67
|
+
|
62
68
|
fines.total_record_count
|
63
69
|
> "2"
|
64
|
-
|
70
|
+
|
65
71
|
fines
|
66
72
|
> [#<Alma::AlmaRecord:0x000000038b7b50
|
67
73
|
...>,
|
68
74
|
#<Alma::AlmaRecord:0x000000038b7b28
|
69
75
|
...>]
|
70
|
-
|
76
|
+
|
71
77
|
fines.first.title
|
72
78
|
> "Practical Object Oriented Design with Ruby"
|
73
|
-
|
79
|
+
|
74
80
|
```
|
75
81
|
|
76
82
|
Each fine object reflects the available fields in the returned JSON,[as documented on the Ex Libris Api docs](https://developers.exlibrisgroup.com/alma/apis/xsd/rest_fees.xsd?tags=GET)
|
77
83
|
|
78
84
|
#### Get details on a users loans
|
79
|
-
|
85
|
+
|
80
86
|
```ruby
|
81
87
|
loans = user.loans
|
82
88
|
|
83
89
|
loans.total_record_count
|
84
90
|
> "2"
|
85
|
-
|
91
|
+
|
86
92
|
loans
|
87
93
|
> [#<Alma::Loan:0x000000038c6b79
|
88
94
|
...>,
|
89
95
|
#<Alma::Loan:0x000000038c6b34
|
90
96
|
...>]
|
91
|
-
|
97
|
+
|
92
98
|
loans.first.title
|
93
99
|
> "Javascript: The Good Parts"
|
94
|
-
|
100
|
+
|
95
101
|
loans.first.due_date
|
96
|
-
"2016-12-26z
|
97
|
-
|
102
|
+
"2016-12-26z"
|
103
|
+
|
98
104
|
```
|
99
105
|
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)
|
100
106
|
|
@@ -105,10 +111,10 @@ requests = user.requests
|
|
105
111
|
|
106
112
|
requests.total_record_count
|
107
113
|
> "1"
|
108
|
-
|
114
|
+
|
109
115
|
requests.list
|
110
116
|
> [#<Alma::AlmaRecord:0x000000038c6b79...>]
|
111
|
-
|
117
|
+
|
112
118
|
requests.list.first.title
|
113
119
|
> "Food in history / Reay Tannahill."
|
114
120
|
|
@@ -117,26 +123,131 @@ requests.list.first.pickup_location
|
|
117
123
|
|
118
124
|
requests.list.first.request_status
|
119
125
|
> "In Process"
|
120
|
-
|
126
|
+
|
121
127
|
```
|
122
128
|
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)
|
123
129
|
|
124
130
|
Loans, fines and Requests can also be accessed statically
|
125
|
-
|
131
|
+
|
126
132
|
```ruby
|
127
133
|
Alma::User.get_fines({:user_id => 123456789})
|
128
|
-
|
134
|
+
|
129
135
|
Alma::User.get_loans({:user_id => 123456789})
|
130
136
|
|
131
137
|
Alma::User.get_requests({:user_id => 123456789})
|
132
|
-
|
138
|
+
|
139
|
+
```
|
140
|
+
|
141
|
+
### Bib Records
|
142
|
+
Wrappings for some of the API endpoints described by the [Bibliographic Records and Inventory
|
143
|
+
](https://developers.exlibrisgroup.com/alma/apis/bibs) section of the Ex Libris Developers Network
|
144
|
+
|
145
|
+
### All the items for a Bib Records
|
146
|
+
Corresponds to the [Retrieve Items list](https://developers.exlibrisgroup.com/alma/apis/bibs/GET/gwPcGly021om4RTvtjbPleCklCGxeYAfEqJOcQOaLEvNcHQT0/ozqu3DGTurs/XxIP4LrexQUdc=/af2fb69d-64f4-42bc-bb05-d8a0ae56936e) api endpoint
|
147
|
+
|
148
|
+
To get the list of items for all holdings of a bib record.
|
149
|
+
`items = Alma::BibItem.find("EXAMPLE_MMS_ID")`
|
150
|
+
|
151
|
+
You can also pass a holding ID as an option, if you only want that holdings items.
|
152
|
+
`items = Alma::BibItem.find("EXAMPLE_MMS_ID", holding_id: EXAMPLE_HOLDING_ID)`
|
153
|
+
|
154
|
+
|
155
|
+
The response is a BibItemSet which can be iterated over to access items:
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
items.each { ... }
|
159
|
+
|
160
|
+
items.total_record_count
|
161
|
+
> 4
|
133
162
|
```
|
163
|
+
|
164
|
+
You can remove items that are missing or lost from the result set
|
165
|
+
` avail_items = items.filter_missing_and_lost
|
166
|
+
`
|
167
|
+
|
168
|
+
Items can be grouped by the library they are held at, which returns a hash with library codes as the keys and an array of items as the values.
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
items.grouped_by_library
|
172
|
+
{ "MAIN" =>
|
173
|
+
[#<Alma::BibItem:0x000000038c6b79...>],
|
174
|
+
"NOT_MAIN" =>
|
175
|
+
[#<Alma::BibItem:0x000000038c6b88...>, #<Alma::BibItem:0x000000038c6b94...>,],
|
176
|
+
}
|
177
|
+
```
|
178
|
+
|
179
|
+
The data for each item can be accessed via hash representation of the [item structure](https://developers.exlibrisgroup.com/alma/apis/xsd/rest_item.xsd), e.g.:
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
item = items.first
|
183
|
+
|
184
|
+
item["holding_data"]["call_number"]
|
185
|
+
"T385 .F79 2008"
|
186
|
+
|
187
|
+
item["item_data"]["location"]["value"]
|
188
|
+
"STACKS"
|
189
|
+
|
190
|
+
```
|
191
|
+
|
192
|
+
There are also numerous convenience methods
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
# Boolean checks
|
196
|
+
item.in_temp_location?
|
197
|
+
item.in_place? # Basically, On Shelf or Not
|
198
|
+
item.non_circulating?
|
199
|
+
item.missing_or_lost?
|
200
|
+
item.has_temp_call_number?
|
201
|
+
item.has_alt_call_number?
|
202
|
+
item.has_process_type?
|
203
|
+
|
204
|
+
|
205
|
+
# Opinionated Accessors - return the value, or an empty string
|
206
|
+
|
207
|
+
# Returns temp library/location if appropriate, else normal library/location
|
208
|
+
item.library
|
209
|
+
item.library_name
|
210
|
+
item.location
|
211
|
+
item.location_name
|
212
|
+
|
213
|
+
# which use these methods under the hood
|
214
|
+
item.holding_library
|
215
|
+
item.holding_location
|
216
|
+
|
217
|
+
item.temp_library
|
218
|
+
item.temp_location
|
219
|
+
|
220
|
+
|
221
|
+
# Looks for Temp call number, then alternate call number, then normal call number
|
222
|
+
item.call_number
|
223
|
+
|
224
|
+
# and which use
|
225
|
+
item.temp_call_number
|
226
|
+
item.alt_call_number
|
227
|
+
|
228
|
+
|
229
|
+
# standard accessors
|
230
|
+
item.process_type
|
231
|
+
item.base_status
|
232
|
+
item.circulation_policy
|
233
|
+
item.description
|
234
|
+
item.public_note
|
235
|
+
|
236
|
+
```
|
237
|
+
|
238
|
+
### Logging
|
239
|
+
This gem exposes a loggable interface to responses. Thus a response will respond to `loggable` and return a hash with state values that may be of use to log.
|
240
|
+
|
241
|
+
As a bonus, when we enable this feature using the `enable_loggable` configuration, error messages will contain the loggable values and be formatted as JSON.
|
242
|
+
|
134
243
|
## Development
|
135
244
|
|
136
245
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
137
246
|
|
138
247
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
139
248
|
|
249
|
+
Use `bundle exec guard` to continuously run specs while developing.
|
250
|
+
|
140
251
|
## Contributing
|
141
252
|
|
142
253
|
Bug reports and pull requests are welcome on GitHub at https://github.com/tulibraries/alma_rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -145,4 +256,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/tulibr
|
|
145
256
|
## License
|
146
257
|
|
147
258
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
148
|
-
|
data/Rakefile
CHANGED
data/alma.gemspec
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
6
|
+
require "alma/version"
|
5
7
|
|
6
8
|
Gem::Specification.new do |spec|
|
7
9
|
spec.name = "alma"
|
8
10
|
spec.version = Alma::VERSION
|
9
|
-
spec.authors = ["Chad Nelson"]
|
10
|
-
spec.email = ["chad.nelson@temple.edu"]
|
11
|
+
spec.authors = ["Jennifer Anton", "David Kinzer", "Chad Nelson"]
|
12
|
+
spec.email = ["jennifer.anton@temple.edu", "david.kinzer@temple.edu", "chad.nelson@temple.edu"]
|
11
13
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
+
spec.summary = "Client for Ex Libris Alma Web Services"
|
15
|
+
spec.description = "Client for Ex Libris Alma Web Services"
|
14
16
|
spec.homepage = "https://github.com/tulibraries/alma_rb"
|
15
17
|
spec.license = "MIT"
|
16
18
|
|
@@ -21,16 +23,19 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
24
|
spec.require_paths = ["lib"]
|
23
25
|
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
spec.add_dependency "ezwadl"
|
27
|
+
spec.add_dependency "httparty"
|
28
|
+
spec.add_dependency "xml-simple"
|
29
|
+
spec.add_dependency "activesupport"
|
30
30
|
|
31
|
-
spec.add_development_dependency "bundler", "~>
|
32
|
-
spec.add_development_dependency "rake", "~>
|
31
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
32
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
33
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
34
|
+
spec.add_development_dependency "webmock"
|
35
|
+
spec.add_development_dependency "pry"
|
36
|
+
spec.add_development_dependency "rubocop"
|
37
|
+
spec.add_development_dependency "rubocop-rails"
|
38
|
+
spec.add_development_dependency "byebug"
|
39
|
+
spec.add_development_dependency "guard"
|
40
|
+
spec.add_development_dependency "guard-rspec"
|
36
41
|
end
|
data/lib/alma/alma_record.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Alma
|
2
4
|
class AlmaRecord
|
3
|
-
|
4
5
|
def initialize(record)
|
5
6
|
@raw_record = record
|
6
7
|
post_initialize()
|
@@ -23,6 +24,5 @@ module Alma
|
|
23
24
|
# Subclasses can define this method to perform extra initialization
|
24
25
|
# after the super class init.
|
25
26
|
end
|
26
|
-
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|