From 3baed683b131a3f126c99d74db37180a5fa5b0ac Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 2 Mar 2022 11:54:31 +1100 Subject: [PATCH] Add allow_charges attribute to customers endpoint --- app/json_schemas/customer_schema.rb | 3 ++- app/serializers/api/v1/customer_serializer.rb | 3 ++- swagger/v1/swagger.yaml | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/json_schemas/customer_schema.rb b/app/json_schemas/customer_schema.rb index 4652ae3bbf..8da8b67e2b 100644 --- a/app/json_schemas/customer_schema.rb +++ b/app/json_schemas/customer_schema.rb @@ -12,7 +12,8 @@ class CustomerSchema < JsonApiSchema first_name: { type: :string, nullable: true, example: "Alice" }, last_name: { type: :string, nullable: true, example: "Springs" }, code: { type: :string, nullable: true, example: "BUYER1" }, - email: { type: :string, example: "alice@example.com" } + email: { type: :string, example: "alice@example.com" }, + allow_charges: { type: :boolean, example: false }, } end diff --git a/app/serializers/api/v1/customer_serializer.rb b/app/serializers/api/v1/customer_serializer.rb index 6f71b39159..1cecc7ee23 100644 --- a/app/serializers/api/v1/customer_serializer.rb +++ b/app/serializers/api/v1/customer_serializer.rb @@ -3,7 +3,8 @@ module Api module V1 class CustomerSerializer < BaseSerializer - attributes :id, :enterprise_id, :first_name, :last_name, :code, :email + attributes :id, :enterprise_id, :first_name, :last_name, :code, :email, + :allow_charges belongs_to :enterprise, links: { related: ->(object) { diff --git a/swagger/v1/swagger.yaml b/swagger/v1/swagger.yaml index 9b2642959d..aec3ce9759 100644 --- a/swagger/v1/swagger.yaml +++ b/swagger/v1/swagger.yaml @@ -60,6 +60,9 @@ components: email: type: string example: alice@example.com + allow_charges: + type: boolean + example: false required: - id - enterprise_id @@ -67,6 +70,7 @@ components: - last_name - code - email + - allow_charges relationships: type: object properties: @@ -130,6 +134,9 @@ components: email: type: string example: alice@example.com + allow_charges: + type: boolean + example: false required: - id - enterprise_id @@ -137,6 +144,7 @@ components: - last_name - code - email + - allow_charges relationships: type: object properties: @@ -271,6 +279,9 @@ paths: email: type: string example: alice@example.com + allow_charges: + type: boolean + example: false required: - enterprise_id - email @@ -354,6 +365,9 @@ paths: email: type: string example: alice@example.com + allow_charges: + type: boolean + example: false required: - enterprise_id - email