montague 0.2.0
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/.gitignore +18 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +4 -0
- data/README.md +138 -0
- data/Rakefile +2 -0
- data/lib/montague.rb +9 -0
- data/lib/montague/api/api.rb +12 -0
- data/lib/montague/api/base.rb +27 -0
- data/lib/montague/api/client.rb +27 -0
- data/lib/montague/api/journal.rb +52 -0
- data/lib/montague/api/publisher.rb +52 -0
- data/lib/montague/model/archiving.rb +26 -0
- data/lib/montague/model/copyright_link.rb +26 -0
- data/lib/montague/model/funder.rb +26 -0
- data/lib/montague/model/header.rb +22 -0
- data/lib/montague/model/journal.rb +26 -0
- data/lib/montague/model/journal_report.rb +15 -0
- data/lib/montague/model/journals_report.rb +15 -0
- data/lib/montague/model/mandate.rb +44 -0
- data/lib/montague/model/model.rb +22 -0
- data/lib/montague/model/paid_access.rb +34 -0
- data/lib/montague/model/publisher.rb +46 -0
- data/lib/montague/model/publisher_report.rb +12 -0
- data/lib/montague/model/publishers_report.rb +14 -0
- data/lib/montague/model/report_header_mixin.rb +12 -0
- data/lib/montague/model/report_http_response_mixin.rb +12 -0
- data/lib/montague/model/report_publisher_mixin.rb +12 -0
- data/lib/montague/model/structure.rb +18 -0
- data/lib/montague/reporter/journal.rb +26 -0
- data/lib/montague/reporter/journals.rb +26 -0
- data/lib/montague/reporter/publisher.rb +24 -0
- data/lib/montague/reporter/publishers.rb +24 -0
- data/lib/montague/reporter/reporter.rb +11 -0
- data/lib/montague/version.rb +5 -0
- data/lib/montague/xml_extractor/base.rb +58 -0
- data/lib/montague/xml_extractor/header.rb +43 -0
- data/lib/montague/xml_extractor/journal.rb +31 -0
- data/lib/montague/xml_extractor/publisher.rb +164 -0
- data/lib/montague/xml_extractor/xml_extractor.rb +13 -0
- data/montague.gemspec +22 -0
- data/test/test_helper.rb +102 -0
- data/test/test_search_by_journal.rb +90 -0
- data/test/test_search_by_publisher_api.rb +36 -0
- metadata +131 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestSearchByJournal < Minitest::Test
|
4
|
+
|
5
|
+
def test_find_by_title_contains_with_api_key
|
6
|
+
# title (partial): modern language
|
7
|
+
journals = Montague::API::Journal.new config
|
8
|
+
x = journals.find_by_title text: 'modern language', filter: :contains
|
9
|
+
|
10
|
+
asserts_journals_report x
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_find_by_title_starts_with_api_key
|
14
|
+
# title (partial): Machine
|
15
|
+
journals = Montague::API::Journal.new config
|
16
|
+
x = journals.find_by_title text: 'Machine', filter: :starts
|
17
|
+
|
18
|
+
asserts_journals_report x
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_find_by_title_with_api_key
|
22
|
+
# title: Journal of Geology
|
23
|
+
# issn: 0022-1376
|
24
|
+
journals = Montague::API::Journal.new config
|
25
|
+
x = journals.find_by_title text: 'chemistry', filter: :exact
|
26
|
+
|
27
|
+
asserts_journals_report x
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_find_by_title_unique_with_api_key
|
31
|
+
# title: Man
|
32
|
+
journals = Montague::API::Journal.new config
|
33
|
+
x = journals.find_by_title text: 'Man', filter: :exact
|
34
|
+
|
35
|
+
asserts_journals_report x
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_invalid_issn_with_api_key
|
39
|
+
# title: Physical Review D - Particles, Fields, Gravitation and Cosmology
|
40
|
+
# issn: 1550-7998 (INCOMPLETE)
|
41
|
+
journals = Montague::API::Journal.new config
|
42
|
+
x = journals.find_by_issn('1550-799')
|
43
|
+
|
44
|
+
asserts_journal_report x
|
45
|
+
assert_equal 0, x.header.hits
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_find_by_issn_without_api_key
|
49
|
+
# title: Physical Review D - Particles, Fields, Gravitation and Cosmology
|
50
|
+
# issn: 1550-7998
|
51
|
+
journals = Montague::API::Journal.new
|
52
|
+
x = journals.find_by_issn('1550-7998')
|
53
|
+
|
54
|
+
asserts_publisher_found x
|
55
|
+
asserts_journal_report x
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_find_by_issn_with_api_key
|
59
|
+
# title: Physical Review D - Particles, Fields, Gravitation and Cosmology
|
60
|
+
# issn: 1550-7998
|
61
|
+
journals = Montague::API::Journal.new config
|
62
|
+
x = journals.find_by_issn('1550-7998')
|
63
|
+
|
64
|
+
asserts_publisher_found x
|
65
|
+
asserts_journal_report x
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_alternate_issn_values_with_api_key
|
69
|
+
# title: Education and Urban Society
|
70
|
+
# issn: 0013-1245
|
71
|
+
journals = Montague::API::Journal.new config
|
72
|
+
x = journals.find_by_issn('1552-3535,0013-1245')
|
73
|
+
|
74
|
+
asserts_journal_report x
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_mandates_with_api_key
|
78
|
+
# title: Journal of Geology
|
79
|
+
# issn: 0022-1376
|
80
|
+
journals = Montague::API::Journal.new config
|
81
|
+
x = journals.find_by_issn('0022-1376')
|
82
|
+
|
83
|
+
mandates = x.publisher.mandates
|
84
|
+
assert_instance_of Array, mandates
|
85
|
+
refute_empty mandates
|
86
|
+
assert_instance_of Montague::Model::Mandate, mandates.first
|
87
|
+
assert_equal true, mandates.first.data?
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestSearchByPublisher < Minitest::Test
|
4
|
+
|
5
|
+
def test_find_by_name_all_with_api_key
|
6
|
+
publishers = Montague::API::Publisher.new config
|
7
|
+
x = publishers.find_by_name text: 'optical society', filter: :all
|
8
|
+
|
9
|
+
asserts_publishers_report x
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_find_by_name_any_with_api_key
|
13
|
+
publishers = Montague::API::Publisher.new config
|
14
|
+
x = publishers.find_by_name text: 'chemistry society', filter: :any
|
15
|
+
|
16
|
+
asserts_publishers_report x
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_find_by_name_exact_with_api_key
|
20
|
+
publishers = Montague::API::Publisher.new config
|
21
|
+
x = publishers.find_by_name text: 'tute of', filter: :exact
|
22
|
+
|
23
|
+
asserts_publishers_report x
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_find_by_id_with_api_key
|
27
|
+
# title: Physical Review D - Particles, Fields, Gravitation and Cosmology
|
28
|
+
# id: 10
|
29
|
+
id = 10
|
30
|
+
publishers = Montague::API::Publisher.new config
|
31
|
+
x = publishers.find_by_id id
|
32
|
+
|
33
|
+
asserts_publisher_report x
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: montague
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adrian Albin-Clark
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest-reporters
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
55
|
+
description:
|
56
|
+
email: a.albin-clark@lancaster.ac.uk
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- ".gitignore"
|
62
|
+
- CHANGELOG.md
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- lib/montague.rb
|
67
|
+
- lib/montague/api/api.rb
|
68
|
+
- lib/montague/api/base.rb
|
69
|
+
- lib/montague/api/client.rb
|
70
|
+
- lib/montague/api/journal.rb
|
71
|
+
- lib/montague/api/publisher.rb
|
72
|
+
- lib/montague/model/archiving.rb
|
73
|
+
- lib/montague/model/copyright_link.rb
|
74
|
+
- lib/montague/model/funder.rb
|
75
|
+
- lib/montague/model/header.rb
|
76
|
+
- lib/montague/model/journal.rb
|
77
|
+
- lib/montague/model/journal_report.rb
|
78
|
+
- lib/montague/model/journals_report.rb
|
79
|
+
- lib/montague/model/mandate.rb
|
80
|
+
- lib/montague/model/model.rb
|
81
|
+
- lib/montague/model/paid_access.rb
|
82
|
+
- lib/montague/model/publisher.rb
|
83
|
+
- lib/montague/model/publisher_report.rb
|
84
|
+
- lib/montague/model/publishers_report.rb
|
85
|
+
- lib/montague/model/report_header_mixin.rb
|
86
|
+
- lib/montague/model/report_http_response_mixin.rb
|
87
|
+
- lib/montague/model/report_publisher_mixin.rb
|
88
|
+
- lib/montague/model/structure.rb
|
89
|
+
- lib/montague/reporter/journal.rb
|
90
|
+
- lib/montague/reporter/journals.rb
|
91
|
+
- lib/montague/reporter/publisher.rb
|
92
|
+
- lib/montague/reporter/publishers.rb
|
93
|
+
- lib/montague/reporter/reporter.rb
|
94
|
+
- lib/montague/version.rb
|
95
|
+
- lib/montague/xml_extractor/base.rb
|
96
|
+
- lib/montague/xml_extractor/header.rb
|
97
|
+
- lib/montague/xml_extractor/journal.rb
|
98
|
+
- lib/montague/xml_extractor/publisher.rb
|
99
|
+
- lib/montague/xml_extractor/xml_extractor.rb
|
100
|
+
- montague.gemspec
|
101
|
+
- test/test_helper.rb
|
102
|
+
- test/test_search_by_journal.rb
|
103
|
+
- test/test_search_by_publisher_api.rb
|
104
|
+
homepage: https://github.com/lulibrary/montague
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '2.1'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.2.2
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Wrapper for the SHERPA/RoMEO API.
|
128
|
+
test_files:
|
129
|
+
- test/test_helper.rb
|
130
|
+
- test/test_search_by_journal.rb
|
131
|
+
- test/test_search_by_publisher_api.rb
|