Add ConflictBlueprint
This should be used for character conflicts (implemented) and weapon conflicts (to-do in a future PR)
This commit is contained in:
parent
bf04ddcbba
commit
33775539cd
1 changed files with 31 additions and 0 deletions
31
app/blueprints/api/v1/conflict_blueprint.rb
Normal file
31
app/blueprints/api/v1/conflict_blueprint.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Api
|
||||||
|
module V1
|
||||||
|
class ConflictBlueprint < ApiBlueprint
|
||||||
|
field :position do
|
||||||
|
options[:incoming_position]
|
||||||
|
end
|
||||||
|
|
||||||
|
view :characters do
|
||||||
|
field :conflicts do
|
||||||
|
GridCharacterBlueprint.render_as_hash(options[:conflict_characters])
|
||||||
|
end
|
||||||
|
|
||||||
|
field :incoming do
|
||||||
|
GridCharacterBlueprint.render_as_hash(options[:incoming_character])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
view :weapons do
|
||||||
|
field :conflicts do
|
||||||
|
GridWeaponBlueprint.render_as_hash(options[:conflict_weapons])
|
||||||
|
end
|
||||||
|
|
||||||
|
field :incoming do
|
||||||
|
GridWeaponBlueprint.render_as_hash(options[:incoming_weapon])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue