ebsco-eds 0.0.1.pre
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 +7 -0
- data/.env.test +12 -0
- data/.gitignore +20 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ebsco-eds.gemspec +47 -0
- data/lib/ebsco/eds.rb +27 -0
- data/lib/ebsco/eds/error.rb +47 -0
- data/lib/ebsco/eds/http_exception.rb +49 -0
- data/lib/ebsco/eds/info.rb +193 -0
- data/lib/ebsco/eds/jsonable.rb +28 -0
- data/lib/ebsco/eds/options.rb +339 -0
- data/lib/ebsco/eds/record.rb +700 -0
- data/lib/ebsco/eds/results.rb +375 -0
- data/lib/ebsco/eds/session.rb +624 -0
- data/lib/ebsco/eds/settings.yml +35 -0
- data/lib/ebsco/eds/version.rb +5 -0
- metadata +248 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 62e553aee7daa0edd9d2d8090dc1e26140970f10
|
4
|
+
data.tar.gz: a52fcb3d33dfc8e7bb41a5046c49fb031fb9d92c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: def2d87b7779bf26805eca8978d464997ede09095140cc83b16e179282d4dd49c396ef45c752d5e93edfb44f79d5137c34e36e3760c2dfbcf6d2d239564dde71
|
7
|
+
data.tar.gz: 76e6cbc75bffbca076c435725c5e5fab389b1712c5e4504fb621bf4f4707bc49db2ba12cb0ac6676c812bf1034974170e6ee05378a7bf9932dd1aaa02347389a
|
data/.env.test
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
EDS_PROFILE=eds-api
|
2
|
+
EDS_USER=billmckinn
|
3
|
+
EDS_PASS=4n~r1me86y
|
4
|
+
EDS_AUTH=user
|
5
|
+
EDS_GUEST=n
|
6
|
+
EDS_ORG=none
|
7
|
+
|
8
|
+
# bmckinney repo
|
9
|
+
# CODECOV_TOKEN=cfc86a29-02eb-43f3-9903-7fd46f9a510d
|
10
|
+
|
11
|
+
# ebsco repo
|
12
|
+
CODECOV_TOKEN=d72eb958-f826-40eb-8112-e77a965dc94e
|
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
faraday.log
|
11
|
+
.idea/.rakeTasks
|
12
|
+
.idea/ebsco.iml
|
13
|
+
.idea/misc.xml
|
14
|
+
.idea/modules.xml
|
15
|
+
.idea/vcs.xml
|
16
|
+
.idea/workspace.xml
|
17
|
+
.idea/dictionaries
|
18
|
+
.env
|
19
|
+
yaml-sample-records
|
20
|
+
*.gem
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 EBSCO
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
<img src="https://discovery.ebsco.com/files/pulse-images/EDS-logo_1LINE.png"/>
|
2
|
+
|
3
|
+
A Ruby interface to the EBSCO Discovery Services API.
|
4
|
+
|
5
|
+
[](https://travis-ci.org/ebsco/edsapi-ruby)
|
6
|
+
[](https://codecov.io/gh/ebsco/edsapi-ruby/branch/master)
|
7
|
+
[](https://gemnasium.com/github.com/ebsco/edsapi-ruby)
|
8
|
+
[](https://gitter.im/ebsco/edsapi-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
9
|
+
|
10
|
+
## Dependencies
|
11
|
+
|
12
|
+
* Ruby 2.1+
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'ebsco-eds'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install ebsco-eds
|
29
|
+
|
30
|
+
## Documentation
|
31
|
+
|
32
|
+
- [Configuration](https://github.com/ebsco/edsapi-ruby/wiki/Configuration)
|
33
|
+
- [Quick Start](https://github.com/ebsco/edsapi-ruby/wiki/Quick-Start)
|
34
|
+
|
35
|
+
### Models
|
36
|
+
|
37
|
+
- [Session](https://github.com/ebsco/edsapi-ruby/wiki/Session)
|
38
|
+
- [Results](https://github.com/ebsco/edsapi-ruby/wiki/Results)
|
39
|
+
- [Records](https://github.com/ebsco/edsapi-ruby/wiki/Records)
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ebsco/edsapi-ruby.
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
48
|
+
|
49
|
+
You can run `bin/console` for an interactive prompt that will allow you to experiment.
|
50
|
+
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
52
|
+
|
53
|
+
#### Running the tests
|
54
|
+
- `git clone git://github.com/ebsco/edsapi-ruby && cd edsapi-ruby`
|
55
|
+
- `bundle`
|
56
|
+
- Create a `.env.test` file
|
57
|
+
- It should look like the following:
|
58
|
+
```ruby
|
59
|
+
EDS_PROFILE=profile_name
|
60
|
+
EDS_GUEST=n
|
61
|
+
EDS_USER=your_user_id
|
62
|
+
EDS_PASS=secret
|
63
|
+
EDS_AUTH=ip
|
64
|
+
EDS_ORG=your_institution
|
65
|
+
```
|
66
|
+
- `rake test`
|
67
|
+
|
68
|
+
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).
|
69
|
+
|
70
|
+
## License
|
71
|
+
|
72
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ebsco"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/ebsco-eds.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ebsco/eds/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ebsco-eds'
|
8
|
+
spec.version = EBSCO::EDS::VERSION
|
9
|
+
spec.authors = ['Bill McKinney','Eric Frierson']
|
10
|
+
spec.email = ['bmckinney@ebsco.com, efrierson@ebsco.com']
|
11
|
+
spec.summary = 'Summary: EBSCO EDS API'
|
12
|
+
spec.description = 'Description: EBSCO EDS API'
|
13
|
+
spec.homepage = 'https://github.com/ebsco/edsapi-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
# if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
# else
|
21
|
+
# raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
22
|
+
# end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
26
|
+
end
|
27
|
+
spec.files += Dir.glob('lib/**/*')
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_dependency 'faraday', '~> 0'
|
33
|
+
spec.add_dependency 'faraday-detailed_logger', '~> 2.0'
|
34
|
+
spec.add_dependency 'faraday_middleware', '~> 0.11'
|
35
|
+
spec.add_dependency 'logger', '~> 1.2'
|
36
|
+
spec.add_dependency 'dotenv', '~> 2.2'
|
37
|
+
spec.add_dependency 'climate_control', '~> 0'
|
38
|
+
spec.add_dependency 'require_all', '~> 1.3'
|
39
|
+
spec.add_dependency 'bibtex-ruby', '~> 4.0'
|
40
|
+
|
41
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
42
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
43
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
44
|
+
spec.add_development_dependency 'simplecov', '~> 0'
|
45
|
+
spec.add_development_dependency 'codecov', '~> 0.1'
|
46
|
+
|
47
|
+
end
|
data/lib/ebsco/eds.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'ebsco/eds/version'
|
2
|
+
require 'ebsco/eds/session'
|
3
|
+
require 'ebsco/eds/info'
|
4
|
+
require 'ebsco/eds/results'
|
5
|
+
require 'ebsco/eds/record'
|
6
|
+
require 'ebsco/eds/error'
|
7
|
+
require 'ebsco/eds/http_exception'
|
8
|
+
|
9
|
+
module EBSCO
|
10
|
+
|
11
|
+
module EDS
|
12
|
+
EDS_API_BASE = 'https://eds-api.ebscohost.com'
|
13
|
+
UID_AUTH_URL = '/authservice/rest/uidauth'
|
14
|
+
IP_AUTH_URL = '/authservice/rest/ipauth'
|
15
|
+
CREATE_SESSION_URL = '/edsapi/rest/CreateSession'
|
16
|
+
END_SESSION_URL = '/edsapi/rest/EndSession'
|
17
|
+
INFO_URL = '/edsapi/rest/Info'
|
18
|
+
SEARCH_URL = '/edsapi/rest/Search'
|
19
|
+
RETRIEVE_URL = '/edsapi/rest/Retrieve'
|
20
|
+
USER_AGENT = 'EBSCO EDS GEM v0.0.1'
|
21
|
+
INTERFACE_ID = 'EBSCO EDS GEM v0.0.1'
|
22
|
+
LOG = 'faraday.log'
|
23
|
+
MAX_ATTEMPTS = 2
|
24
|
+
MAX_RESULTS_PER_PAGE = 100
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module EBSCO
|
2
|
+
|
3
|
+
module EDS
|
4
|
+
class Error < StandardError
|
5
|
+
attr_reader :fault
|
6
|
+
def initialize(errors = nil)
|
7
|
+
if errors
|
8
|
+
@fault = errors
|
9
|
+
super(errors[:error_body])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# raised with passing in invalid or unsupported parameter
|
15
|
+
class InvalidParameter < StandardError; end
|
16
|
+
|
17
|
+
# raised when attempting an action that is invalid/unsupported
|
18
|
+
class ApiError < StandardError; end
|
19
|
+
|
20
|
+
# Raised when trying an action that is not supported
|
21
|
+
class NotImplemented < StandardError; end
|
22
|
+
|
23
|
+
# HTTP related errors
|
24
|
+
|
25
|
+
# raised when EDS returns the HTTP status code 400
|
26
|
+
class BadRequest < Error; end
|
27
|
+
|
28
|
+
# raised when EDS returns the HTTP status code 401
|
29
|
+
class Unauthorized < Error; end
|
30
|
+
|
31
|
+
# raised when EDS returns the HTTP status code 403
|
32
|
+
class Forbidden < Error; end
|
33
|
+
|
34
|
+
# raised when EDS returns the HTTP status code 404
|
35
|
+
class NotFound < Error; end
|
36
|
+
|
37
|
+
# Raised when EDS returns the HTTP status code 429
|
38
|
+
class TooManyRequests < Error; end
|
39
|
+
|
40
|
+
# Raised when EDS returns the HTTP status code 500
|
41
|
+
class InternalServerError < Error; end
|
42
|
+
|
43
|
+
# Raised when EDS returns the HTTP status code 503
|
44
|
+
class ServiceUnavailable < Error; end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module FaradayMiddleware
|
4
|
+
|
5
|
+
class RaiseHttpException < Faraday::Middleware
|
6
|
+
|
7
|
+
def initialize(app)
|
8
|
+
super app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
@app.call(env).on_complete do |response|
|
13
|
+
case response.status
|
14
|
+
when 200
|
15
|
+
when 400
|
16
|
+
raise EBSCO::EDS::BadRequest.new(error_message(response))
|
17
|
+
# when 401
|
18
|
+
# raise EBSCO::EDS::Unauthorized.new
|
19
|
+
# when 403
|
20
|
+
# raise EBSCO::EDS::Forbidden.new
|
21
|
+
# when 404
|
22
|
+
# raise EBSCO::EDS::NotFound.new
|
23
|
+
# when 429
|
24
|
+
# raise EBSCO::EDS::TooManyRequests.new
|
25
|
+
# when 500
|
26
|
+
# raise EBSCO::EDS::InternalServerError.new
|
27
|
+
# when 503
|
28
|
+
# raise EBSCO::EDS::ServiceUnavailable.new
|
29
|
+
else
|
30
|
+
raise EBSCO::EDS::BadRequest.new(error_message(response))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def error_message(response)
|
38
|
+
#puts response.inspect
|
39
|
+
{
|
40
|
+
method: response.method,
|
41
|
+
url: response.url,
|
42
|
+
status: response.status,
|
43
|
+
error_body: response.body
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
require 'ebsco/eds/options'
|
2
|
+
|
3
|
+
module EBSCO
|
4
|
+
|
5
|
+
module EDS
|
6
|
+
class Info
|
7
|
+
|
8
|
+
attr_accessor :available_search_criteria, :view_result_settings, :application_settings, :api_settings
|
9
|
+
|
10
|
+
def initialize(info)
|
11
|
+
@available_search_criteria = info['AvailableSearchCriteria']
|
12
|
+
@view_result_settings = info['ViewResultSettings']
|
13
|
+
@application_settings = info['ApplicationSettings']
|
14
|
+
@api_settings = info['ApiSettings']
|
15
|
+
end
|
16
|
+
|
17
|
+
# ====================================================================================
|
18
|
+
# SORTS
|
19
|
+
# ====================================================================================
|
20
|
+
|
21
|
+
def available_sorts (id = 'all')
|
22
|
+
@available_search_criteria.fetch('AvailableSorts',{}).select{|item| item['Id'] == id || id == 'all'}
|
23
|
+
end
|
24
|
+
|
25
|
+
# ====================================================================================
|
26
|
+
# SEARCH FIELDS
|
27
|
+
# ====================================================================================
|
28
|
+
|
29
|
+
def search_fields (code = 'all')
|
30
|
+
@available_search_criteria.fetch('AvailableSearchFields',{}).select{|item| item['FieldCode'] == code || code == 'all'}
|
31
|
+
end
|
32
|
+
|
33
|
+
# ====================================================================================
|
34
|
+
# SEARCH MODES
|
35
|
+
# ====================================================================================
|
36
|
+
|
37
|
+
def available_search_modes (mode = 'all_available')
|
38
|
+
@available_search_criteria.fetch('AvailableSearchModes',{}).select{|item| item['Mode'] == mode || mode == 'all_available'}
|
39
|
+
end
|
40
|
+
|
41
|
+
def available_search_mode_types
|
42
|
+
available_search_modes.map{|hash| hash['Mode']}
|
43
|
+
end
|
44
|
+
|
45
|
+
def default_search_mode
|
46
|
+
@available_search_criteria.fetch('AvailableSearchModes',{}).find{|item| item['DefaultOn'] == 'y'}['Mode']
|
47
|
+
end
|
48
|
+
|
49
|
+
# ====================================================================================
|
50
|
+
# EXPANDERS
|
51
|
+
# ====================================================================================
|
52
|
+
|
53
|
+
def available_expander_ids
|
54
|
+
@available_search_criteria.fetch('AvailableExpanders',{}).map{|hash| hash['Id']}
|
55
|
+
end
|
56
|
+
|
57
|
+
def default_expander_ids
|
58
|
+
@available_search_criteria.fetch('AvailableExpanders',{}).select{|item| item['DefaultOn'] == 'y'}.map{|hash| hash['Id']}
|
59
|
+
end
|
60
|
+
|
61
|
+
def available_expanders (id = 'all')
|
62
|
+
if id == 'all'
|
63
|
+
@available_search_criteria.fetch('AvailableExpanders',{})
|
64
|
+
else
|
65
|
+
@available_search_criteria.fetch('AvailableExpanders',{}).find{|item| item['Id'] == id}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# ====================================================================================
|
70
|
+
# LIMITERS
|
71
|
+
# ====================================================================================
|
72
|
+
|
73
|
+
def available_limiter_ids
|
74
|
+
@available_search_criteria.fetch('AvailableLimiters',{}).map{|hash| hash['Id']}
|
75
|
+
end
|
76
|
+
|
77
|
+
def default_limiter_ids
|
78
|
+
@available_search_criteria.fetch('AvailableLimiters',{}).select{|item| item['DefaultOn'] == 'y'}.map{|hash| hash['Id']}
|
79
|
+
end
|
80
|
+
|
81
|
+
def available_limiters (id = 'all')
|
82
|
+
if id == 'all'
|
83
|
+
@available_search_criteria.fetch('AvailableLimiters',{})
|
84
|
+
else
|
85
|
+
@available_search_criteria.fetch('AvailableLimiters',{}).find{|item| item['Id'] == id}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# get an array of limiter values for a Type=multiselectvalue limiter
|
90
|
+
def available_limiter_values (id)
|
91
|
+
_limiter = @available_search_criteria.fetch('AvailableLimiters',{}).find{|item| item['Id'] == id}
|
92
|
+
if _limiter['Type'] == 'multiselectvalue'
|
93
|
+
_limiter['LimiterValues'].map{|hash| hash['Value']}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# ====================================================================================
|
98
|
+
# RELATED CONTENT
|
99
|
+
# ====================================================================================
|
100
|
+
|
101
|
+
def available_related_content_types
|
102
|
+
available_related_content.map{|hash| hash['Type'] }
|
103
|
+
end
|
104
|
+
|
105
|
+
def default_related_content_types
|
106
|
+
@available_search_criteria.fetch('AvailableRelatedContent',{}).select{|item| item['DefaultOn'] == 'y'}.map{|hash| hash['Type']}
|
107
|
+
end
|
108
|
+
|
109
|
+
def available_related_content (type = 'all')
|
110
|
+
if type == 'all'
|
111
|
+
@available_search_criteria.fetch('AvailableRelatedContent',{})
|
112
|
+
else
|
113
|
+
@available_search_criteria.fetch('AvailableRelatedContent',{}).find{|item| item['Type'] == type}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# ====================================================================================
|
118
|
+
# AUTO SUGGEST
|
119
|
+
# ====================================================================================
|
120
|
+
|
121
|
+
def did_you_mean (id = 'all')
|
122
|
+
@available_search_criteria.fetch('AvailableDidYouMeanOptions',{}).select{|item| item['Id'] == id || id == 'all'}
|
123
|
+
end
|
124
|
+
|
125
|
+
def default_auto_suggest
|
126
|
+
@available_search_criteria.fetch('AvailableDidYouMeanOptions',{}).find{|item| item['Id'] == 'AutoSuggest'}['DefaultOn']
|
127
|
+
end
|
128
|
+
|
129
|
+
# ====================================================================================
|
130
|
+
# RESULTS VIEW SETTINGS
|
131
|
+
# ====================================================================================
|
132
|
+
|
133
|
+
def default_results_per_page
|
134
|
+
@view_result_settings['ResultsPerPage']
|
135
|
+
end
|
136
|
+
|
137
|
+
def max_results_per_page
|
138
|
+
MAX_RESULTS_PER_PAGE
|
139
|
+
end
|
140
|
+
|
141
|
+
def available_result_list_views
|
142
|
+
%w{brief title detailed}
|
143
|
+
end
|
144
|
+
|
145
|
+
def default_result_list_view
|
146
|
+
@view_result_settings['ResultListView']
|
147
|
+
end
|
148
|
+
|
149
|
+
def default_highlight
|
150
|
+
true
|
151
|
+
end
|
152
|
+
|
153
|
+
# ====================================================================================
|
154
|
+
# API SETTINGS
|
155
|
+
# ====================================================================================
|
156
|
+
|
157
|
+
def max_record_jump
|
158
|
+
@api_settings['MaxRecordJumpAhead']
|
159
|
+
end
|
160
|
+
|
161
|
+
# ====================================================================================
|
162
|
+
# APPLICATION SETTINGS
|
163
|
+
# ====================================================================================
|
164
|
+
|
165
|
+
def session_timeout
|
166
|
+
@application_settings['SessionTimeout']
|
167
|
+
end
|
168
|
+
|
169
|
+
# ====================================================================================
|
170
|
+
# AVAILABLE ACTIONS
|
171
|
+
# ====================================================================================
|
172
|
+
|
173
|
+
def available_actions
|
174
|
+
@available_search_criteria.deep_find_results('AddAction')
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# monkey patch
|
183
|
+
class Hash
|
184
|
+
def deep_find_results(key, object=self, found=[])
|
185
|
+
if object.respond_to?(:key?) && object.key?(key)
|
186
|
+
found << object[key]
|
187
|
+
end
|
188
|
+
if object.is_a? Enumerable
|
189
|
+
found << object.collect { |*a| deep_find(key, a.last) }
|
190
|
+
end
|
191
|
+
found.flatten.compact
|
192
|
+
end
|
193
|
+
end
|