Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/card_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
class CardSet < ApplicationRecord
belongs_to :card_cycle
belongs_to :card_set_type

has_many :printings
end
3 changes: 3 additions & 0 deletions app/resources/api/v3/public/card_cycle_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module Public
class Api::V3::Public::CardCycleResource < JSONAPI::Resource
attributes :name, :description, :updated_at
key_type :string

has_many :card_sets
paginator :none
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions app/resources/api/v3/public/card_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ class Api::V3::Public::CardResource < JSONAPI::Resource
# TODO(plural): get the relationships in here and possibly replace the keywords field.
attributes :name, :card_type_id, :side_id, :faction_id, :advancement_requirement, :agenda_points, :base_link, :cost, :deck_limit, :influence_cost, :influence_limit, :memory_cost, :minimum_deck_size, :strength, :text, :trash_cost, :uniqueness, :keywords, :updated_at
key_type :string

has_one :card_type
has_one :faction
has_one :side
has_many :subtypes
has_many :printings
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions app/resources/api/v3/public/card_set_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ class Api::V3::Public::CardSetResource < JSONAPI::Resource
# TODO(plural): Add relationships in here.
attributes :name, :date_release, :size, :card_cycle_id, :card_set_type_id, :updated_at
key_type :string

paginator :none

has_one :card_cycle
has_many :printings
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions app/resources/api/v3/public/card_set_type_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module Public
class Api::V3::Public::CardSetTypeResource < JSONAPI::Resource
attributes :name, :description, :updated_at
key_type :string

has_many :card_sets
paginator :none
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions app/resources/api/v3/public/card_type_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module Public
class Api::V3::Public::CardTypeResource < JSONAPI::Resource
attributes :name, :updated_at
key_type :string

has_many :cards
paginator :none
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/resources/api/v3/public/faction_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module Public
class Api::V3::Public::FactionResource < JSONAPI::Resource
attributes :name, :is_mini, :updated_at
key_type :string

paginator :none

has_many :cards
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions app/resources/api/v3/public/printing_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class Api::V3::Public::PrintingResource < JSONAPI::Resource
# TODO: add relationships in here.
attributes :card_id, :card_set_id, :printed_text, :printed_uniqueness, :flavor, :illustrator, :position, :quantity, :date_release, :updated_at
key_type :string

has_one :card_set
has_one :card
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/resources/api/v3/public/side_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module Public
class Api::V3::Public::SideResource < JSONAPI::Resource
attributes :name, :updated_at
key_type :string

paginator :none

has_many :cards
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion app/resources/api/v3/public/subtype_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ class Api::V3::Public::SubtypeResource < JSONAPI::Resource
attributes :name, :updated_at
key_type :string

paginator :offset
paginator :none

has_many :cards
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions config/initializers/jsonapi-resources.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
JSONAPI.configure do |config|
config.default_paginator = :offset

config.default_page_size = 100
config.maximum_page_size = 1000
end