google_books_client 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d884c2141a5536e429672719521552ba1331bd1151add8dba8666ed4536a570
4
- data.tar.gz: 9e86c525523b04978688a1b0ee89b1297565fccd9aafb17da9c6b1e21622917b
3
+ metadata.gz: 2bac51ecfda0f49e570394dd7357d508816e9d5ba8c63c0b562000aadfd8088e
4
+ data.tar.gz: 5ddd793c514d0e133d6c1ff8330443e046490f74a4e3e44ce1a8f898edb0211c
5
5
  SHA512:
6
- metadata.gz: 6b6b10acfc4c84fb6b4d96290796281b4b9e36143f3237313b3201fdde035e677be91d2b3f69e4679fbf1bb8d24afa03b7dec39fea4978cd0d05a63060c86ef2
7
- data.tar.gz: e508667463c914d9169933652c2f130ec90277980d57ba6fbd5266938875f6a35ad87a0fbcf1c998c8cc898fc3be0d944469c5c9f6dd73e0611fc266c16a8318
6
+ metadata.gz: 63aae522ffe2e99baf76ffb159adfcc6fb8cb552e38ea603eba9780873a393bc0dde04d345867ec568d31e0b94bae627cfc649f13cbbcc6929a0c419c060645d
7
+ data.tar.gz: 023bc6b3e62c79a3ac05a381979141b6db11dbbf936051364caf14631edbf6636b334c7ac76cf0f51551b44155eb68d8f2d510e3b7d8b0412c6b3a1dfe47c82d
data/.rubocop.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
3
  TargetRubyVersion: 2.6
4
+ Exclude:
5
+ - 'spec/**/*'
6
+ - 'vendor/**/*'
4
7
 
5
8
  Style/StringLiterals:
6
9
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1 +1,11 @@
1
1
  # Google Books Client
2
+
3
+ ## [v0.1.0](https://github.com/betosardinha/google_books_client/releases/tag/v0.1.0) (2023-12-29)
4
+
5
+ ### Features
6
+
7
+ - Add support to models:
8
+ - Volume.
9
+ - SubscriptionConfig.
10
+ - Add support to resources:
11
+ - Volumes.
data/README.md CHANGED
@@ -1,34 +1,153 @@
1
- # Google::Books::Client
1
+ <img src="https://github.com/betosardinha/google_books_client/assets/38788696/3137d5f7-d6a6-4f82-bd44-3ea334950e1f" width="250">
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ # GoogleBooksClient
4
+
5
+ The Google Books client is a simple Ruby gem that centralizes requests and communications with the Google Books API.
6
+
7
+ ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/betosardinha/google_books_client/ruby-ci.yml)
8
+ ![GitHub License](https://img.shields.io/github/license/betosardinha/google_books_client)
9
+ ![GitHub release (with filter)](https://img.shields.io/github/v/release/betosardinha/google_books_client)
10
+ ![Gem Total Downloads](https://img.shields.io/gem/dt/google_books_client)
4
11
 
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/google/books/client`. To experiment with that code, run `bin/console` for an interactive prompt.
6
12
 
7
- ## Installation
8
13
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
14
+ ## Table of Contents
15
+ 1. [Installation](#installation)
16
+ 2. [Usage](#usage)
17
+ - [Configuration](#configuration)
18
+ - [Models](#models)
19
+ - [Resources](#resources)
20
+ 3. [Development](#development)
21
+ 4. [Tools](#tools)
22
+ 5. [Contributing](#contributing)
23
+ 6. [Versioning](#versioning)
24
+ 7. [License](#license)
25
+ 8. [Code of Conduct](#code-of-conduct)
26
+ 9. [Contact](#contact)
27
+
28
+ ## Installation
10
29
 
11
30
  Install the gem and add to the application's Gemfile by executing:
12
31
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
32
+ ```bash
33
+ bundle add google_books_client
34
+ ```
35
+
36
+ Or add it manually to the Gemfile:
37
+
38
+ ```ruby
39
+ gem 'google_books_client'
40
+ ```
14
41
 
15
42
  If bundler is not being used to manage dependencies, install the gem by executing:
16
43
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
44
+ ```bash
45
+ gem install google_books_client
46
+ ```
18
47
 
19
48
  ## Usage
20
49
 
21
- TODO: Write usage instructions here
50
+ ### Configuration
51
+ To use the gem, you must first configure it in an initializer file at your project, for example:
52
+
53
+ ```ruby
54
+ # frozen_string_literal: true
55
+
56
+ require 'google_books_client'
57
+
58
+ GoogleBooksClient.configure do |config|
59
+ config.api_version = 'v1'
60
+ config.max_results = 10
61
+ config.timeout = 20
62
+ end
63
+ ```
64
+
65
+ The configuration options are:
66
+ - **api_version**: The version of the Google Books API to be used. The default is `v1`.
67
+ - **cacher**: The cacher to be used. The default is `ActiveSupport::Cache::MemoryStore`.
68
+ - **logger**: The logger to be used. The default is `Logger.new($stdout)`.
69
+ - **max_results**: The maximum number of results to be returned by the API. The default is `10`.
70
+ - **timeout**: The timeout in seconds to be used in the requests. The default is `20`.
71
+
72
+ ### Models
73
+
74
+ The models objective is to centralize the attributes and methods of the Google Books API resources. And make it easy to serialize and validate the data returned by the API. The models are:
75
+
76
+ - **Volume**: Represents a volume in the Google Books API.
77
+
78
+ You can use the models to serialize the data returned by the API, for example:
79
+
80
+ ```ruby
81
+ # frozen_string_literal: true
82
+
83
+ module GoogleBooks
84
+ module Serializers
85
+ class Volume < GoogleBooksCLient::Models::Volume
86
+ def id
87
+ id
88
+ end
89
+
90
+ def kind
91
+ kind
92
+ end
93
+
94
+ def title
95
+ volume_info.title
96
+ end
97
+
98
+ def publisher
99
+ volume_info.publisher
100
+ end
101
+ end
102
+ end
103
+ end
104
+
105
+ GoogleBooks::Serializers::Volume.serialize(volume)
106
+ ```
107
+
108
+ ### Resources
109
+
110
+ The resources objective is to centralize the requests and communications with the Google Books API. The resources are:
111
+
112
+ - **Volumes**: Represents the volumes resource in the Google Books API.
113
+
114
+ You can use the resources to make requests to the API, for example:
115
+
116
+ ```ruby
117
+ GoogleBooksClient::Resources::Volumes.list_by_isbn('8532516262')
118
+
119
+ GoogleBooksClient::Resources::Volumes.list_by_title('Coraline')
120
+ ```
121
+
122
+ A full list of the available methods for each resource class can be found in the [resources documentation](doc/resources.md).
22
123
 
23
124
  ## Development
24
125
 
25
- 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.
126
+ ```bash
127
+ docker-compose build google_books_client # To build the image
128
+ docker-compose up -d google_books_client # To start the container detached
129
+ docker-compose exec google_books_client bash # To access the container
130
+ ```
131
+
132
+ ## Tools
26
133
 
27
- 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).
134
+ The tools can be used inside the container or locally.
135
+
136
+ ```bash
137
+ ./bin/setup # To install dependencies
138
+ ./bin/console # To start the pry with the gem loaded
139
+ ./bin/test # To run the tests, rubocop and coverage
140
+ ```
28
141
 
29
142
  ## Contributing
30
143
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/google_books_client. 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]/google_books_client/blob/master/CODE_OF_CONDUCT.md).
144
+ Bug reports and pull requests are welcome on GitHub at https://github.com/betosardinha/google_books_client. 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/betosardinha/google_books_client/blob/master/CODE_OF_CONDUCT.md).
145
+
146
+ ## Versioning
147
+
148
+ This project uses [Semantic Versioning](https://semver.org/).
149
+
150
+ For a new release, update the version number in `lib/google_books_client/version.rb`, and then create a new release on GitHub. It will automatically be published to [RubyGems](https://rubygems.org/gems/google_books_client).
32
151
 
33
152
  ## License
34
153
 
@@ -36,4 +155,17 @@ The gem is available as open source under the terms of the [MIT License](https:/
36
155
 
37
156
  ## Code of Conduct
38
157
 
39
- Everyone interacting in the Google::Books::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/google_books_client/blob/master/CODE_OF_CONDUCT.md).
158
+ Everyone interacting in the Google::Books::Client project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/betosardinha/google_books_client/blob/master/CODE_OF_CONDUCT.md).
159
+
160
+ ## Contact
161
+
162
+ If you have any questions about the project, please contact me at:
163
+ - Email: [sardinhabeto55@gmail.com](mailto:sardinhabeto55@gmail.com)
164
+ - Linkedin: [betosardinha](https://www.linkedin.com/in/betosardinha/)
165
+ - Twitter: [sardinhabeto](https://twitter.com/sardinhabeto)
166
+
167
+ ## Support
168
+
169
+ If this project helped you, please consider giving it a star. It will mean a lot to me.
170
+
171
+ And if you consider my work valuable for your projects, you can support me on [Buy Me a Coffee](https://www.buymeacoffee.com/betosardinha).
data/doc/resources.md ADDED
@@ -0,0 +1,128 @@
1
+ # Volumes
2
+
3
+ ## `show`
4
+ - Returns a Volume resource based on the ID.
5
+ - **Parameters**:
6
+ - `volume_id`: The ID of the volume to be returned (mandatory).
7
+
8
+ ```ruby
9
+ GoogleBooksClient::Resources::Volumes.show('id')
10
+ ```
11
+
12
+ ## `list`
13
+ - Returns a list of Volume resources based on the parameters.
14
+ - **Parameters**:
15
+ - `params`: The params query to be used in the search (mandatory).
16
+
17
+ ```ruby
18
+ GoogleBooksClient::Resources::Volumes.list({ q: 'inauthor:tolkien+intitle:lord', startIndex: 0 })
19
+ ```
20
+
21
+ ## `list_by_query`
22
+ - Returns a list of Volume resources based on the query.
23
+ - **Parameters**:
24
+ - `query`: The query to be used in the search (mandatory).
25
+ - `start_index`: The index of the first result to return (optional, default: 0).
26
+ - `params`: Extra params to be used in the search (optional, default: {}).
27
+
28
+ ```ruby
29
+ GoogleBooksClient::Resources::Volumes.list_by_query('inauthor:tolkien+intitle:lord', start_index: 0)
30
+ ```
31
+
32
+ ## `list_volumes`
33
+ - Returns a list of Volume resources based on a search hash.
34
+ - **Parameters**:
35
+ - `search_hash`: The search hash to be used in the search (mandatory).
36
+ - `start_index`: The index of the first result to return (optional, default: 0).
37
+ - `params`: Extra params to be used in the search (optional, default: {}).
38
+
39
+ ```ruby
40
+ GoogleBooksClient::Resources::Volumes.list_volumes({ title: 'lord', author: 'tolkien' })
41
+ ```
42
+
43
+ ```ruby
44
+ # search_hash available parameters
45
+ {
46
+ title: 'lord',
47
+ author: 'tolkien',
48
+ publisher: 'harper',
49
+ subject: 'fantasy',
50
+ isbn: '9788532516264',
51
+ lccn: '2001025331',
52
+ oclc: '123456789',
53
+ }
54
+ ```
55
+
56
+ ## `list_by_title`
57
+ - Returns a list of Volume resources based on the title.
58
+ - **Parameters**:
59
+ - `title`: The title to be used in the search (mandatory).
60
+ - `start_index`: The index of the first result to return (optional, default: 0).
61
+ - `params`: Extra params to be used in the search (optional, default: {}).
62
+
63
+ ```ruby
64
+ GoogleBooksClient::Resources::Volumes.list_by_title('lord')
65
+ ```
66
+
67
+ ## `list_by_author`
68
+ - Returns a list of Volume resources based on the author.
69
+ - **Parameters**:
70
+ - `author`: The author to be used in the search (mandatory).
71
+ - `start_index`: The index of the first result to return (optional, default: 0).
72
+ - `params`: Extra params to be used in the search (optional, default: {}).
73
+
74
+ ```ruby
75
+ GoogleBooksClient::Resources::Volumes.list_by_author('tolkien')
76
+ ```
77
+
78
+ ## `list_by_publisher`
79
+ - Returns a list of Volume resources based on the publisher.
80
+ - **Parameters**:
81
+ - `publisher`: The publisher to be used in the search (mandatory).
82
+ - `start_index`: The index of the first result to return (optional, default: 0).
83
+ - `params`: Extra params to be used in the search (optional, default: {}).
84
+
85
+ ```ruby
86
+ GoogleBooksClient::Resources::Volumes.list_by_publisher('harper')
87
+ ```
88
+
89
+ ## `list_by_subject`
90
+ - Returns a list of Volume resources based on the subject.
91
+ - **Parameters**:
92
+ - `subject`: The subject to be used in the search (mandatory).
93
+ - `start_index`: The index of the first result to return (optional, default: 0).
94
+ - `params`: Extra params to be used in the search (optional, default: {}).
95
+
96
+ ```ruby
97
+ GoogleBooksClient::Resources::Volumes.list_by_subject('fantasy')
98
+ ```
99
+
100
+ ## `list_by_isbn`
101
+ - Returns a list of Volume resources based on the ISBN.
102
+ - **Parameters**:
103
+ - `isbn`: The ISBN to be used in the search (mandatory).
104
+ - `params`: Extra params to be used in the search (optional, default: {}).
105
+
106
+ ```ruby
107
+ GoogleBooksClient::Resources::Volumes.list_by_isbn('9788532516264')
108
+ ```
109
+
110
+ ## `list_by_lccn`
111
+ - Returns a list of Volume resources based on the LCCN.
112
+ - **Parameters**:
113
+ - `lccn`: The LCCN to be used in the search (mandatory).
114
+ - `params`: Extra params to be used in the search (optional, default: {}).
115
+
116
+ ```ruby
117
+ GoogleBooksClient::Resources::Volumes.list_by_lccn('2001025331')
118
+ ```
119
+
120
+ ## `list_by_oclc`
121
+ - Returns a list of Volume resources based on the OCLC.
122
+ - **Parameters**:
123
+ - `oclc`: The OCLC to be used in the search (mandatory).
124
+ - `params`: Extra params to be used in the search (optional, default: {}).
125
+
126
+ ```ruby
127
+ GoogleBooksClient::Resources::Volumes.list_by_oclc('123456789')
128
+ ```
@@ -1,21 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "logger"
4
+
3
5
  module GoogleBooksClient
4
6
  class Configuration
5
- attr_accessor :token, :host, :api_version, :api_schema_registry
7
+ attr_writer :api_version, :cacher, :logger, :max_results, :timeout
8
+
9
+ def api_host
10
+ "#{host}/#{api_name}/#{api_version}"
11
+ end
6
12
 
7
- attr_writer :cacher, :logger, :timeout
13
+ def api_name
14
+ default_api_name
15
+ end
16
+
17
+ def api_version
18
+ @api_version || default_api_version
19
+ end
8
20
 
9
21
  def cacher
10
22
  @cacher || default_cacher
11
23
  end
12
24
 
25
+ def host
26
+ default_host
27
+ end
28
+
13
29
  def logger
14
30
  @logger || default_logger
15
31
  end
16
32
 
17
- def api_host
18
- "#{host}/api/#{api_version}"
33
+ def max_results
34
+ @max_results || 10
19
35
  end
20
36
 
21
37
  def timeout
@@ -24,10 +40,22 @@ module GoogleBooksClient
24
40
 
25
41
  private
26
42
 
43
+ def default_api_name
44
+ "books"
45
+ end
46
+
47
+ def default_api_version
48
+ "v1"
49
+ end
50
+
27
51
  def default_cacher
28
52
  @default_cacher ||= ActiveSupport::Cache::MemoryStore.new
29
53
  end
30
54
 
55
+ def default_host
56
+ "https://www.googleapis.com"
57
+ end
58
+
31
59
  def default_logger
32
60
  @default_logger ||= Logger.new($stdout)
33
61
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+
5
+ module GoogleBooksClient
6
+ class HttpClientAdapter
7
+ def get(url, params = {}, headers = {})
8
+ connection.get(url, base_params.merge(params), base_headers.merge(headers))
9
+ end
10
+
11
+ protected
12
+
13
+ def base_url
14
+ GoogleBooksClient.configuration.api_host
15
+ end
16
+
17
+ def max_results
18
+ GoogleBooksClient.configuration.max_results
19
+ end
20
+
21
+ def base_params
22
+ {
23
+ maxResults: max_results
24
+ }
25
+ end
26
+
27
+ def base_headers
28
+ {
29
+ "Content-Type" => "application/json",
30
+ "Accept" => "application/json"
31
+ }
32
+ end
33
+
34
+ def authentication
35
+ { type: :none }
36
+ end
37
+
38
+ def connection
39
+ @connection ||= Faraday.new do |faraday|
40
+ faraday_auth(faraday)
41
+ faraday_options(faraday)
42
+ faraday_request(faraday)
43
+ faraday_response(faraday)
44
+ faraday.adapter Faraday.default_adapter
45
+ end
46
+ end
47
+
48
+ def faraday_auth(_faraday)
49
+ case authentication[:type]
50
+ when :none
51
+ nil
52
+ else
53
+ raise NotImplementedError, "Unknown authentication type: #{authentication[:type]}"
54
+ end
55
+ end
56
+
57
+ def faraday_options(faraday)
58
+ faraday.url_prefix = base_url
59
+ faraday.options.timeout = GoogleBooksClient.configuration.timeout
60
+ faraday.options.open_timeout = GoogleBooksClient.configuration.timeout
61
+ end
62
+
63
+ def faraday_request(faraday)
64
+ faraday.request :json
65
+ end
66
+
67
+ def faraday_response(faraday)
68
+ faraday.response :json
69
+ faraday.response :logger, GoogleBooksClient.configuration.logger, { headers: false, bodies: true }
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "delegate"
4
+
5
+ module GoogleBooksClient
6
+ module Models
7
+ class Base < SimpleDelegator
8
+ def self.serialize(entity)
9
+ return serialize_all(entity) if entity.respond_to?(:each)
10
+
11
+ new(entity).as_json
12
+ end
13
+
14
+ def self.serialize_all(entities)
15
+ entities.map { |entity| serialize(entity) }
16
+ end
17
+
18
+ def as_json
19
+ required_fields_hash.tap do |hash|
20
+ hash.merge!(optional_fields)
21
+
22
+ default_additional_params.each do |key, value|
23
+ next hash[key].merge!(value) if hash[key].is_a?(Hash)
24
+
25
+ hash[key] = value
26
+ end
27
+ end.as_json
28
+ end
29
+
30
+ def required_fields
31
+ raise NoMethodError, "You must implement #{self.class}##{__method__}"
32
+ end
33
+
34
+ def optional_fields
35
+ {}
36
+ end
37
+
38
+ def default_additional_params
39
+ {}
40
+ end
41
+
42
+ private
43
+
44
+ def required_fields_hash
45
+ validate_presence_of_required_fields!
46
+ validate_presence_of_required_fields_values!
47
+
48
+ {}.tap do |hash|
49
+ required_fields.each do |field|
50
+ hash.store(field.to_sym, send(field.to_sym))
51
+ end
52
+ end
53
+ end
54
+
55
+ def validate_presence_of_required_fields!
56
+ required_fields.each do |field|
57
+ next if self.class.instance_methods(false).include?(field.to_sym)
58
+
59
+ raise NoMethodError, "Missing required field #{field} for #{self.class}"
60
+ end
61
+ end
62
+
63
+ def validate_presence_of_required_fields_values!
64
+ required_fields.each do |field|
65
+ next unless send(field.to_sym).nil?
66
+
67
+ raise NoMethodError, "Missing required field #{field} value for #{self.class}"
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoogleBooksClient
4
+ module Models
5
+ class Volume < Base
6
+ def required_fields
7
+ %i[id kind volume_info]
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "models/base"
4
+ require_relative "models/volume"
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoogleBooksClient
4
+ module Resources
5
+ class Volumes < HttpClientAdapter
6
+ def self.show(volume_id)
7
+ new.get("volumes/#{volume_id}")
8
+ end
9
+
10
+ def self.list(params = {})
11
+ new.get("volumes", params)
12
+ end
13
+
14
+ def self.list_by_query(query, params: {}, start_index: 0)
15
+ list(params.merge({ q: query, startIndex: start_index }))
16
+ end
17
+
18
+ def self.list_volumes(search_hash, params: {}, start_index: 0)
19
+ list_by_query(generate_query(search_hash), params: params, start_index: start_index)
20
+ end
21
+
22
+ def self.list_by_title(title, params: {}, start_index: 0)
23
+ list_volumes({ title: title }, params: params, start_index: start_index)
24
+ end
25
+
26
+ def self.list_by_author(author, params: {}, start_index: 0)
27
+ list_volumes({ author: author }, params: params, start_index: start_index)
28
+ end
29
+
30
+ def self.list_by_publisher(publisher, params: {}, start_index: 0)
31
+ list_volumes({ publisher: publisher }, params: params, start_index: start_index)
32
+ end
33
+
34
+ def self.list_by_subject(subject, params: {}, start_index: 0)
35
+ list_volumes({ subject: subject }, params: params, start_index: start_index)
36
+ end
37
+
38
+ def self.list_by_isbn(isbn, params: {})
39
+ list_volumes({ isbn: isbn }, params: params)
40
+ end
41
+
42
+ def self.list_by_lccn(lccn, params: {})
43
+ list_volumes({ lccn: lccn }, params: params)
44
+ end
45
+
46
+ def self.list_by_oclc(oclc, params: {})
47
+ list_volumes({ oclc: oclc }, params: params)
48
+ end
49
+
50
+ def self.generate_query(search_hash)
51
+ search_hash.map do |search_type, search_value|
52
+ case search_type
53
+ when :title, :author, :publisher
54
+ "in#{search_type}:#{search_value}"
55
+ when :subject, :isbn, :lccn, :oclc
56
+ "#{search_type}:#{search_value}"
57
+ else
58
+ raise ArgumentError, "Invalid search type"
59
+ end
60
+ end.join("+")
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "resources/volumes"
@@ -2,5 +2,5 @@
2
2
 
3
3
  module GoogleBooksClient
4
4
  NAME = "google_books_client"
5
- VERSION = "0.0.0"
5
+ VERSION = "0.1.0"
6
6
  end
@@ -6,6 +6,9 @@ require "active_support/core_ext/hash"
6
6
 
7
7
  require_relative "google_books_client/version"
8
8
  require_relative "google_books_client/configuration"
9
+ require_relative "google_books_client/http_client_adapter"
10
+ require_relative "google_books_client/models"
11
+ require_relative "google_books_client/resources"
9
12
 
10
13
  module GoogleBooksClient
11
14
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_books_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beto Sardinha
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-25 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,10 +114,17 @@ files:
114
114
  - Makefile
115
115
  - README.md
116
116
  - Rakefile
117
+ - doc/resources.md
117
118
  - docker-compose.yml
118
119
  - google-books-client.gemspec
119
120
  - lib/google_books_client.rb
120
121
  - lib/google_books_client/configuration.rb
122
+ - lib/google_books_client/http_client_adapter.rb
123
+ - lib/google_books_client/models.rb
124
+ - lib/google_books_client/models/base.rb
125
+ - lib/google_books_client/models/volume.rb
126
+ - lib/google_books_client/resources.rb
127
+ - lib/google_books_client/resources/volumes.rb
121
128
  - lib/google_books_client/version.rb
122
129
  homepage: https://github.com/betosardinha/google_books_client
123
130
  licenses: