Skip to content

Commit

Permalink
Work arround missing attributes client bug
Browse files Browse the repository at this point in the history
This is actually to resolve a client side bug. Ideally the
library will be fixed, but we can't have everything :/

qvantel/jsonapi-client#25
  • Loading branch information
WilliamMcCumstie committed Jan 24, 2020
1 parent badd51f commit 9423cbe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/serializers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def id
object.name
end

attributes :description, :summary
attributes :name, :description, :summary
end

class NodeSerializer
Expand All @@ -43,6 +43,8 @@ class NodeSerializer
def id
object.name
end

attributes :name
end

class GroupSerializer
Expand All @@ -53,11 +55,18 @@ class GroupSerializer
def id
object.name
end

attributes :name
end

class TicketSerializer
include JSONAPI::Serializer

# Dummy attribute so the 'attributes' key is always set
# Some clients (incorrectly) assume the 'attributes' key will always be set
# https://github.com/qvantel/jsonapi-client/issues/25
attribute(:true) { true }

has_one :command
has_one :context
has_many :jobs
Expand Down

0 comments on commit 9423cbe

Please sign in to comment.