jekyll-get-books 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 275194cc664d8e84e812fff3bfe8a2c52f483f5fc8e694020a7c8b88592a5035
4
- data.tar.gz: 33c95cc3a7a56e2829398b5b61055d7df91cd6c9ee09fc4cb4227e7fd6eb09ff
3
+ metadata.gz: 4214096bbe22161671c42b5fad3469fbce4d68b6e8fcc0ef0944bd37317e6318
4
+ data.tar.gz: a5beac0208ae1186cbaac3a5aac8cef27c1b8139ce14172d981bdbdb16dc7819
5
5
  SHA512:
6
- metadata.gz: 42108614acfc215355fe489194bb58290132436f17d66d01061b2a393d76c35eb409133613090d2c33621eedd1313aee65a9bb996bd1ff8435fca3cb06a04c04
7
- data.tar.gz: 7785ce6ddf46d59e370397a6b9a1b72467b5b20e43c184dbdc049cd9f3accfb4e7bef912ba4ef7a1e45d792ca95315043bd5a13dd918fd3ec319e7f5adf6ac65
6
+ metadata.gz: 654641cb41b4db8741ce14b941ec6f5f044e00b58e667aaa87a9b8477d67ca2a31700267f2f213b3b1a008461a2e6f38f63bcb0c78a05db1e23e210bb8f63637
7
+ data.tar.gz: 39132155da06fd758f43bdc51bcbb8bd73c20b7a0f57c4d2003eb360b1d4e567b01f0764ef02cab0b8b71c4aceea905f8448ddc4b7ab26d8f4b7a409a1b96788
data/README.md CHANGED
@@ -1,16 +1,29 @@
1
1
  # jekyll-get-books
2
2
  > 💎 Fetch and safe meta information for books from the Google Book API for a Jekyll Site.
3
3
 
4
+
5
+
6
+ ## Installation
7
+
8
+ 1. Use `bundle add jekyll-get-books` to add this to your site's Gemfile.
9
+ 2. Add this plugin to the `plugins` listed in your `_config.yml` file. For example:
10
+ ```
11
+ plugins:
12
+ - jekyll-get-books
13
+ ```
14
+
4
15
  ## Usage
5
16
 
6
17
  Add a `jekyll_get_books` section to your `_config.yml` file. This section should be an array of objects containing `data`, `json` and `file` properties:
7
18
  * The `data` property specifies where in the `site.data` you would like to put this data.
8
- * The `json` property is the remote URL of the JSON file.
19
+ * The `json` property is the remote URL of the JSON file without specific data attributes.
20
+ * The `file` property is the path to the csv file with the ISBN numbers.
9
21
 
22
+ Examples can be found in the examples folder.
10
23
 
11
24
  ## Contributing
12
25
 
13
- Bug reports and pull requests are welcome on GitHub at https://github.com/tokzk/jekyll-amazon.
26
+ Bug reports and pull requests are welcome on GitHub at https://github.com/c-leitner/jekyll-get-books.
14
27
 
15
28
  ## Credit
16
29
 
@@ -0,0 +1,9 @@
1
+ # Add this to your _config.yml file
2
+
3
+ plugins:
4
+ - jekyll-get-books
5
+
6
+ jekyll_get_books:
7
+ - data: test #arbitrary name where the data is being saved
8
+ json: 'https://www.googleapis.com/books/v1/volumes?q=isbn:' #link to a book API. In this case the Google Book API which returns a JSON
9
+ file: '_data/books.csv' # Path to the csv files with the ISBNs
@@ -0,0 +1,3 @@
1
+ isbn
2
+ 9781594484803
3
+ 9780980122787
data/examples/books.md ADDED
@@ -0,0 +1,12 @@
1
+ In your Jekyll site you will be able to use:
2
+
3
+ ```
4
+ {% for item in site.data.test.items %}
5
+ **{{item.volumeInfo.title}}** - {{item.volumeInfo.authors[0]}} <span style="float: right; ">{{item.volumeInfo.publisher}}</span><br />
6
+ {{item.volumeInfo.subtitle}}
7
+
8
+ {% endfor %}
9
+
10
+ ```
11
+
12
+
@@ -30,7 +30,16 @@ module JekyllGetBooks
30
30
  warn "File does not exist / Path is incorrect".yellow
31
31
  end
32
32
  CSV.foreach((file), headers: true, col_sep: ",") do |row|
33
- output = JSON.load(URI.open(source+row['isbn']))
33
+ begin
34
+ output = JSON.load(URI.open(source+row['isbn']))
35
+ rescue => e
36
+ case e
37
+ when OpenURI::HTTPError
38
+ warn "A HTTP Error occurred while accessing the API".yellow
39
+ when SocketError
40
+ warn "A Socket Error occurred while accessing the API".yellow
41
+ end
42
+ end
34
43
  results.deep_merge(output)
35
44
  end
36
45
  site.data[d['data']] = results
@@ -1,3 +1,3 @@
1
1
  module JekyllGetBooks
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-get-books
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clemens Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-20 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -48,6 +48,9 @@ files:
48
48
  - ".gitignore"
49
49
  - LICENSE
50
50
  - README.md
51
+ - examples/_config.yml
52
+ - examples/_data/books.csv
53
+ - examples/books.md
51
54
  - jekyll-get-books.gemspec
52
55
  - lib/jekyll-get-books.rb
53
56
  - lib/jekyll-get-books/converter.rb
@@ -71,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
74
  - !ruby/object:Gem::Version
72
75
  version: '0'
73
76
  requirements: []
74
- rubygems_version: 3.2.18
77
+ rubygems_version: 3.3.5
75
78
  signing_key:
76
79
  specification_version: 4
77
80
  summary: Fetch and safe meta information for books from the Google Book API for a