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

Documentation for sessions_controller#create & resources_controller#destroy - #279

Merged
hpjaj merged 8 commits into
OperationCode:masterfrom
nagano564:bug/220-api-doc
Apr 2, 2018
Merged

hpjaj merged 8 commits into
OperationCode:masterfrom
nagano564:bug/220-api-doc

Conversation

@nagano564

@nagano564 nagano564 commented Mar 17, 2018 •

Copy link
Copy Markdown
Contributor

Description of changes

  • Updated the description for resources_controller#destroy
  • Updated line 722 on apiary.apib
  • No test needed
  • add to documentation on apiray.apib for the sessions_controller#create
  • tested format by copy pasting onto apiray.io and fixed indentation to make sure it was a valid
    documentation

Issue Resolved

Fixes #220

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

## Resource [/api/v1/resources/{resource_id}]
## Resource | Delete [/api/v1/resources/{resource_id}]

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 would actually be the same route for both the Show or the Delete actions, similar to here:

https://github.com/OperationCode/operationcode_backend/blob/master/apiary.apib#L93

@hpjaj

hpjaj commented Mar 17, 2018

Copy link
Copy Markdown
Contributor

@kenny - Can you please add more description to what this PR is solving/addressing? Also, in the "issue resolved" section, please link up the associated issue #

You can see an example of that linkage in this PR's description: #272

Comment thread apiary.apib
{
"token" => some_long_string_of_characters,
"user" => {
"id" => 96,

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.

You'll want to indent the contents of this user hash (i.e. lines 1047 - 1054)

@nagano564 nagano564 changed the title changed one line for resources#destroy Documentation for sessions_controller#create & resources_controller#destroy Apr 1, 2018
Comment thread apiary.apib

+ Body

{

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.

Based on these results from the params check you did in the controller:

<ActionController::Parameters {"user"=>{"email"=>"mekhi_kemmer@dooleycollier.info", "password"=>"pass123"}, "controller"=>"api/v1/sessions", "action"=>"create", "session"
=>{"user"=>{"email"=>"mekhi_kemmer@dooleycollier.info", "password"=>"pass123"}}, "format"=>"json"} permitted: false>

The request contains:

{"user"=>{"email"=>"mekhi_kemmer@dooleycollier.info", "password"=>"pass123"}}

So you'll want to update the Body and parameters sections accordingly.

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 it to user, email and password

Comment thread apiary.apib
}
## Sessions | Create [/api/v1/sessions/user{?email,password}]
+ Parameters

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.

user is also passed, so you'll want to include that as a parameter. For it's type, you can use object.

Comment thread apiary.apib Outdated

{
user: {
email: @user.email,

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.

email is a string. Can you use something like 'john@example.com'.

test 'returns JWT token for succesfull login' do
post api_v1_sessions_url, params: @user_params, as: :json
json = response.parsed_body
byebug

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.

Accidentally slipped through :)

Comment thread apiary.apib Outdated
errors: "Some error message"
}
## Sessions | Create [/api/v1/sessions/user{?email,password}]
## Sessions | Create [/api/v1/sessions/{?user,email,password}]

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.

Remove the / in between sessions and {, and we should be good

@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 @kenny!

@hpjaj
hpjaj merged commit 2e33f13 into OperationCode:master Apr 2, 2018
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.

Add API Documentation for Resources and Sessions endpoints

2 participants