--- openapi: 3.0.1 info: title: Adopters API V1 version: v1 paths: "/api/v1/adopters/adopters": get: summary: Show current adopter tags: - Adopters parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Current adopter shown content: application/json: schema: "$ref": "#/components/schemas/adopter" '401': description: Not authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" put: summary: Update current adopter tags: - Adopters parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Adopter updated content: application/json: schema: "$ref": "#/components/schemas/adopter" '400': description: Invalid adopter content: application/json: schema: "$ref": "#/components/schemas/error_message" '401': description: Not authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" requestBody: content: multipart/form-data: schema: "$ref": "#/components/schemas/update_adopter" delete: summary: Deletes current adopter account tags: - Adopters parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Adopter deleted '401': description: Not authenticated "/api/v1/adopters/adopters/adoption_applications": get: summary: Get current adopters adoption applications tags: - Adoption applications parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Current adoption applications shown content: application/json: schema: "$ref": "#/components/schemas/adoption_applications" '401': description: Not authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/adoption_applications/{id}/cancel": put: summary: Cancels adoption application tags: - Adoption applications parameters: - name: id in: path required: true schema: type: integer - name: Authorization in: header required: true schema: type: string responses: '200': description: Adoption application canceled '404': description: Application Not found content: application/json: schema: "$ref": "#/components/schemas/error_message" '403': description: Can not update this adoption application content: application/json: schema: "$ref": "#/components/schemas/error_message" '401': description: Not authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/pets/{id}/favorites": post: summary: Add pet to favorites tags: - Favorites parameters: - name: id in: path required: true - name: Authorization in: header required: true schema: type: string responses: '200': description: Pet added into favorites content: application/json: schema: "$ref": "#/components/schemas/collection" '404': description: Could not find pet content: application/json: schema: "$ref": "#/components/schemas/error_message" '401': description: Not Authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" delete: summary: Removes pet from collection tags: - Favorites parameters: - name: id in: path required: true - name: Authorization in: header required: true schema: type: string responses: '200': description: Pet removed from favorites content: application/json: schema: "$ref": "#/components/schemas/collection" '404': description: Could not find pet content: application/json: schema: "$ref": "#/components/schemas/error_message" '401': description: Not Authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/favorites": get: summary: Get current user favorites collection tags: - Favorites parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Favorites collection shown content: application/json: schema: "$ref": "#/components/schemas/collection" "/api/v1/adopters/filters/specie_filters": get: summary: Get specie filters tags: - Filters responses: '200': description: Specie filters shown content: application/json: schema: "$ref": "#/components/schemas/filter" "/api/v1/adopters/filters": get: summary: Get all filters tags: - Filters responses: '200': description: All filters shown content: application/json: schema: "$ref": "#/components/schemas/filters" "/api/v1/adopters/info/privacy_policy": get: summary: Get Privacy Policy tags: - Info responses: '200': description: Privacy policy shown content: application/json: schema: "$ref": "#/components/schemas/privacy_policy" "/api/v1/adopters/info/terms_and_conditions": get: summary: Get Terms and Conditions tags: - Info responses: '200': description: Terms and conditions shown content: application/json: schema: "$ref": "#/components/schemas/terms_and_conditions" "/api/v1/adopters/info/{platform}/store_link": get: summary: Get store link tags: - Info parameters: - name: platform in: path required: true schema: type: string responses: '200': description: Store link shown content: application/json: schema: "$ref": "#/components/schemas/store_link" "/api/v1/adopters/info/constants": get: summary: Get Constants tags: - Info responses: '200': description: Constants listed content: application/json: schema: "$ref": "#/components/schemas/constants" "/api/v1/adopters/info/countries": get: summary: Get Supported Countries tags: - Info responses: '200': description: Countries listed content: application/json: schema: "$ref": "#/components/schemas/countries" "/api/v1/adopters/info/cities": get: summary: Get Supported Cities tags: - Info responses: '200': description: Cities listed content: application/json: schema: "$ref": "#/components/schemas/cities" "/api/v1/adopters/organizations": get: summary: Index all organizations tags: - Organizations parameters: - name: Authorization in: header required: false schema: type: string responses: '200': description: Organizations listed content: application/json: schema: "$ref": "#/components/schemas/organizations" "/api/v1/adopters/organizations/{id}": get: summary: Show organization tags: - Organizations parameters: - name: id in: path required: true schema: type: integer - name: Authorization in: header required: false schema: type: string responses: '200': description: Organization shown content: application/json: schema: "$ref": "#/components/schemas/organization" '404': description: Organization not found content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/organizations/{id}/needed_materials": get: summary: Index organizations needed materials tags: - Organizations parameters: - name: id in: path required: true schema: type: integer - name: Authorization in: header required: false schema: type: string responses: '200': description: Organizations needed material indexed content: application/json: schema: "$ref": "#/components/schemas/needed_materials" '404': description: Organization not found content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/organizations/{id}/adoption_form": get: summary: Show the organizations adoption form tags: - Organizations parameters: - name: id in: path required: true schema: type: integer - name: Authorization in: header required: false schema: type: string responses: '200': description: Organizations needed material indexed content: application/json: schema: "$ref": "#/components/schemas/adoption_form" '404': description: Organization not found content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/pets": get: summary: Search tags: - Pets parameters: - name: specie in: query required: false schema: type: string - name: genre in: query required: false schema: type: string - name: age in: query required: false schema: type: string - name: size in: query required: false schema: type: string - name: hair in: query required: false schema: type: string - name: castrated in: query required: false schema: type: string - name: page in: query required: false schema: type: integer - name: per_page in: query required: false schema: type: integer - name: Authorization in: header required: false schema: type: string responses: '200': description: Pets indexed content: application/json: schema: "$ref": "#/components/schemas/pets" "/api/v1/adopters/pets/{id}": get: summary: Show pet tags: - Pets parameters: - name: id in: path required: true schema: type: integer - name: Authorization in: header required: false schema: type: string responses: '200': description: Pet shown content: application/json: schema: "$ref": "#/components/schemas/pet" '403': description: Can't show pets which are not in adoption content: application/json: schema: "$ref": "#/components/schemas/error_message" '404': description: Pet not found content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/pets/{id}/adoption_application": post: summary: Create adoption application tags: - Adoption applications parameters: - name: id in: path required: true schema: type: integer - name: Authorization in: header required: true schema: type: string responses: '201': description: Adoption application created '400': description: Invalid application '403': description: Pet is not in adoption '401': description: Invalid application requestBody: content: multipart/form-data: schema: "$ref": "#/components/schemas/new_adoption_application" "/api/v1/adopters/sessions/auth/{provider}/callback": post: summary: OAuth Callback tags: - Sessions parameters: - name: provider in: path required: true schema: type: string responses: '201': description: Session created content: application/json: schema: "$ref": "#/components/schemas/device" '400': description: Authentication error content: application/json: schema: "$ref": "#/components/schemas/omniauth_error" '404': description: Unsupported Provider content: application/json: schema: "$ref": "#/components/schemas/error_message" "/api/v1/adopters/sessions": delete: summary: Log out tags: - Sessions parameters: - name: Authorization in: header required: true schema: type: string responses: '200': description: Session deleted '401': description: Not authenticated content: application/json: schema: "$ref": "#/components/schemas/error_message" components: schemas: error_message: type: object properties: description: type: string details: type: any error_code: type: integer http_status: type: integer required: - description - error_code - http_status terms_and_conditions: type: object properties: data: type: string required: - data privacy_policy: type: object properties: data: type: string required: - data device: type: object properties: id: type: integer remember_me: type: boolean expires_at: type: string auth_token: type: string user: "$ref": "#/components/schemas/adopter" required: - id - remember_me - expires_at - user - auth_token country: type: object properties: id: type: integer name: type: string abbreviation: type: string required: - id - name - abbreviation city: type: object properties: id: type: integer name: type: string country: "$ref": "#/components/schemas/country" required: - id - name - country countries: type: array items: "$ref": "#/components/schemas/country" cities: type: array items: "$ref": "#/components/schemas/city" adopter: type: object properties: id: type: integer name: type: string email: type: string phone: type: string nullable: true image_url: type: string city: oneOf: - "$ref": "#/components/schemas/city" - type: 'null' required: - id - name - email - image_url - phone update_adopter: type: object properties: name: type: string image: type: file omniauth_error: type: object properties: error: type: string required: - error vaccine: type: object properties: id: type: integer name: type: string description: type: string specie: "$ref": "#/components/schemas/specie" required: - id - name - description - specie pet_vaccination: type: object properties: id: type: integer pet_id: type: integer performed_at: type: date vaccine: "$ref": "#/components/schemas/vaccine" details: type: string nullable: true required: - id - pet_id - performed_at - vaccine - details pathology: type: object properties: id: type: integer name: type: string description: type: string specie: "$ref": "#/components/schemas/specie" required: - id - name - description - specie pathologies: type: array items: "$ref": "#/components/schemas/pathology" pet_pathology: type: object properties: id: type: integer pet_id: type: integer pathology: "$ref": "#/components/schemas/pathology" required: - id - pet_id - pathology deworming: type: object properties: id: type: integer performed_at: type: date details: type: string pet_id: type: integer required: - id - performed_at - details - pet_id organization: type: object properties: id: type: integer name: type: string description: type: string image_url: type: string contact_email: type: string facebook_url: type: string nullable: true instagram_url: type: string nullable: true city: "$ref": "#/components/schemas/city" required: - id - name - description - image_url - contact_email - facebook_url - instagram_url - city organizations: type: array items: "$ref": "#/components/schemas/organization" needed_material: type: object properties: id: type: integer name: type: string description: type: string required: - id - name - description needed_materials: type: array items: "$ref": "#/components/schemas/needed_material" specie: type: object properties: id: type: integer value: type: string required: - id - value genre: type: object properties: id: type: integer value: type: string required: - id - value age: type: object properties: id: type: integer value: type: string required: - id - value size: type: object properties: id: type: integer value: type: string required: - id - value hair: type: object properties: id: type: integer value: type: string required: - id - value castrated: type: object properties: id: type: integer value: type: string required: - id - value pet: type: object properties: id: type: integer name: type: string specie: "$ref": "#/components/schemas/specie" genre: "$ref": "#/components/schemas/genre" age: "$ref": "#/components/schemas/age" size: "$ref": "#/components/schemas/size" hair: "$ref": "#/components/schemas/hair" castrated: "$ref": "#/components/schemas/castrated" image_url: type: string history: type: string nullable: true organization: "$ref": "#/components/schemas/organization" required: - id - name - specie - genre - age - size - hair - castrated - organization - image_url - history pet_reduced: type: object properties: id: type: integer name: type: string specie: "$ref": "#/components/schemas/specie" age: "$ref": "#/components/schemas/age" size: "$ref": "#/components/schemas/size" hair: "$ref": "#/components/schemas/hair" castrated: "$ref": "#/components/schemas/castrated" image_url: type: string required: - id - name - specie - age - size - hair - castrated - image_url pets: type: object properties: pets: type: array items: "$ref": "#/components/schemas/pet_reduced" meta: type: object properties: pagination: type: object properties: current_page: type: integer page: type: integer per_page: type: integer new_adoption_application: type: object properties: adoption_form_field_answers_attributes: type: array items: anyOf: - "$ref": "#/components/schemas/numeric_form_field_answer_attributes_creation" - "$ref": "#/components/schemas/image_form_field_answer_attributes_creation" - "$ref": "#/components/schemas/single_choice_form_field_answer_attributes_creation" - "$ref": "#/components/schemas/multiple_choice_form_field_answer_attributes_creation" - "$ref": "#/components/schemas/text_form_field_answer_attributes_creation" required: - adoption_form_field_answers_attributes numeric_form_field_answer_attributes_creation: type: object properties: adoption_form_field_id: type: integer numeric_answer: type: integer type: type: string description: Must be equal to NumericFormFieldAnswer required: - adoption_form_field_id - numeric_answer - type image_form_field_answer_attributes_creation: type: object properties: adoption_form_field_id: type: integer image: type: file type: type: string description: Must be equal to ImageFormFieldAnswer required: - adoption_form_field_id - image - type single_choice_form_field_answer_attributes_creation: type: object properties: adoption_form_field_id: type: integer single_choice_answer: type: string type: type: string description: Must be equal to SingleChoiceFormFieldAnswer required: - adoption_form_field_id - single_choice_answer - type multiple_choice_form_field_answer_attributes_creation: type: object properties: adoption_form_field_id: type: integer type: type: string description: Must be equal to MultipleChoiceFormFieldAnswer multiple_choices_answer: type: array items: type: string required: - adoption_form_field_id - multiple_choices_answer - type text_form_field_answer_attributes_creation: type: object properties: adoption_form_field_id: type: integer text_answer: type: string type: type: string description: Must be equal to TextFormFieldAnswer required: - adoption_form_field_id - text_answer - type adoption_applications: type: array items: "$ref": "#/components/schemas/adoption_application" adoption_application: type: object properties: id: type: integer status: type: string created_at: type: date canceled: type: boolean pet: "$ref": "#/components/schemas/pet_reduced" organization: "$ref": "#/components/schemas/organization" required: - id - status - created_at - canceled - pet - organization numeric_form_field_answer: type: object properties: id: type: integer adoption_form_field: anyOf: - "$ref": "#/components/schemas/number_form_field" - "$ref": "#/components/schemas/text_form_field" - "$ref": "#/components/schemas/image_form_field" - "$ref": "#/components/schemas/single_choice_form_field" - "$ref": "#/components/schemas/multiple_choice_form_field" numeric_answer: type: integer required: - id - adoption_form_field - numeric_answer text_form_field_answer: type: object properties: id: type: integer adoption_form_field: anyOf: - "$ref": "#/components/schemas/number_form_field" - "$ref": "#/components/schemas/text_form_field" - "$ref": "#/components/schemas/image_form_field" - "$ref": "#/components/schemas/single_choice_form_field" - "$ref": "#/components/schemas/multiple_choice_form_field" text_answer: type: string required: - id - adoption_form_field - text_answer image_form_field_answer: type: object properties: id: type: integer adoption_form_field: anyOf: - "$ref": "#/components/schemas/number_form_field" - "$ref": "#/components/schemas/text_form_field" - "$ref": "#/components/schemas/image_form_field" - "$ref": "#/components/schemas/single_choice_form_field" - "$ref": "#/components/schemas/multiple_choice_form_field" image_url: type: string required: - id - adoption_form_field - image_url multiple_choice_form_field_answer: type: object properties: id: type: integer adoption_form_field: anyOf: - "$ref": "#/components/schemas/number_form_field" - "$ref": "#/components/schemas/text_form_field" - "$ref": "#/components/schemas/image_form_field" - "$ref": "#/components/schemas/single_choice_form_field" - "$ref": "#/components/schemas/multiple_choice_form_field" multiple_choices_answer: type: array items: type: string required: - id - adoption_form_field - multiple_choices_answer single_choice_form_field_answer: type: object properties: id: type: integer adoption_form_field: anyOf: - "$ref": "#/components/schemas/number_form_field" - "$ref": "#/components/schemas/text_form_field" - "$ref": "#/components/schemas/image_form_field" - "$ref": "#/components/schemas/single_choice_form_field" - "$ref": "#/components/schemas/multiple_choice_form_field" single_choice_answer: type: string required: - id - adoption_form_field - single_choice_answer number_form_field: type: object properties: id: type: integer name: type: string type: type: string description: type: string nullable: true order: type: integer obligatory: type: boolean required: - id - name - type - order - obligatory - description text_form_field: type: object properties: id: type: integer name: type: string description: type: string nullable: true type: type: string order: type: integer obligatory: type: boolean required: - id - name - type - order - obligatory - description image_form_field: type: object properties: id: type: integer name: type: string type: type: string description: type: string nullable: true order: type: integer obligatory: type: boolean required: - id - name - type - order - obligatory - description multiple_choice_form_field: type: object properties: id: type: integer name: type: string type: type: string description: type: string nullable: true order: type: integer obligatory: type: boolean available_choices: type: array items: type: string required: - id - name - type - available_choices - order - obligatory - description single_choice_form_field: type: object properties: id: type: integer name: type: string obligatory: type: boolean description: type: string nullable: true type: type: string order: type: integer available_choices: type: array items: type: string required: - id - name - type - available_choices - order - obligatory - description adoption_form: type: object properties: id: type: integer adoption_form_fields: type: array items: anyOf: - "$ref": "#/components/schemas/number_form_field" - "$ref": "#/components/schemas/text_form_field" - "$ref": "#/components/schemas/image_form_field" - "$ref": "#/components/schemas/single_choice_form_field" - "$ref": "#/components/schemas/multiple_choice_form_field" required: - id - adoption_form_fields collection: type: object properties: id: type: integer name: type: string amount_of_pets: type: integer collection_pets: type: array items: "$ref": "#/components/schemas/collection_pet" required: - id - name - amount_of_pets - collection_pets collection_pet: type: object properties: id: type: integer pet_id: type: integer collection_id: type: integer required: - id - pet_id - collection_id store_link: type: object properties: link: type: string required: - link filters: type: array items: "$ref": "#/components/schemas/filter" filter: type: object properties: key: type: string options: type: array items: type: object properties: name: type: string match: type: array items: type: string icon: type: string nullable: true required: - name - match - icon required: - options - key constants: type: object properties: specie: type: array items: "$ref": "#/components/schemas/specie" genre: type: array items: "$ref": "#/components/schemas/genre" age: type: array items: "$ref": "#/components/schemas/age" size: type: array items: "$ref": "#/components/schemas/size" hair: type: array items: "$ref": "#/components/schemas/hair" castrated: type: array items: "$ref": "#/components/schemas/castrated" required: - specie - genre - age - size - hair - castrated servers: - url: https://{defaultHost} variables: defaultHost: default: www.example.com