bgg_remote 0.1.0 → 0.1.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: b13c746ba96509bfa7959c390fb604f177eb5c0663312c0038e1485a984ed7cf
4
- data.tar.gz: c7b7aba64f3036947cede0af9c7828c703e043066f1cfd30d10a7cc57e8f52f8
3
+ metadata.gz: 1977a9ebe52c8ba3ef59e64b1c8f8e9ffc969533f691b49a957ad8c3d585a706
4
+ data.tar.gz: d1005a548caf93bd7aedd62fad9b10a9a76d4b191db3179cd035b65d6618df37
5
5
  SHA512:
6
- metadata.gz: c3511bc789b8823dfdc6ef5648892bb40f29d3fca5be45589981b0a8c0f51bca6bf8f4df24898f57d33a909db84d28ead90828f5a4464d0099002e4c860da9a4
7
- data.tar.gz: b6e799f7bc9b8225d4634b39376a5347e601ac4ab631dce5f8a08d0ba796501a4f2126bc3028179ae9533d35274d054c398df098d7553db546c36be72354b101
6
+ metadata.gz: 736a18f22165802ed8aeb19bdbd20cc5335d27e25be967b6747fe108b9728d962ca968ef6ad1b2e7eb6ea7d625c04fbf3884354d5bce267148ccd002dd1ac346
7
+ data.tar.gz: a7898088af1c98cc58db08da212e1ab069bc35694cb0015d73543e286f49989cbef75ceb83aa34805869eaba7406fb82451af40fa74c8c6ed46c738e5a97ab8e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2025-12-22
3
+ ## [0.1.2] - 2026-02-10
4
+ - Relax `httparty` dependency to `>= 0.23.2, < 0.25`.
5
+ - Make token optional in `BggRemote::Client` initialization.
6
+ - Send `Authorization` header only when a token is present.
7
+
8
+ ## [0.1.1] - 2025-12-29
9
+ - Add support for plays lookup without type
10
+ - Improve header handling when token is empty
11
+ - Internal refactor in client initialization
4
12
 
13
+ ## [0.1.0] - 2025-12-22
5
14
  - Initial release
data/README.md CHANGED
@@ -1,43 +1,82 @@
1
1
  # BggRemote
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ BggRemote is a Ruby client for the [BoardGameGeek XML API](https://boardgamegeek.com/wiki/page/BGG_XML_API2), providing easy access to board game data. It can optionally parse XML responses into Ruby hashes for easier usage.
4
4
 
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/bgg_remote`. To experiment with that code, run `bin/console` for an interactive prompt.
6
5
 
7
6
  ## Installation
8
7
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_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.
8
+ Add this line to your application's `Gemfile`:
10
9
 
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
10
+ ```ruby
11
+ gem "bgg_remote", "~> 0.1.0"
15
12
  ```
13
+ then execute ```bundle install```
14
+ Or install it yourself as a gem ``` gem install bgg_remote ```
16
15
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
16
+ ## Usage
18
17
 
19
- ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
+ ```ruby
19
+ BggRemote.configure do |config|
20
+ config.token = "your-api-token"
21
+ config.timeout = 8 # optional, default is 10
22
+ config.convert_to_hash = true # optional, set to false if you want raw XML
23
+ end
24
+
25
+ # Alternatively, minimal configuration:
26
+ # BggRemote.configure do |config|
27
+ # config.token = "your-api-token"
28
+ # end
29
+
30
+ bgg_api = BggRemote.api
31
+ bgg_api.thing(id: 21) # Fetch a boardgame by ID
32
+ bgg_api.user(name: "geek") # Fetch a user by name
21
33
  ```
22
34
 
23
- ## Usage
35
+ You can also instantiate the client manually if you prefer:
24
36
 
25
- TODO: Write usage instructions here
37
+ ```ruby
38
+ client = BggRemote::Client.new("your_api_token", timeout: 21)
39
+ bgg_api = BggRemote::Api.new(client, convert_to_hash: true)
40
+ # convert_to_hash and timeout are optional
26
41
 
27
- ## Development
42
+ bgg_api.thing(id: 222)
43
+ ```
28
44
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+ ## API Endpoints
46
+ - thing(id:, **params)
47
+ - family(id:, type: nil)
48
+ - forum_list(id:, type: nil)
49
+ - forum(id:, page: nil)
50
+ - thread(id:, **params)
51
+ - user(name:, **params)
52
+ - guild(id:, **params)
53
+ - search(query:, **params)
54
+ - plays(username: nil, id: nil, **params) – validates at least one of username or id
55
+ - hot_items(type:)
56
+ - collection(username:, **params)
57
+
58
+ **Notes:**
59
+ - `**params` can be used for extra parameters, e.g., `bgg_api.thing(id: 3214, stats: 1)`.
60
+ - `stats` is an example of an extra parameter.
61
+ - **Sending Multiple Parameters** \
62
+ Some endpoints support multiple values ​​for a single parameter, such as `id` or `type`. You can pass:
63
+
64
+ ```ruby
65
+ #Multiple values as a comma-separated string:
66
+ BggRemote.api.family(id: "20,111815", type: "boardgamefamily,rpg")
67
+ ```
30
68
 
31
- 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).
69
+ ## Details
70
+ - The API client also provides error classes for retry logic if needed.
71
+ See: [error.rb](https://github.com/nicollinoxx/bgg_remote/blob/master/lib/bgg_remote/error.rb)
72
+ - This gem uses [HTTParty](https://github.com/jnunemaker/httparty) to make HTTP requests and [Crack](https://github.com/jnunemaker/crack) to parse XML into hashes. You can choose to receive raw XML instead by setting `convert_to_hash = false`.
73
+ - The gem does not process the XML content itself; it only wraps HTTP requests
74
+ and optionally converts XML to Ruby hashes.
32
75
 
33
76
  ## Contributing
34
77
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bgg_remote. 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]/bgg_remote/blob/master/CODE_OF_CONDUCT.md).
78
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nicollinoxx/bgg_remote. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
36
79
 
37
80
  ## License
38
81
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
-
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the BggRemote project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bgg_remote/blob/master/CODE_OF_CONDUCT.md).
82
+ This gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -40,10 +40,10 @@ class BggRemote::Api
40
40
  request("search", query: query, **params)
41
41
  end
42
42
 
43
- def plays(username: nil, id: nil, type: nil, **params)
43
+ def plays(username: nil, id: nil, **params)
44
44
  validate_at_least_one_of!(username: username, id: id)
45
45
 
46
- request("plays", username: username, id: id, type: type, **params)
46
+ request("plays", username: username, id: id, **params)
47
47
  end
48
48
 
49
49
  def hot_items(type:)
@@ -17,11 +17,9 @@ class BggRemote::Client
17
17
  422 => BggRemote::Error::UnprocessableEntity
18
18
  }.freeze
19
19
 
20
- def initialize(token, timeout: 10)
21
- @token = token
22
- @timeout = timeout || 10
23
-
24
- raise BggRemote::Error::MissingToken, "token is required" if token.nil?
20
+ def initialize(token = nil, timeout: 10)
21
+ @token = token
22
+ @timeout = timeout
25
23
  end
26
24
 
27
25
  def perform_request(path, **params)
@@ -34,7 +32,7 @@ class BggRemote::Client
34
32
  private
35
33
 
36
34
  def headers
37
- return { "Accept" => "application/xml" } unless token
35
+ return { "Accept" => "application/xml" } if token.nil? || token.empty?
38
36
  { "Accept" => "application/xml", "Authorization" => "Bearer #{token}" }
39
37
  end
40
38
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BggRemote
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/bgg_remote.rb CHANGED
@@ -12,11 +12,11 @@ module BggRemote
12
12
  attr_reader :api
13
13
 
14
14
  def configure
15
- config ||= Config.new
15
+ config = Config.new(timeout: 10, convert_to_hash: true)
16
16
  yield config if block_given?
17
17
 
18
18
  client = Client.new(config.token, timeout: config.timeout)
19
- @api = Api.new(client, convert_to_hash: config.convert_to_hash)
19
+ @api = Api.new(client, convert_to_hash: config.convert_to_hash)
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,29 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bgg_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nícolas Amaral
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-12-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: httparty
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - '='
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: 0.23.2
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '0.25'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - '='
26
+ - - ">="
25
27
  - !ruby/object:Gem::Version
26
28
  version: 0.23.2
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '0.25'
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: crack
29
34
  requirement: !ruby/object:Gem::Requirement
@@ -80,8 +85,8 @@ dependencies:
80
85
  - - '='
81
86
  - !ruby/object:Gem::Version
82
87
  version: '3.26'
83
- description: A simple Ruby interface to the BoardGameGeek XML API2, providing easy
84
- access to board game data with XML parsing to Ruby hashes.
88
+ description: A simple Ruby client to the BoardGameGeek XML API2, providing easy access
89
+ to board game data with XML parsing to Ruby hashes.
85
90
  email:
86
91
  - nicolasalmeida321@gmail.com
87
92
  executables: []
@@ -107,7 +112,6 @@ metadata:
107
112
  homepage_uri: https://github.com/nicollinoxx/bgg_remote
108
113
  source_code_uri: https://github.com/nicollinoxx/bgg_remote
109
114
  changelog_uri: https://github.com/nicollinoxx/bgg_remote/blob/main/CHANGELOG.md
110
- post_install_message:
111
115
  rdoc_options: []
112
116
  require_paths:
113
117
  - lib
@@ -122,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
126
  - !ruby/object:Gem::Version
123
127
  version: '0'
124
128
  requirements: []
125
- rubygems_version: 3.5.16
126
- signing_key:
129
+ rubygems_version: 3.6.9
127
130
  specification_version: 4
128
131
  summary: Ruby client for the BoardGameGeek XML API2.
129
132
  test_files: []