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
22 changes: 22 additions & 0 deletions app/resources/card_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ class CardResource < ApplicationResource # rubocop:disable Metrics/ClassLength
attribute :pronunciation_ipa, :string
attribute :layout_id, :string

# Extra face fields
attribute :num_extra_faces, :integer

attribute :faces, :array do
faces = []

unless @object.num_extra_faces.zero?
@object.face_indices.each do |index|
f = { index: }
f[:base_link] = @object.faces_base_link[index] if @object.faces_base_link[index]
f[:display_subtypes] = @object.faces_display_subtypes[index] if @object.faces_display_subtypes[index]
f[:card_subtype_ids] = @object.faces_card_subtype_ids[index] if @object.faces_card_subtype_ids[index]
f[:stripped_text] = @object.faces_stripped_text[index] if @object.faces_stripped_text[index]
f[:stripped_title] = @object.faces_stripped_title[index] if @object.faces_stripped_title[index]
f[:text] = @object.faces_text[index] if @object.faces_text[index]
f[:title] = @object.faces_title[index] if @object.faces_title[index]
faces << f
end
end
faces
end

# Synthesized attributes
attribute :card_abilities, :hash
attribute :restrictions, :hash
Expand Down
11 changes: 3 additions & 8 deletions doc/api/card_cycles/all_card_cycles.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"route": "/api/v3/public/card_cycles",
"description": "All Card Cycles",
"explanation": null,
"parameters": [

],
"response_fields": [

],
"parameters": [],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -20,8 +16,7 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
Expand Down
9 changes: 3 additions & 6 deletions doc/api/card_cycles/get_a_single_card_cycle.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"description": "Id"
}
],
"response_fields": [

],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -25,12 +23,11 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
"response_body": "{\n \"data\": {\n \"id\": \"borealis\",\n \"type\": \"card_cycles\",\n \"attributes\": {\n \"name\": \"Borealis\",\n \"date_release\": \"2022-07-22\",\n \"legacy_code\": \"borealis\",\n \"card_set_ids\": [\n \"midnight_sun\",\n \"parhelion\"\n ],\n \"first_printing_id\": \"21166\",\n \"position\": null,\n \"released_by\": null,\n \"updated_at\": \"2022-12-08T12:00:00+00:00\"\n },\n \"relationships\": {\n \"card_sets\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_sets?filter[card_cycle_id]=borealis\"\n }\n },\n \"printings\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/printings?filter[card_cycle_id]=borealis\"\n }\n },\n \"cards\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/cards?filter[card_cycle_id]=borealis\"\n }\n },\n \"card_pools\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_pools?filter[card_cycle_id]=borealis\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_cycles/borealis\"\n }\n },\n \"meta\": {\n }\n}",
"response_body": "{\n \"data\": {\n \"id\": \"borealis\",\n \"type\": \"card_cycles\",\n \"attributes\": {\n \"name\": \"Borealis\",\n \"date_release\": \"2022-07-22\",\n \"legacy_code\": \"borealis\",\n \"card_set_ids\": [\n \"midnight_sun\",\n \"parhelion\"\n ],\n \"first_printing_id\": \"21166\",\n \"position\": null,\n \"released_by\": null,\n \"updated_at\": \"2022-12-08T12:00:00+00:00\"\n },\n \"relationships\": {\n \"card_sets\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_sets?filter[card_cycle_id]=borealis\"\n }\n },\n \"printings\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/printings?filter[card_cycle_id]=borealis\"\n }\n },\n \"cards\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/cards?filter[card_cycle_id]=borealis\"\n }\n },\n \"card_pools\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_pools?filter[card_cycle_id]=borealis\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_cycles/borealis\"\n }\n },\n \"meta\": {}\n}",
"response_headers": {
"Content-Type": "application/vnd.api+json; charset=utf-8"
},
Expand Down
13 changes: 4 additions & 9 deletions doc/api/card_pools/all_card_pools.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions doc/api/card_pools/get_a_single_card_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"description": "Id"
}
],
"response_fields": [

],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -25,12 +23,11 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
"response_body": "{\n \"data\": {\n \"id\": \"startup_02\",\n \"type\": \"card_pools\",\n \"attributes\": {\n \"name\": \"Startup Card Pool #2\",\n \"format_id\": \"startup\",\n \"card_cycle_ids\": [\n \"core\",\n \"borealis\"\n ],\n \"updated_at\": \"2022-12-08T12:00:00+00:00\",\n \"num_cards\": 4\n },\n \"relationships\": {\n \"format\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/formats/startup\"\n }\n },\n \"card_cycles\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_cycles?filter[card_pool_id]=startup_02\"\n }\n },\n \"card_sets\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_sets?filter[card_pool_id]=startup_02\"\n }\n },\n \"snapshots\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/snapshots?filter[card_pool_id]=startup_02\"\n }\n },\n \"cards\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/cards?filter[card_pool_id]=startup_02\"\n }\n },\n \"printings\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/printings?filter[card_pool_id]=startup_02\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_pools/startup_02\"\n }\n },\n \"meta\": {\n }\n}",
"response_body": "{\n \"data\": {\n \"id\": \"startup_02\",\n \"type\": \"card_pools\",\n \"attributes\": {\n \"name\": \"Startup Card Pool #2\",\n \"format_id\": \"startup\",\n \"card_cycle_ids\": [\n \"core\",\n \"borealis\"\n ],\n \"updated_at\": \"2022-12-08T12:00:00+00:00\",\n \"num_cards\": 4\n },\n \"relationships\": {\n \"format\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/formats/startup\"\n }\n },\n \"card_cycles\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_cycles?filter[card_pool_id]=startup_02\"\n }\n },\n \"card_sets\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_sets?filter[card_pool_id]=startup_02\"\n }\n },\n \"snapshots\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/snapshots?filter[card_pool_id]=startup_02\"\n }\n },\n \"cards\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/cards?filter[card_pool_id]=startup_02\"\n }\n },\n \"printings\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/printings?filter[card_pool_id]=startup_02\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_pools/startup_02\"\n }\n },\n \"meta\": {}\n}",
"response_headers": {
"Content-Type": "application/vnd.api+json; charset=utf-8"
},
Expand Down
11 changes: 3 additions & 8 deletions doc/api/card_set_types/all_card_set_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"route": "/api/v3/public/card_set_types",
"description": "All Card Set Types",
"explanation": null,
"parameters": [

],
"response_fields": [

],
"parameters": [],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -20,8 +16,7 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
Expand Down
9 changes: 3 additions & 6 deletions doc/api/card_set_types/get_a_single_card_set_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"description": "Id"
}
],
"response_fields": [

],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -25,12 +23,11 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
"response_body": "{\n \"data\": {\n \"id\": \"core\",\n \"type\": \"card_set_types\",\n \"attributes\": {\n \"name\": \"Core\",\n \"description\": \"A core set, or set that makes up part of the core selection of cards.\",\n \"updated_at\": \"2022-12-08T12:00:00+00:00\"\n },\n \"relationships\": {\n \"card_sets\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_sets?filter[card_set_type_id]=core\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_set_types/core\"\n }\n },\n \"meta\": {\n }\n}",
"response_body": "{\n \"data\": {\n \"id\": \"core\",\n \"type\": \"card_set_types\",\n \"attributes\": {\n \"name\": \"Core\",\n \"description\": \"A core set, or set that makes up part of the core selection of cards.\",\n \"updated_at\": \"2022-12-08T12:00:00+00:00\"\n },\n \"relationships\": {\n \"card_sets\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_sets?filter[card_set_type_id]=core\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_set_types/core\"\n }\n },\n \"meta\": {}\n}",
"response_headers": {
"Content-Type": "application/vnd.api+json; charset=utf-8"
},
Expand Down
11 changes: 3 additions & 8 deletions doc/api/card_sets/all_card_sets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"route": "/api/v3/public/card_sets",
"description": "All Card Sets",
"explanation": null,
"parameters": [

],
"response_fields": [

],
"parameters": [],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -20,8 +16,7 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"description": "Card cycle"
}
],
"response_fields": [

],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -33,7 +31,7 @@
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
"response_body": "{\n \"data\": [\n\n ],\n \"meta\": {\n \"stats\": {\n \"total\": {\n \"count\": 0\n }\n }\n }\n}",
"response_body": "{\n \"data\": [],\n \"meta\": {\n \"stats\": {\n \"total\": {\n \"count\": 0\n }\n }\n }\n}",
"response_headers": {
"Content-Type": "application/vnd.api+json; charset=utf-8"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"description": "Card set type"
}
],
"response_fields": [

],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -33,7 +31,7 @@
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
"response_body": "{\n \"data\": [\n\n ],\n \"meta\": {\n \"stats\": {\n \"total\": {\n \"count\": 0\n }\n }\n }\n}",
"response_body": "{\n \"data\": [],\n \"meta\": {\n \"stats\": {\n \"total\": {\n \"count\": 0\n }\n }\n }\n}",
"response_headers": {
"Content-Type": "application/vnd.api+json; charset=utf-8"
},
Expand Down
9 changes: 3 additions & 6 deletions doc/api/card_sets/get_a_single_card_set.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"description": "Id"
}
],
"response_fields": [

],
"response_fields": [],
"requests": [
{
"request_method": "GET",
Expand All @@ -25,12 +23,11 @@
"Content-Type": "application/json",
"Host": "api-preview.netrunnerdb.com"
},
"request_query_parameters": {
},
"request_query_parameters": {},
"request_content_type": "application/json",
"response_status": 200,
"response_status_text": "OK",
"response_body": "{\n \"data\": {\n \"id\": \"midnight_sun\",\n \"type\": \"card_sets\",\n \"attributes\": {\n \"name\": \"Midnight Sun\",\n \"date_release\": \"2022-07-22\",\n \"size\": 65,\n \"card_cycle_id\": \"borealis\",\n \"card_set_type_id\": \"booster_pack\",\n \"legacy_code\": null,\n \"position\": 33,\n \"first_printing_id\": null,\n \"released_by\": null,\n \"updated_at\": \"2022-12-08T12:00:00+00:00\"\n },\n \"relationships\": {\n \"card_cycle\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_cycles/borealis\"\n }\n },\n \"card_set_type\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_set_types/booster_pack\"\n }\n },\n \"printings\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/printings?filter[card_set_id]=midnight_sun\"\n }\n },\n \"cards\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/cards?filter[card_set_id]=midnight_sun\"\n }\n },\n \"card_pools\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_pools?filter[card_set_id]=midnight_sun\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_sets/midnight_sun\"\n }\n },\n \"meta\": {\n }\n}",
"response_body": "{\n \"data\": {\n \"id\": \"midnight_sun\",\n \"type\": \"card_sets\",\n \"attributes\": {\n \"name\": \"Midnight Sun\",\n \"date_release\": \"2022-07-22\",\n \"size\": 65,\n \"card_cycle_id\": \"borealis\",\n \"card_set_type_id\": \"booster_pack\",\n \"legacy_code\": null,\n \"position\": 33,\n \"first_printing_id\": null,\n \"released_by\": null,\n \"updated_at\": \"2022-12-08T12:00:00+00:00\"\n },\n \"relationships\": {\n \"card_cycle\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_cycles/borealis\"\n }\n },\n \"card_set_type\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_set_types/booster_pack\"\n }\n },\n \"printings\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/printings?filter[card_set_id]=midnight_sun\"\n }\n },\n \"cards\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/cards?filter[card_set_id]=midnight_sun\"\n }\n },\n \"card_pools\": {\n \"links\": {\n \"related\": \"http://localhost:3000/api/v3/public/card_pools?filter[card_set_id]=midnight_sun\"\n }\n }\n },\n \"links\": {\n \"self\": \"http://localhost:3000/api/v3/public/card_sets/midnight_sun\"\n }\n },\n \"meta\": {}\n}",
"response_headers": {
"Content-Type": "application/vnd.api+json; charset=utf-8"
},
Expand Down
Loading
Loading