librix 0.1.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54f6886443843a52f60a21dbd5ac37c50ed63ec003d32b219c6a65f04188df48
4
- data.tar.gz: d1565db4b82797814be40d38c9238ec43100bedbf473b7adb7df39f429138986
3
+ metadata.gz: 3300a4d8cf026dc962a22b8dd50d7ce60887d616e76c9153220c42b69132388e
4
+ data.tar.gz: abfc5f0760d21ecaea46451ad88506c3a48966a3ca58a5b1cc238a384cfc0421
5
5
  SHA512:
6
- metadata.gz: 8ab9f5bad198443a8867b32e866f3ab6662eeeacfa6157c0914553bbe810d73bd30a921b129669d17150e17df424511b22c12a08d862249ebeb4c0b5e5ff7e4d
7
- data.tar.gz: daf011c366f864d4554a849478304ed9adef25568815ee754b2b4e80681c243b60caa88b66375b5b187ce37b6e09ab11dc888b8e12b70d1c80450c1f19f12639
6
+ metadata.gz: 1baf48dc4e454176fa2bf6e58432806a1a71eb4dfe675fda092791ff630dd0ea99db3ef742443f854fb98aaf0a4a5f0577192f79941c96dee39dc28fab0c74aa
7
+ data.tar.gz: 0ce4eb5891ee7d2ba3d48b48cf4519a14c6e8e5cb8b02e2f84b119211652f9585da5123fd94aa81c2d6ce9ccd5c4a1e874d5d8a1ce33352f9055832919b9ae7c
data/CHANGELOG.md CHANGED
@@ -3,3 +3,9 @@
3
3
  ## [0.1.0] - 2025-10-16
4
4
 
5
5
  - Initial release
6
+ - Added default Google Books integration
7
+
8
+ ## [0.2.0] - 2026-01-08
9
+ ### Added
10
+ - Provider OpenLibrary
11
+ - Search Books and covers for e books (don't require API KEY)
data/README.md CHANGED
@@ -1,18 +1,22 @@
1
- # Librix
1
+ # Librix — Your Friendly Book API Librarian
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ **Librix** is a Ruby gem that makes working with book APIs easy.
4
+ Instead of juggling different endpoints and data formats from places like Google Books, Open Library, or Goodreads, Librix gives you one clean, consistent interface to work with.
4
5
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/librix`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+ With Librix, you can:
6
7
 
7
- ## Installation
8
+ - Connect to multiple book APIs through a single, unified interface
9
+ - Search for titles, authors, descriptions, and covers without the usual API chaos
10
+ - Get clean, consistent responses no matter where the data comes from
11
+ - Add new API integrations easily, without touching your core logic
8
12
 
9
- Install the gem and add to the application's Gemfile by executing:
13
+ ## Installation
10
14
 
11
15
  ```bash
12
16
  bundle add librix
13
17
  ```
14
18
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
19
+ OR
16
20
 
17
21
  ```bash
18
22
  gem install librix
@@ -51,15 +55,11 @@ result = provider.search(title: "Clean Code")
51
55
  # provider = Librix.provider(:my_provider)
52
56
  ```
53
57
 
54
- ## Development
55
-
56
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
57
-
58
- To install this gem onto your local machine, run `bundle exec rake install`. 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
59
-
60
58
  ## Contributing
61
59
 
62
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/librix. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/librix/blob/master/CODE_OF_CONDUCT.md).
60
+ Bug reports and pull requests are welcome.
61
+
62
+ This is my first gem by the way, so feel free to give me any feedback or advise :).
63
63
 
64
64
  ## License
65
65
 
@@ -2,7 +2,6 @@ module Librix
2
2
  class Configuration
3
3
  attr_accessor :google_books_api_key,
4
4
  :goodreads_api_key,
5
- :open_library_enabled,
6
5
  :provider,
7
6
  :http_open_timeout,
8
7
  :http_read_timeout,
@@ -10,7 +9,6 @@ module Librix
10
9
  :google_books_base_url
11
10
 
12
11
  def initialize
13
- @open_library_enabled = false
14
12
  @http_open_timeout = 2
15
13
  @http_read_timeout = 5
16
14
  @user_agent = "librix/#{Librix::VERSION}"
@@ -21,7 +21,8 @@ module Librix
21
21
 
22
22
  def registry
23
23
  @registry ||= {
24
- google_books: Librix::Providers::GoogleBooks
24
+ google_books: Librix::Providers::GoogleBooks,
25
+ open_library: Librix::Providers::OpenLibrary
25
26
  }
26
27
  end
27
28
  end
@@ -0,0 +1,47 @@
1
+ require 'uri'
2
+ require 'httparty'
3
+
4
+ module Librix
5
+ module Providers
6
+ class OpenLibrary
7
+ include HTTParty
8
+
9
+ base_uri 'https://openlibrary.org'
10
+ COVER_BASE = 'https://covers.openlibrary.org/b'.freeze
11
+
12
+ def search(query, limit: 10)
13
+ response = self.class.get(
14
+ '/search.json',
15
+ query: {
16
+ q: query,
17
+ limit: limit
18
+ }
19
+ )
20
+
21
+ response.success? ? response.parsed_response['docs'] : []
22
+ end
23
+
24
+ def cover_url(isbn: nil, cover_id: nil, olid: nil, size: 'M')
25
+ return cover_by_isbn(isbn, size) if isbn.present?
26
+ return cover_by_cover_id(cover_id, size) if cover_id.present?
27
+ return cover_by_olid(olid, size) if olid.present?
28
+
29
+ nil
30
+ end
31
+
32
+ private
33
+
34
+ def cover_by_isbn(isbn, size)
35
+ "#{COVER_BASE}/ISBN/#{isbn}-#{size}.jpg?default=false"
36
+ end
37
+
38
+ def cover_by_cover_id(cover_id, size)
39
+ "#{COVER_BASE}/id/#{cover_id}-#{size}.jpg?default=false"
40
+ end
41
+
42
+ def cover_by_olid(olid, size)
43
+ "#{COVER_BASE}/OLID/#{olid}-#{size}.jpg?default=false"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Librix
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/librix.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative "librix/version"
4
4
  require_relative "librix/configuration"
5
5
  require_relative "librix/providers/google_books"
6
+ require_relative "librix/providers/open_library"
6
7
  require_relative "librix/providers/factory"
7
8
 
8
9
  module Librix
@@ -0,0 +1,10 @@
1
+ {
2
+ "systemParams": "linux-x64-115",
3
+ "modulesFolders": [],
4
+ "flags": [],
5
+ "linkedModules": [],
6
+ "topLevelPatterns": [],
7
+ "lockfileEntries": {},
8
+ "files": [],
9
+ "artifacts": {}
10
+ }
data/yarn.lock ADDED
@@ -0,0 +1,4 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinicius Coelho
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-01-09 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: httparty
@@ -86,8 +87,11 @@ files:
86
87
  - lib/librix/configuration.rb
87
88
  - lib/librix/providers/factory.rb
88
89
  - lib/librix/providers/google_books.rb
90
+ - lib/librix/providers/open_library.rb
89
91
  - lib/librix/version.rb
92
+ - node_modules/.yarn-integrity
90
93
  - sig/librix.rbs
94
+ - yarn.lock
91
95
  homepage: https://github.com/viniciusscoelho/librix
92
96
  licenses:
93
97
  - MIT
@@ -96,6 +100,7 @@ metadata:
96
100
  homepage_uri: https://github.com/viniciusscoelho/librix
97
101
  source_code_uri: https://github.com/viniciusscoelho/librix
98
102
  changelog_uri: https://github.com/viniciusscoelho/librix/blob/main/CHANGELOG.md
103
+ post_install_message:
99
104
  rdoc_options: []
100
105
  require_paths:
101
106
  - lib
@@ -110,7 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
115
  - !ruby/object:Gem::Version
111
116
  version: '0'
112
117
  requirements: []
113
- rubygems_version: 3.6.8
118
+ rubygems_version: 3.5.16
119
+ signing_key:
114
120
  specification_version: 4
115
121
  summary: Gem to manage book search across multiple providers
116
122
  test_files: []