Skip to content

Commit

Permalink
fetch ExComm docs #19
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew2net committed Feb 21, 2023
1 parent 179c87d commit 1409762
Show file tree
Hide file tree
Showing 5 changed files with 377 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/relaton_bsi/hit_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ class HitCollection < RelatonBib::HitCollection
#
# Initialize a new HitCollection.
#
# @param ref [String] reference
# @param reference [String] reference
# @param year [String] year
#
def initialize(ref, year = nil)
super ref, year
def initialize(reference, year = nil)
super reference, year
config = Algolia::Search::Config.new(
application_id: "575YE157G9",
api_key: "a057b4e74099445df2eddb7940828a10",
)
client = Algolia::Search::Client.new config, logger: ::Logger.new($stderr)
index = client.init_index "shopify_products"
resp = index.search text # , facetFilters: "product_type:standard"
ref = text.sub(/ExComm|Expert commentary/, "Ex")
resp = index.search ref # , facetFilters: "product_type:standard"
@array = create_hits resp[:hits]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/relaton_bsi/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RelatonBsi
VERSION = "1.14.3"
VERSION = "1.14.4"
end
12 changes: 12 additions & 0 deletions spec/relaton_bsi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@
end
end

context "fetch Expert commentary" do
it "full type name", vcr: { cassette_name: "excomm_full" } do
bib = RelatonBsi::BsiBibliography.get "BS 7273-4:2015+A1:2021 Expert commentary"
expect(bib.docidentifier[0].id).to eq "BS 7273-4:2015+A1:2021 ExComm"
end

it "short type name", vcr: { cassette_name: "excomm_short" } do
bib = RelatonBsi::BsiBibliography.get "BS EN ISO 13485 ExComm"
expect(bib.docidentifier[0].id).to eq "BS EN ISO 13485 Expert Commentary"
end
end

it "could not access site" do
index = double "algolia index"
client = double "algolia client", init_index: index
Expand Down
195 changes: 195 additions & 0 deletions spec/vcr_cassettes/excomm_full.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

164 changes: 164 additions & 0 deletions spec/vcr_cassettes/excomm_short.yml

Large diffs are not rendered by default.

0 comments on commit 1409762

Please sign in to comment.