enju_ndl 0.3.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +14 -0
- data/Rakefile +1 -1
- data/app/models/ndl_book.rb +11 -3
- data/app/views/ndl_books/index.html.erb +1 -1
- data/lib/enju_ndl/crd.rb +1 -1
- data/lib/enju_ndl/engine.rb +1 -1
- data/lib/enju_ndl/ndl_search.rb +9 -9
- data/lib/enju_ndl/version.rb +1 -1
- data/lib/enju_ndl.rb +0 -2
- data/spec/cassette_library/ImportRequest/should_import_a_foreign_book.yml +121 -0
- data/spec/cassette_library/ImportRequest/should_import_isbn.yml +49 -492
- data/spec/cassette_library/Manifestation/should_import_a_bibliographic_record.yml +121 -0
- data/spec/cassette_library/Manifestation/should_import_dcterms_issued.yml +121 -0
- data/spec/cassette_library/Manifestation/should_import_isbn.yml +52 -495
- data/spec/cassette_library/Manifestation/should_import_series_statement.yml +48 -1121
- data/spec/cassette_library/Manifestation/should_import_with_ndl_bib_id.yml +20 -23
- data/spec/cassette_library/NdlBook/import/should_get_author_IDs_from_NDLA.yml +62 -0
- data/spec/cassette_library/NdlBook/import/should_get_series_title.yml +24 -111
- data/spec/cassette_library/NdlBook/import/should_get_subject_IDs_from_NDLA.yml +62 -0
- data/spec/cassette_library/NdlBook/import/should_get_volume_number.yml +28 -92
- data/spec/cassette_library/NdlBook/import/should_import_audio_cd.yml +26 -126
- data/spec/cassette_library/NdlBook/import/should_import_bibliographic_record.yml +28 -166
- data/spec/cassette_library/NdlBook/import/should_import_bibliographic_record_that_does_not_have_any_classifications.yml +25 -155
- data/spec/cassette_library/NdlBook/import/should_import_edition.yml +25 -154
- data/spec/cassette_library/NdlBook/import/should_import_even_with_invalid_url.yml +25 -137
- data/spec/cassette_library/NdlBook/import/should_import_map.yml +25 -140
- data/spec/cassette_library/NdlBook/import/should_import_ndc8_classification.yml +26 -214
- data/spec/cassette_library/NdlBook/import/should_import_notated_music.yml +27 -125
- data/spec/cassette_library/NdlBook/import/should_import_painting.yml +26 -114
- data/spec/cassette_library/NdlBook/import/should_import_photograph.yml +26 -116
- data/spec/cassette_library/NdlBook/import/should_import_picture_postcard.yml +26 -136
- data/spec/cassette_library/NdlBook/import/should_import_publication_place.yml +28 -192
- data/spec/cassette_library/NdlBook/import/should_import_pud_date_is_nil.yml +25 -107
- data/spec/cassette_library/NdlBook/import/should_import_series_statement.yml +27 -194
- data/spec/cassette_library/NdlBook/import/should_import_series_statement_if_the_resource_is_serial.yml +24 -216
- data/spec/cassette_library/NdlBook/import/should_import_series_statement_s_creator.yml +27 -241
- data/spec/cassette_library/NdlBook/import/should_import_series_statement_transctiption.yml +27 -207
- data/spec/cassette_library/NdlBook/import/should_import_still_image.yml +26 -133
- data/spec/cassette_library/NdlBook/import/should_import_tactile_text.yml +28 -121
- data/spec/cassette_library/NdlBook/import/should_import_title_alternative.yml +27 -200
- data/spec/cassette_library/NdlBook/import/should_import_url_contain_whitespace.yml +24 -177
- data/spec/cassette_library/NdlBook/import/should_import_video_dvd.yml +25 -111
- data/spec/cassette_library/NdlBook/import/should_import_volume_number_string.yml +24 -193
- data/spec/cassette_library/NdlBook/import/should_import_volume_title.yml +25 -145
- data/spec/cassette_library/NdlBook/import/should_import_with_DDC_Fic_.yml +21 -24
- data/spec/cassette_library/NdlBook/import/should_not_get_series_title_if_book_has_not_series_title.yml +26 -124
- data/spec/cassette_library/NdlBook/import/should_not_get_volume_number_if_book_has_not_volume.yml +24 -105
- data/spec/cassette_library/NdlBook/search/should_not_distinguish_double_byte_space_from_one-byte_space_in_a_query.yml +53 -785
- data/spec/cassette_library/NdlBook/search/should_search_bibliographic_record.yml +26 -386
- data/spec/cassette_library/NdlBooksController/GET_index/should_get_index.yml +24 -463
- data/spec/cassette_library/NdlBooksController/POST_create/should_create_a_bibliographic_record_if_jpno_is_set.yml +24 -213
- data/spec/cassette_library/NdlBooksController/POST_create/should_create_a_serial_record.yml +28 -143
- data/spec/cassette_library/NdlBooksController/POST_create/should_not_create_a_bibliographic_record_if_jpno_is_not_set.yml +27 -22
- data/spec/cassette_library/Question/should_respond_to_search_crd.yml +12 -220
- data/spec/cassette_library/ndl_books/index/ndl_search_menu/should_reflect_query_params_for_views.yml +24 -384
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +5 -0
- data/spec/dummy/db/migrate/20191219122214_create_custom_properties.rb +12 -0
- data/spec/dummy/db/schema.rb +930 -1003
- data/spec/models/import_request_spec.rb +4 -0
- data/spec/models/manifestation_spec.rb +9 -1
- data/spec/models/ndl_book_spec.rb +20 -5
- data/spec/views/ndl_books/index.html.erb_spec.rb +1 -1
- metadata +454 -329
- data/README.rdoc +0 -10
- data/spec/cassette_library/Manifestation/should_imporrt_a_bibliographic_record.yml +0 -1211
- data/spec/dummy/config/initializers/session_store.rb +0 -8
@@ -3,7 +3,7 @@ require 'rails_helper'
|
|
3
3
|
describe Manifestation do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
it "should
|
6
|
+
it "should import a bibliographic record", vcr: true do
|
7
7
|
manifestation = Manifestation.import_from_ndl_search(isbn: '406258087X')
|
8
8
|
manifestation.should be_valid
|
9
9
|
end
|
@@ -23,4 +23,12 @@ describe Manifestation do
|
|
23
23
|
expect(manifestation).to be_valid
|
24
24
|
expect(manifestation.original_title).to eq "化学"
|
25
25
|
end
|
26
|
+
|
27
|
+
it "should import dcterms:issued", vcr: true do
|
28
|
+
manifestation = Manifestation.import_isbn("0262220733")
|
29
|
+
expect(manifestation).to be_valid
|
30
|
+
expect(manifestation.year_of_publication).to eq 2005
|
31
|
+
expect(manifestation.pub_date).to eq '2005'
|
32
|
+
expect(manifestation.date_of_publication).to eq Time.zone.parse('2005-01-01')
|
33
|
+
end
|
26
34
|
end
|
@@ -7,9 +7,9 @@ describe NdlBook do
|
|
7
7
|
NdlBook.per_page.should eq 10
|
8
8
|
end
|
9
9
|
|
10
|
-
context
|
11
|
-
it
|
12
|
-
NdlBook.search('library system')[:total_entries].should eq
|
10
|
+
context 'search' do
|
11
|
+
it 'should search bibliographic record', vcr: true do
|
12
|
+
NdlBook.search('library system')[:total_entries].should eq 5374
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should not distinguish double byte space from one-byte space in a query", vcr: true do
|
@@ -102,8 +102,8 @@ describe NdlBook do
|
|
102
102
|
|
103
103
|
it "should import url contain whitespace", vcr: true do
|
104
104
|
manifestation = NdlBook.import_from_sru_response('R100000002-I000002109818-00')
|
105
|
-
manifestation.original_title.should eq
|
106
|
-
manifestation.pub_date.should eq
|
105
|
+
manifestation.original_title.should eq 'ザ・スコット・フィッツジェラルド・ブック'
|
106
|
+
manifestation.pub_date.should eq '1991'
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should import audio cd", vcr: true do
|
@@ -208,5 +208,20 @@ describe NdlBook do
|
|
208
208
|
manifestation = NdlBook.import_from_sru_response("R100000002-I000008410444-00")
|
209
209
|
expect(manifestation.original_title).to eq "A single shard / Linda Sue Park"
|
210
210
|
end
|
211
|
+
|
212
|
+
it 'should get subject IDs from NDLA', vcr: true do
|
213
|
+
url = "https://iss.ndl.go.jp/books/R100000002-I028087126-00.rdf"
|
214
|
+
doc = Nokogiri::XML(Faraday.get(url).body)
|
215
|
+
ndl_book = NdlBook.new(doc)
|
216
|
+
ndl_book.subjects[0].should eq({id: 'http://id.ndl.go.jp/auth/ndlsh/01058852', value: 'ウェブアプリケーション'})
|
217
|
+
ndl_book.subjects[1].should eq({id: 'http://id.ndl.go.jp/auth/ndlsh/00569223', value: 'プログラミング (コンピュータ)'})
|
218
|
+
end
|
219
|
+
|
220
|
+
it 'should get author IDs from NDLA', vcr: true do
|
221
|
+
url = "https://iss.ndl.go.jp/books/R100000002-I028087126-00.rdf"
|
222
|
+
doc = Nokogiri::XML(Faraday.get(url).body)
|
223
|
+
ndl_book = NdlBook.new(doc)
|
224
|
+
ndl_book.authors[0].should eq({id: "http://id.ndl.go.jp/auth/entity/00730574", name: "山田, 祥寛", transcription: "ヤマダ, ヨシヒロ"})
|
225
|
+
end
|
211
226
|
end
|
212
227
|
end
|
@@ -10,7 +10,7 @@ describe "ndl_books/index" do
|
|
10
10
|
total_count: books[:total_entries],
|
11
11
|
).page(1).per(10))
|
12
12
|
render
|
13
|
-
expect(rendered).to include "
|
13
|
+
expect(rendered).to include "https://iss.ndl.go.jp/books?any=test"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|