From cb924d4043a793f2e8db7e585b35d30e6933b7ea Mon Sep 17 00:00:00 2001 From: nagano564 Date: Sat, 17 Mar 2018 17:03:58 -0400 Subject: [PATCH 1/8] changed one line for resources#destroy --- apiary.apib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiary.apib b/apiary.apib index f84b3406..a8d612e1 100644 --- a/apiary.apib +++ b/apiary.apib @@ -719,7 +719,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f + Response 400 (application/json) -## Resource [/api/v1/resources/{resource_id}] +## Resource | Delete [/api/v1/resources/{resource_id}] + Parameters From 1572c3deeb68ef92cc0b8d29b3a2c99a0ab77de1 Mon Sep 17 00:00:00 2001 From: nagano564 Date: Sun, 18 Mar 2018 01:32:30 -0400 Subject: [PATCH 2/8] changed to show or delete --- apiary.apib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiary.apib b/apiary.apib index a8d612e1..882d6449 100644 --- a/apiary.apib +++ b/apiary.apib @@ -719,7 +719,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f + Response 400 (application/json) -## Resource | Delete [/api/v1/resources/{resource_id}] +## Resource | Show or Delete [/api/v1/resources/{resource_id}] + Parameters From 6779c5f711cf5c976cb349c5fe69a6f10f44f325 Mon Sep 17 00:00:00 2001 From: nagano564 Date: Sat, 31 Mar 2018 16:18:57 -0400 Subject: [PATCH 3/8] doc for sessions/create --- apiary.apib | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/apiary.apib b/apiary.apib index 882d6449..451d9a8b 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1017,6 +1017,50 @@ API endpoints that Operation Code's Rails backend makes available to its React f { errors: "Some error message" } +## Sessions | Create [/api/v1/sessions/{?email,password,first_name,last_name}] ++ Parameters + + + email (string, required) - The users email + + password (string, required) - The users password + + first_name(string, required) - The users first names + + last_name(string, required) - The users last name + +### Create a Session [POST] ++ Request (application/json) + + + Body + + { + "email" => "jerel@adams.net", + "password" => "some_password" + "first_name" => "Keara", + "last_name" => "Runolfsson", + } + ++ Response 201 (application/json) + + + Body + + { + "token" => some_long_string_of_characters, + "user" => { + "id" => 96, + "email" => "jerel@adams.net", + "zip" => "97201", + "first_name" => "Keara", + "last_name" => "Runolfsson", + "slack_name" => "Jar Jar Binks", + "mentor" => false, + "verified" => false + }, + "redirect_to" => "/profile" + } + ++ Response 422 (application/json) + + { + errors: "Some error message" + } ## Slack User | Invite [/api/v1/slack_users] From 5c90191fc2d07981d9c07b4c6157df209264338a Mon Sep 17 00:00:00 2001 From: nagano564 Date: Sat, 31 Mar 2018 23:29:41 -0400 Subject: [PATCH 4/8] fixed some indentation --- apiary.apib | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apiary.apib b/apiary.apib index 451d9a8b..3f73a341 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1043,7 +1043,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f { "token" => some_long_string_of_characters, - "user" => { + "user" => { "id" => 96, "email" => "jerel@adams.net", "zip" => "97201", @@ -1052,9 +1052,9 @@ API endpoints that Operation Code's Rails backend makes available to its React f "slack_name" => "Jar Jar Binks", "mentor" => false, "verified" => false - }, - "redirect_to" => "/profile" - } + }, + "redirect_to" => "/profile" + } + Response 422 (application/json) From 71cfe975a381c716a5830dda2ceb25444e7deed9 Mon Sep 17 00:00:00 2001 From: nagano564 Date: Mon, 2 Apr 2018 02:23:23 -0400 Subject: [PATCH 5/8] fixed the request body, parameters and title --- apiary.apib | 16 ++++++++-------- .../api/v1/sessions_controller_test.rb | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apiary.apib b/apiary.apib index 3f73a341..75782efd 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1017,13 +1017,11 @@ API endpoints that Operation Code's Rails backend makes available to its React f { errors: "Some error message" } -## Sessions | Create [/api/v1/sessions/{?email,password,first_name,last_name}] +## Sessions | Create [/api/v1/sessions/user{?email,password}] + Parameters + email (string, required) - The users email + password (string, required) - The users password - + first_name(string, required) - The users first names - + last_name(string, required) - The users last name ### Create a Session [POST] + Request (application/json) @@ -1031,12 +1029,14 @@ API endpoints that Operation Code's Rails backend makes available to its React f + Body { - "email" => "jerel@adams.net", - "password" => "some_password" - "first_name" => "Keara", - "last_name" => "Runolfsson", + user: { + email: @user.email, + password: 'pass123' + } } + + + Response 201 (application/json) + Body @@ -1045,7 +1045,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f "token" => some_long_string_of_characters, "user" => { "id" => 96, - "email" => "jerel@adams.net", + "email" => "@user.email", "zip" => "97201", "first_name" => "Keara", "last_name" => "Runolfsson", diff --git a/test/controllers/api/v1/sessions_controller_test.rb b/test/controllers/api/v1/sessions_controller_test.rb index cc689237..d20d4b7d 100644 --- a/test/controllers/api/v1/sessions_controller_test.rb +++ b/test/controllers/api/v1/sessions_controller_test.rb @@ -14,6 +14,7 @@ def setup test 'returns JWT token for succesfull login' do post api_v1_sessions_url, params: @user_params, as: :json json = response.parsed_body + byebug refute_nil json['token'] end From 1a2bca435e8abeb5b6298f213fbf4da64da3e184 Mon Sep 17 00:00:00 2001 From: nagano564 Date: Mon, 2 Apr 2018 11:11:39 -0400 Subject: [PATCH 6/8] added users to params --- apiary.apib | 7 ++++--- test/controllers/api/v1/sessions_controller_test.rb | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apiary.apib b/apiary.apib index 75782efd..b153ed7b 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1020,6 +1020,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f ## Sessions | Create [/api/v1/sessions/user{?email,password}] + Parameters + + user (object, required) - The user name + email (string, required) - The users email + password (string, required) - The users password @@ -1030,8 +1031,8 @@ API endpoints that Operation Code's Rails backend makes available to its React f { user: { - email: @user.email, - password: 'pass123' + email: "kenny@example.com", + password: "pass123" } } @@ -1045,7 +1046,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f "token" => some_long_string_of_characters, "user" => { "id" => 96, - "email" => "@user.email", + "email" => "kenny@example.com", "zip" => "97201", "first_name" => "Keara", "last_name" => "Runolfsson", diff --git a/test/controllers/api/v1/sessions_controller_test.rb b/test/controllers/api/v1/sessions_controller_test.rb index d20d4b7d..cc689237 100644 --- a/test/controllers/api/v1/sessions_controller_test.rb +++ b/test/controllers/api/v1/sessions_controller_test.rb @@ -14,7 +14,6 @@ def setup test 'returns JWT token for succesfull login' do post api_v1_sessions_url, params: @user_params, as: :json json = response.parsed_body - byebug refute_nil json['token'] end From d92b4ad385a9a6780aef38b9ccf84a328c036fcf Mon Sep 17 00:00:00 2001 From: nagano564 Date: Mon, 2 Apr 2018 11:47:27 -0400 Subject: [PATCH 7/8] updated attributes --- apiary.apib | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apiary.apib b/apiary.apib index b153ed7b..59dd81fa 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1017,10 +1017,10 @@ API endpoints that Operation Code's Rails backend makes available to its React f { errors: "Some error message" } -## Sessions | Create [/api/v1/sessions/user{?email,password}] +## Sessions | Create [/api/v1/sessions/{?user,email,password}] + Parameters - + user (object, required) - The user name + + user (object, required) - Object that wraps the user's attributes + email (string, required) - The users email + password (string, required) - The users password @@ -1031,7 +1031,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f { user: { - email: "kenny@example.com", + email: "kennynagano@example.com", password: "pass123" } } @@ -1046,7 +1046,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f "token" => some_long_string_of_characters, "user" => { "id" => 96, - "email" => "kenny@example.com", + "email" => "kennynagano@example.com", "zip" => "97201", "first_name" => "Keara", "last_name" => "Runolfsson", From 22a046c00190dc64ef13f4f7eea66d2955828275 Mon Sep 17 00:00:00 2001 From: nagano564 Date: Mon, 2 Apr 2018 12:42:29 -0400 Subject: [PATCH 8/8] got rid of / --- apiary.apib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiary.apib b/apiary.apib index 59dd81fa..a5160b0e 100644 --- a/apiary.apib +++ b/apiary.apib @@ -1017,7 +1017,7 @@ API endpoints that Operation Code's Rails backend makes available to its React f { errors: "Some error message" } -## Sessions | Create [/api/v1/sessions/{?user,email,password}] +## Sessions | Create [/api/v1/sessions{?user,email,password}] + Parameters + user (object, required) - Object that wraps the user's attributes