Guest User

Untitled

a guest
Jun 20th, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. ## UsersController
  2. ### Users list
  3. ##### Пользователи, доступные current_user (те имеющие доступ к тем же приложениям)
  4. ----
  5. * **URL**
  6. `/users`
  7. * **Method:**
  8. `GET`
  9. * **Success Response:**
  10. * **Code:** 200
  11. **Content:** `[{"id"=>487, "email"=>"test14@gmail.com"}, {"id"=>488, "email"=>"test15@gmail.com"}]`
  12.  
  13. ### Create user
  14. ----
  15. * **URL**
  16. `/users`
  17. * **Method:**
  18. `POST`
  19. * **Params**
  20. **Required:**
  21. `email=[string]`
  22. `password=[string]`
  23. `client_ids=[array]`
  24. * **Success Response:**
  25. * **Code:** 200
  26. **Content:** `{"id"=>506, "email"=>"test@gmail.com"}`
  27. * **Error Response:**
  28. * **Code:** 422
  29.  
  30. ### User's permissions
  31. ----
  32. * **URL**
  33. `/users/:id/permissions`
  34. * **Method:**
  35. `GET`
  36. * **Params**
  37. **Required:**
  38. `id=[integer]`
  39. `client_id=[integer]`
  40. * **Success Response:**
  41. * **Code:** 200
  42. **Content:** `[{"id"=>329, "abilities"=>{"object1"=>["action1"], "object2"=>["action1", "action2"]}, "client_id"=>1063}]`
  43.  
  44. ## ClientsController
  45. ### Clients list
  46. ----
  47. * **URL**
  48. `/clients`
  49. * **Method:**
  50. `GET`
  51. * **Success Response:**
  52. * **Code:** 200
  53. **Content:** `[{"id"=>1, "name"=>"Client", "app_id"=>"89b033ad-1ac8-4a8a-9870-c88dec90af22", "app_secret"=>"07a46e78-4944-4e39-94a8-44df19db5e90"}]`
  54.  
  55. ### Create client
  56. ----
  57. * **URL**
  58. `/clients`
  59. * **Method:**
  60. `POST`
  61. * **Params**
  62. `{'client':{'name':[string], 'app_id':[string], 'app_secret':[string]}}`
  63. * **Success Response:**
  64. * **Code:** 200
  65. **Content:** `{"id"=>1, "name"=>"New client", "app_id"=>"3c3213d6ccf36a4d", "app_secret"=>"5223a57bf4bbed82"}`
  66. * **Error Response:**
  67. * **Code:** 422
  68.  
  69. ## AbilitiesController
  70. ### Abilities list
  71. ----
  72. * **URL**
  73. `/abilities`
  74. * **Method:**
  75. `GET`
  76. * **Success Response:**
  77. * **Code:** 200
  78. **Content:** `[{"id"=>381, "object_name"=>"Something", "actions"=>["action1", "action2"], "client_id"=>1223}]`
  79.  
  80. ### Create ability
  81. ----
  82. * **URL**
  83. `/abilities`
  84. * **Method:**
  85. `POST`
  86. * **Params**
  87. `{'name':[string], 'actions':[array], 'client_id':[integer]}`
  88. * **Success Response:**
  89. * **Code:** 200
  90. **Content:** `{"id"=>381, "object_name"=>"object", "actions"=>["action1", "action2"], "client_id"=>1265}`
  91. * **Error Response:**
  92. * **Code:** 422
  93.  
  94. ## ActionsController
  95. ### Actions list
  96. ----
  97. * **URL**
  98. `/actions`
  99. * **Method:**
  100. `GET`
  101. * **Params**
  102. `{'ability_id':[integer]}`
  103. * **Success Response:**
  104. * **Code:** 200
  105. **Content:** `{"actions"=>["index", "test"]}`
  106.  
  107. ### Create action
  108. ----
  109. * **URL**
  110. `/actions`
  111. * **Method:**
  112. `POST`
  113. * **Params**
  114. `{'ability_id':[integer], 'action_name':[string]}`
  115. * **Success Response:**
  116. * **Code:** 200
  117. **Content:** `{"object_name"=>"Something", "actions"=>["action1", "action2", "action3"], "client_id"=>1392}`
  118. * **Error Response:**
  119. * **Code:** 422
  120.  
  121. ## PermissionsController
  122. ### Create action
  123. ----
  124. * **URL**
  125. `/permissions`
  126. * **Method:**
  127. `POST`
  128. * **Params**
  129. `{'user_id':[integer], 'client_id':[integer], 'abilities':[json]}`
  130. `abilities example: "{'object1':['action1', 'action2'], 'object2':['action3']}"`
  131. * **Success Response:**
  132. * **Code:** 200
  133. **Content:** `{"id"=>329, "abilities"=>"{'object':['action1']}", "client_id"=>1478}`
  134. * **Error Response:**
  135. * **Code:** 422
  136.  
  137. ## SessionsController
  138. ### Login
  139. ----
  140. * **URL**
  141. `/login`
  142. * **Method:**
  143. `POST`
  144. * **Params**
  145. `{'email':[string], 'password':[string]}`
  146. * **Error Response:**
  147. * **Code:** 401
  148.  
  149. ### Logout
  150. ----
  151. * **URL**
  152. `/logout`
  153. * **Method:**
  154. `GET`
Add Comment
Please, Sign In to add comment