Merge pull request #69 from jedmund/info_endpoints
Add endpoints for getting info about canonical items
This commit is contained in:
commit
2dd6dbae57
5 changed files with 61 additions and 0 deletions
19
app/controllers/api/v1/characters_controller.rb
Normal file
19
app/controllers/api/v1/characters_controller.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Api
|
||||||
|
module V1
|
||||||
|
class CharactersController < Api::V1::ApiController
|
||||||
|
before_action :set
|
||||||
|
|
||||||
|
def show
|
||||||
|
render json: CharacterBlueprint.render(@character)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set
|
||||||
|
@character = Character.where(granblue_id: params[:id]).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
19
app/controllers/api/v1/summons_controller.rb
Normal file
19
app/controllers/api/v1/summons_controller.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Api
|
||||||
|
module V1
|
||||||
|
class SummonsController < Api::V1::ApiController
|
||||||
|
before_action :set
|
||||||
|
|
||||||
|
def show
|
||||||
|
render json: SummonBlueprint.render(@summon)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set
|
||||||
|
@summon = Summon.where(granblue_id: params[:id]).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
19
app/controllers/api/v1/weapons_controller.rb
Normal file
19
app/controllers/api/v1/weapons_controller.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Api
|
||||||
|
module V1
|
||||||
|
class WeaponsController < Api::V1::ApiController
|
||||||
|
before_action :set
|
||||||
|
|
||||||
|
def show
|
||||||
|
render json: WeaponBlueprint.render(@weapon)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set
|
||||||
|
@weapon = Weapon.where(granblue_id: params[:id]).first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -11,6 +11,9 @@ Rails.application.routes.draw do
|
||||||
resources :grid_weapons, only: %i[update destroy]
|
resources :grid_weapons, only: %i[update destroy]
|
||||||
resources :grid_characters, only: %i[update destroy]
|
resources :grid_characters, only: %i[update destroy]
|
||||||
resources :grid_summons, only: %i[update destroy]
|
resources :grid_summons, only: %i[update destroy]
|
||||||
|
resources :weapons, only: :show
|
||||||
|
resources :characters, only: :show
|
||||||
|
resources :summons, only: :show
|
||||||
resources :favorites, only: [:create]
|
resources :favorites, only: [:create]
|
||||||
|
|
||||||
get 'version', to: 'api#version'
|
get 'version', to: 'api#version'
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_31_084343) do
|
||||||
enable_extension "pg_trgm"
|
enable_extension "pg_trgm"
|
||||||
enable_extension "pgcrypto"
|
enable_extension "pgcrypto"
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
enable_extension "timescaledb"
|
||||||
|
|
||||||
create_table "app_updates", primary_key: "updated_at", id: :datetime, force: :cascade do |t|
|
create_table "app_updates", primary_key: "updated_at", id: :datetime, force: :cascade do |t|
|
||||||
t.string "update_type", null: false
|
t.string "update_type", null: false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue