Add routes to pull data for individual objects in a party
This commit is contained in:
parent
1856942bb8
commit
5ea9f367c1
5 changed files with 44 additions and 0 deletions
|
|
@ -26,6 +26,21 @@ class Api::V1::PartiesController < Api::V1::ApiController
|
||||||
def destroy
|
def destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def weapons
|
||||||
|
render_not_found_response if @party.nil?
|
||||||
|
render :weapons, status: :ok
|
||||||
|
end
|
||||||
|
|
||||||
|
def summons
|
||||||
|
render_not_found_response if @party.nil?
|
||||||
|
render :summons, status: :ok
|
||||||
|
end
|
||||||
|
|
||||||
|
def characters
|
||||||
|
render_not_found_response if @party.nil?
|
||||||
|
render :characters, status: :ok
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def random_string
|
def random_string
|
||||||
|
|
|
||||||
7
app/views/api/v1/parties/characters.json.rabl
Normal file
7
app/views/api/v1/parties/characters.json.rabl
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
object @party
|
||||||
|
|
||||||
|
attributes :id, :user_id, :shortcode
|
||||||
|
|
||||||
|
node :characters do |p|
|
||||||
|
partial('grid_characters/base', :object => p.characters)
|
||||||
|
end
|
||||||
7
app/views/api/v1/parties/summons.json.rabl
Normal file
7
app/views/api/v1/parties/summons.json.rabl
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
object @party
|
||||||
|
|
||||||
|
attributes :id, :user_id, :shortcode
|
||||||
|
|
||||||
|
node :summons do |p|
|
||||||
|
partial('grid_summons/base', :object => p.summons)
|
||||||
|
end
|
||||||
11
app/views/api/v1/parties/weapons.json.rabl
Normal file
11
app/views/api/v1/parties/weapons.json.rabl
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
object @party
|
||||||
|
|
||||||
|
attributes :id, :user_id, :shortcode
|
||||||
|
|
||||||
|
node :is_extra do |p|
|
||||||
|
p.extra
|
||||||
|
end
|
||||||
|
|
||||||
|
node :weapons do |p|
|
||||||
|
partial('grid_weapons/base', :object => p.weapons)
|
||||||
|
end
|
||||||
|
|
@ -9,6 +9,10 @@ Rails.application.routes.draw do
|
||||||
resources :parties, only: [:index, :create, :show, :destroy]
|
resources :parties, only: [:index, :create, :show, :destroy]
|
||||||
resources :users, only: [:create, :show]
|
resources :users, only: [:create, :show]
|
||||||
|
|
||||||
|
get 'parties/:id/weapons', to: 'parties#weapons'
|
||||||
|
get 'parties/:id/summons', to: 'parties#summons'
|
||||||
|
get 'parties/:id/characters', to: 'parties#characters'
|
||||||
|
|
||||||
post 'check/email', to: 'users#check_email'
|
post 'check/email', to: 'users#check_email'
|
||||||
post 'check/username', to: 'users#check_username'
|
post 'check/username', to: 'users#check_username'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue