Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Issue #221 added api/v1/users documentation - #224

Merged
hpjaj merged 8 commits into
OperationCode:masterfrom
apex-omontgomery:master
Dec 31, 2017
Merged

hpjaj merged 8 commits into
OperationCode:masterfrom
apex-omontgomery:master

Conversation

@apex-omontgomery

Copy link
Copy Markdown
Contributor

Description of changes

Included 3 new Apiary API routes.
POST api/v1/users_controller#create
PATCH api/v1/users_controller#update
POST for api/v1/users_controller#verify

Issue Resolved

Resolved issue of lacking API docs for users.
Fixes #221

wimo7083 and others added 2 commits December 27, 2017 15:55

@hpjaj hpjaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming along really nicely 👍

Comment thread apiary.apib Outdated

API endpoints that Operation Code's Rails backend makes available to its React frontend.

## Users | Create [/api/v1/users{?first_name,last_name,email,zip,password,mentor}]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please alphabetize the placement of these in the file. First by model (i.e. User), then by action (i.e. create)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, also adjusted Location

Comment thread apiary.apib Outdated
+ Body

{
first_name: "Mike",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pls add indenting in keeping with other Body hashes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread apiary.apib Outdated
+ Response 201 (application/json)

{
token: Bearer Access-Token

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indenting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread apiary.apib Outdated
+ Response 422 (application/json)

{
errors: "Some error message"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indenting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread apiary.apib Outdated
+ Body

{
verified: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above re: access_token

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed verified from both header and body, and fixed indentation.

Comment thread apiary.apib Outdated

+ Parameters

+ education_level (string, required) - Users highest level of education in the form of a string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all optional (vs. required)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if they submit no params it returns a 422 or 200?

Comment thread apiary.apib Outdated
last_name: "Johnson",
email: "dreams@operationcode.org",
zip: "80020",
password: "hunter2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically encrypted_password is what is returned, but you can leave it out all together.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread apiary.apib Outdated

+ verified (boolean, required) - Users verified veteran status in the form of a boolean

### Modify User record verified status [POST]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps something like, "Verifies a user's military affiliation status through ID.me"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread apiary.apib Outdated
+ email (string, required) - Email of the User in the form of a string
+ zip (string, required) - Zipcode of the User in the form of a string
+ password (string, required) - Password of the User in the form on a string
+ mentor (boolean, required) - Is User requesting mentor in the form of a boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe mentor is optional

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right from a front end perspective.

@apex-omontgomery

Copy link
Copy Markdown
Contributor Author

Completed changes you requested. One thing I noticed was how some of the endpoints had combined grouping. Codeschool | Show or Delete is one example.

There's inconsistent use of Body in the previous documentation. But apiary doesn't seem to mind. Not sure of your thoughts.

## User | Reset Password [/api/v1/users/passwords/reset{?email}]

+ Parameters

    + email (string, required) - The email address of the requesting User

### Reset the User's Password  [POST]

+ Request (application/json)

    + Body

            {
                "email": "frank@example.com"
            }

+ Response 200 (application/json)

    + Body

            {
                status: "ok"
            }

+ Response 422 (application/json)

        {
            errors: "Some error message"
        }
### Delete an Existing CodeSchool [DELETE]

  + Request (application/json)

      + Headers

              Authorization: Bearer Access-Token

      + Body

              {
                  "id": 1
              }

  + Response 200 (application/json)

      + Body

              {
                  status: "ok"
              }

  + Response 422 (application/json)

      + Body

              {
                  errors: "Some error message"
              }

Comment thread apiary.apib Outdated
+ Body

{
first_name: "Mike",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent :)

Comment thread apiary.apib Outdated

+ Parameters

+ verified (boolean, required) - User has verified military affiliation status through ID.me

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The param here is only access_token

Comment thread apiary.apib Outdated
+ Body

{
verified: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Body is only the access_token

Comment thread apiary.apib

## Location | Delete [/api/v1/code_schools/:code_school_id/locations/:id]

### Delete an Existing Location [DELETE]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Comment thread apiary.apib Outdated

+ Headers

Authorization: Bearer Access-Token

@hpjaj hpjaj Dec 29, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method actually does not require authorization. Only the update method does.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@apex-omontgomery

Copy link
Copy Markdown
Contributor Author

Made some changes, also found some instances where Param items only had 2 spaces.

@hpjaj hpjaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, @wimo7083

@hpjaj
hpjaj merged commit d5779f4 into OperationCode:master Dec 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants