An API to help Granblue Fantasy players create and share teams and strategies.
Find a file
Justin Edmund d6300f7aeb
Add first round of tests (#178)
* Install Rspec

* Create .aidigestignore

* Update rails_helper

- Added sections and comments
- Add support for loading via canonical.rb
- Add FactoryBot syntax methods
- Disable SQL logging in test environment

* Move gems around

* Add canonical.rb and test env CSVs

We load these CSVs via canonical.rb when we run tests as a data source for canonical objects.

* Remove RBS for now

This is too much and we need to find the right solution

* Refactor GridSummonsController and add tests

* Create GridSummon factory

* Refactor GridSummon and add documentation and tests

* Create have_error_on.rb

* Update .aidigestignore

* Fix warnings

* Add GridWeapons and Parties factories

* Refactor GridWeapon and add documentation and tests

* Create .rubocop.yml

* Create no_weapon_provided_error.rb

* Refactor GridWeaponsController

- Refactors controller
- Adds YARD documentation
- Adds Rspec tests

* Refactor GridSummonsController

- Refactors controller
- Adds YARD documentation
- Adds Rspec tests

* Enable shoulda/matchers

* Update User factory

* Update party.rb

We moved updating the party's element and extra flag to inside the party. We use an after_commit hook to minimize the amount of queries we're running to do this.

* Update party.rb

We change setting the edit key to use the conditional assignment operator so that it doesn't get overridden when we're running tests. This shouldn't have an effect in production.

* Update api_controller.rb

Change render_unprocessable_entity_response to render the errors hash instead of the exception so that we get more helpful errors.

* Add new errors

Added NoCharacterProvidedError and NoSummonProvidedError

* Add tests and docs to GridCharacter

We added a factory, spec and documentation to the GridCharacter model

* Ensure numericality

* Move enums into GranblueEnums

We don't use these yet, but it gives us a structured place to pull them from.

* Refactor GridCharactersController

- Refactors controller
- Adds YARD documentation
- Adds Rspec tests

* Add debug hook and other small changes

* Update grid_characters_controller.rb

Removes logs

* Update .gitignore

* Update .aidigestignore

* Refactored PartiesController

- Split PartiesController into three concerns
- Implemented testing for PartiesController and two concerns
- Implemented fixes across other files to ensure PartiesController tests pass
- Added Favorites factory

* Implement SimpleCov

* Refactor Party model

- Refactors Party model
- Adds tests
- Adds documentation

* Update granblue_enums.rb

Remove included block
2025-02-12 02:42:30 -08:00
.github Update PULL_REQUEST_TEMPLATE.md (#166) 2025-01-16 00:34:58 -08:00
app Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
bin June 2023 Update (#102) 2023-06-19 03:53:48 -07:00
config Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
db Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
lib Fix image embeds 3 (#176) 2025-01-20 03:55:22 -08:00
log Restart on Rails 2020-09-14 18:30:54 -07:00
public Fix image embeds 3 (#176) 2025-01-20 03:55:22 -08:00
spec Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
storage Restart on Rails 2020-09-14 18:30:54 -07:00
test Restart on Rails 2020-09-14 18:30:54 -07:00
tmp Restart on Rails 2020-09-14 18:30:54 -07:00
vendor Restart on Rails 2020-09-14 18:30:54 -07:00
.aidigestignore Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
.env Hotfix so weapon key search translates ints to arrays (#140) 2023-12-30 06:20:22 -08:00
.gitignore Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
.rspec Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
.rubocop.yml Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
.ruby-gemset Updates to Ruby 3.3.7 (#163) 2025-01-15 21:31:49 -08:00
.ruby-version Updates to Ruby 3.3.7 (#163) 2025-01-15 21:31:49 -08:00
.solargraph.yml Create .solargraph.yml 2020-09-25 10:41:23 -07:00
config.ru Restart on Rails 2020-09-14 18:30:54 -07:00
ENDPOINTS.md Create ENDPOINTS.md (#169) 2025-01-18 03:22:55 -08:00
Gemfile Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
Gemfile.lock Add first round of tests (#178) 2025-02-12 02:42:30 -08:00
LICENSE Create LICENSE (#172) 2025-01-18 03:25:32 -08:00
railway.toml Fix image embeds 3 (#176) 2025-01-20 03:55:22 -08:00
Rakefile Restart on Rails 2020-09-14 18:30:54 -07:00
README.md Update README.md (#171) 2025-01-18 03:25:40 -08:00

Hensei API

Project Overview

Hensei is a Ruby on Rails API for managing Granblue Fantasy party configurations, providing comprehensive tools for team building, character management, and game data tracking.

Prerequisites

  • Ruby 3.3.7
  • Rails 8.0.1
  • PostgreSQL
  • AWS S3 Account (for image storage)

System Dependencies

  • Ruby version manager (rbenv or RVM recommended)
  • Bundler
  • PostgreSQL
  • Redis (for background jobs)
  • ImageMagick (for image processing)

Initial Setup

1. Clone the Repository

git clone https://github.com/your-organization/hensei-api.git
cd hensei-api

2. Install Ruby

Ensure you have Ruby 3.3.7 installed. If using rbenv:

rbenv install 3.3.7
rbenv local 3.3.7

3. Install Dependencies

gem install bundler
bundle install

4. Database Configuration

  1. Ensure PostgreSQL is running
  2. Create the database configuration:
rails db:create
rails db:migrate

5. AWS S3 Configuration

Hensei requires an AWS S3 bucket for storing images. Configure your credentials:

EDITOR=vim rails credentials:edit

Add the following structure to your credentials:

aws:
  s3:
    bucket: your-bucket-name
    access_key_id: your-access-key
    secret_access_key: your-secret-key
    region: your-aws-region

6. Run Initial Data Import (Optional)

rails data:import

7. Start the Server

rails server

Environment Variables

While most configurations use Rails credentials, you may need to set:

  • DATABASE_URL
  • RAILS_MASTER_KEY
  • REDIS_URL

Performance Considerations

  • Use Redis for caching
  • Background jobs managed by Sidekiq
  • Ensure PostgreSQL is optimized for full-text search

Security

  • Always use rails credentials:edit for sensitive information
  • Keep your master.key secure and out of version control
  • Regularly update dependencies

Deployment

Recommended platforms:

  • Railway.app (We use this)i98-i
  • Heroku
  • DigitalOcean App Platform

Deployment steps:

  1. Precompile assets: rails assets:precompile
  2. Run migrations: rails db:migrate
  3. Start the server with a production-ready web server like Puma

Troubleshooting

  • Ensure all credentials are correctly set
  • Check PostgreSQL and Redis connections
  • Verify AWS S3 bucket permissions

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0-only) with additional non-commercial restrictions.

Key points:

  • You are free to use and modify the software for non-commercial purposes
  • Any modifications must be shared under the same license
  • You must provide attribution to the original authors
  • No warranty is provided

See the LICENSE file for full details.

Contact

For support, please open an issue on the GitHub repository.