diff options
author | Starfall <admin@plural.cafe> | 2020-06-19 13:14:45 -0500 |
---|---|---|
committer | Starfall <admin@plural.cafe> | 2020-06-19 13:14:45 -0500 |
commit | 5668836f56cddf3257f38a2483c1d42cacbad3a8 (patch) | |
tree | c241a44562f79ccecaf215eb572c22d559b08dd1 /app/serializers/rest/keys | |
parent | 76f79dd29909d39f1d36ef48e6892223d59e29d7 (diff) | |
parent | c7da2cc5a1821e589e7241aec21d8bb426722c2a (diff) |
Merge branch 'glitch' into main
Diffstat (limited to 'app/serializers/rest/keys')
-rw-r--r-- | app/serializers/rest/keys/claim_result_serializer.rb | 9 | ||||
-rw-r--r-- | app/serializers/rest/keys/device_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/keys/query_result_serializer.rb | 11 |
3 files changed, 26 insertions, 0 deletions
diff --git a/app/serializers/rest/keys/claim_result_serializer.rb b/app/serializers/rest/keys/claim_result_serializer.rb new file mode 100644 index 000000000..145044f55 --- /dev/null +++ b/app/serializers/rest/keys/claim_result_serializer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class REST::Keys::ClaimResultSerializer < ActiveModel::Serializer + attributes :account_id, :device_id, :key_id, :key, :signature + + def account_id + object.account.id.to_s + end +end diff --git a/app/serializers/rest/keys/device_serializer.rb b/app/serializers/rest/keys/device_serializer.rb new file mode 100644 index 000000000..f9b821b79 --- /dev/null +++ b/app/serializers/rest/keys/device_serializer.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +class REST::Keys::DeviceSerializer < ActiveModel::Serializer + attributes :device_id, :name, :identity_key, + :fingerprint_key +end diff --git a/app/serializers/rest/keys/query_result_serializer.rb b/app/serializers/rest/keys/query_result_serializer.rb new file mode 100644 index 000000000..8f8bdde28 --- /dev/null +++ b/app/serializers/rest/keys/query_result_serializer.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class REST::Keys::QueryResultSerializer < ActiveModel::Serializer + attributes :account_id + + has_many :devices, serializer: REST::Keys::DeviceSerializer + + def account_id + object.account.id.to_s + end +end |