usman 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/usman/api/v1/docs_controller.rb +52 -22
  3. data/app/controllers/usman/api/v1/profile_controller.rb +1 -1
  4. data/app/controllers/usman/api/v1/profile_picture_controller.rb +1 -1
  5. data/app/views/kuppayam/api/docs/_navigation.html.erb +9 -9
  6. data/app/views/layouts/kuppayam/_sidebar.html.erb +8 -0
  7. data/app/views/usman/api/v1/docs/accept_tac/_neg_case_1.html.erb +6 -0
  8. data/app/views/usman/api/v1/docs/accept_tac/_neg_case_2.html.erb +5 -0
  9. data/app/views/usman/api/v1/docs/accept_tac/_neg_case_3.html.erb +5 -0
  10. data/app/views/usman/api/v1/docs/accept_tac/_pos_case_1.html.erb +6 -0
  11. data/app/views/usman/api/v1/docs/create_profile/_neg_case_1.html.erb +4 -0
  12. data/app/views/usman/api/v1/docs/create_profile/_neg_case_2.html.erb +4 -0
  13. data/app/views/usman/api/v1/docs/create_profile/_neg_case_3.html.erb +4 -0
  14. data/app/views/usman/api/v1/docs/create_profile/_pos_case_1.html.erb +4 -0
  15. data/app/views/usman/api/v1/docs/{base64_profile_picture → delete_profile_picture}/_neg_case_1.html.erb +4 -0
  16. data/app/views/usman/api/v1/docs/{destroy_profile_picture → delete_profile_picture}/_neg_case_2.html.erb +4 -0
  17. data/app/views/usman/api/v1/docs/{destroy_profile_picture → delete_profile_picture}/_pos_case_1.html.erb +4 -0
  18. data/app/views/usman/api/v1/docs/{profile → get_profile_info}/_neg_case_1.html.erb +4 -8
  19. data/app/views/usman/api/v1/docs/{profile → get_profile_info}/_neg_case_2.html.erb +4 -1
  20. data/app/views/usman/api/v1/docs/{profile → get_profile_info}/_pos_case_1.html.erb +4 -1
  21. data/app/views/usman/api/v1/docs/register/_neg_case_1.html.erb +3 -0
  22. data/app/views/usman/api/v1/docs/register/_neg_case_2.html.erb +3 -0
  23. data/app/views/usman/api/v1/docs/register/_neg_case_3.html.erb +3 -0
  24. data/app/views/usman/api/v1/docs/register/_neg_case_4.html.erb +3 -0
  25. data/app/views/usman/api/v1/docs/register/_pos_case_1.html.erb +3 -0
  26. data/app/views/usman/api/v1/docs/register/_pos_case_2.html.erb +3 -0
  27. data/app/views/usman/api/v1/docs/register/_pos_case_3.html.erb +3 -0
  28. data/app/views/usman/api/v1/docs/resend_otp/_neg_case_1.html.erb +3 -0
  29. data/app/views/usman/api/v1/docs/resend_otp/_neg_case_2.html.erb +3 -0
  30. data/app/views/usman/api/v1/docs/resend_otp/_neg_case_3.html.erb +3 -0
  31. data/app/views/usman/api/v1/docs/resend_otp/_neg_case_4.html.erb +3 -0
  32. data/app/views/usman/api/v1/docs/resend_otp/_pos_case_1.html.erb +3 -0
  33. data/app/views/usman/api/v1/docs/update_profile/_neg_case_1.html.erb +4 -0
  34. data/app/views/usman/api/v1/docs/update_profile/_neg_case_2.html.erb +4 -0
  35. data/app/views/usman/api/v1/docs/update_profile/_neg_case_3.html.erb +4 -0
  36. data/app/views/usman/api/v1/docs/update_profile/_pos_case_1.html.erb +4 -0
  37. data/app/views/usman/api/v1/docs/{profile_picture → upload_profile_picture}/_neg_case_1.html.erb +7 -1
  38. data/app/views/usman/api/v1/docs/{base64_profile_picture → upload_profile_picture}/_neg_case_2.html.erb +4 -0
  39. data/app/views/usman/api/v1/docs/{profile_picture → upload_profile_picture}/_neg_case_3.html.erb +6 -1
  40. data/app/views/usman/api/v1/docs/{profile_picture → upload_profile_picture}/_pos_case_1.html.erb +7 -1
  41. data/app/views/usman/api/v1/docs/{destroy_profile_picture → upload_profile_picture_base64}/_neg_case_1.html.erb +7 -1
  42. data/app/views/usman/api/v1/docs/{profile_picture → upload_profile_picture_base64}/_neg_case_2.html.erb +4 -0
  43. data/app/views/usman/api/v1/docs/{base64_profile_picture → upload_profile_picture_base64}/_pos_case_1.html.erb +7 -1
  44. data/app/views/usman/api/v1/docs/verify_otp/_neg_case_1.html.erb +3 -0
  45. data/app/views/usman/api/v1/docs/verify_otp/_neg_case_2.html.erb +3 -0
  46. data/app/views/usman/api/v1/docs/verify_otp/_neg_case_3.html.erb +3 -0
  47. data/app/views/usman/api/v1/docs/verify_otp/_neg_case_4.html.erb +3 -0
  48. data/app/views/usman/api/v1/docs/verify_otp/_pos_case_1.html.erb +3 -0
  49. data/app/views/usman/api/v1/docs/verify_otp/_pos_case_2.html.erb +3 -0
  50. data/config/routes.rb +7 -7
  51. data/lib/usman/version.rb +1 -1
  52. metadata +17 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da4ef048a641f75ac91c9ebcb697cd43c6f7fd9b
4
- data.tar.gz: 53085820d81ef576b6b40b3a753d0d18fb40e039
3
+ metadata.gz: b328d5adedffe89ca1e6f3665b2ada43b96a3a9c
4
+ data.tar.gz: 1c712a7a5f0a5f3f730e8e42ac8e4cfd9838ebd2
5
5
  SHA512:
6
- metadata.gz: 1df87664bbe20cc17acf9814461719b98b4d74a2748faa9f3a0b9f0cc7cc20af53970c84043642310a87f797a1fb17c678d7738f2c018476c76212b3796a6aec
7
- data.tar.gz: 1bb119d7386e8429368050aef3cf5c2463bc79a4b593546fc451ed110da28ee32f8d4ced1fb59dd990973d5c718198377cb4f08ac24c1dfae516061026be7a9e
6
+ metadata.gz: b19106c8878d4b6455a8b540524134e75e472eb5f9960cc74ec8804580534ea57fbc7733b2ff93758f6d8baff57fb9fbca9daa2b105cc0a00e8ae28573fc9b5f
7
+ data.tar.gz: 29b01c733ecbd10d70204ca17c9b2975eb54eccc2a59db161c2f48242567b8a20f536e853598d6fa16bafd844c963325b07336de51b61910adc888c4e1522aa5
@@ -7,7 +7,11 @@ module Usman
7
7
  set_title("Register API")
8
8
  @request_type = "POST"
9
9
  @end_point = "/api/v1/register"
10
- @description = "This API will register the user and the device and will send an OTP for verification. API will return the api_token if the device is already registered."
10
+ @description = <<-eos
11
+ This API will register the user and the device and will send an OTP for verification. <br>
12
+ This API can also be used for user login. <br>
13
+ If the user is already registered, verifying the OTP will get the user logged in (return API token)
14
+ eos
11
15
 
12
16
  @input_headers = {
13
17
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " }
@@ -38,7 +42,9 @@ module Usman
38
42
  set_title("Resend OTP API")
39
43
  @request_type = "POST"
40
44
  @end_point = "/api/v1/resend_otp"
41
- @description = "This API will resend the OTP for verification"
45
+ @description = <<-eos
46
+ This API will resend the OTP for verification
47
+ eos
42
48
 
43
49
  @warning = "A maximum of 3 attempt is allowed for resending the OTP. 6th request will block the device."
44
50
 
@@ -64,7 +70,11 @@ module Usman
64
70
  set_title("Verify OTP API")
65
71
  @request_type = "POST"
66
72
  @end_point = "/api/v1/verify_otp"
67
- @description = "This API verify the OTP and returns the API token for further communication"
73
+ @description = <<-eos
74
+ This API verify the OTP. <br>
75
+ It will return the API token for further communication if the user & device has already been registered. <br>
76
+ If not, API token is returned in the positive response of Accpet T&C API
77
+ eos
68
78
 
69
79
  @input_headers = {
70
80
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " }
@@ -89,7 +99,10 @@ module Usman
89
99
  set_title("Accept T&C API")
90
100
  @request_type = "POST"
91
101
  @end_point = "/api/v1/accept_tac"
92
- @description = "This API record the acceptance of the terms and condition."
102
+ @description = <<-eos
103
+ This API record the acceptance of the terms and condition and will finish the registration of user & device. <br>
104
+ It will return API token which can be used for further communication.
105
+ eos
93
106
 
94
107
  @info = "The user will have to accept terms and conditions everytime he registers a new device"
95
108
 
@@ -115,7 +128,9 @@ module Usman
115
128
  set_title("Create Profile API")
116
129
  @request_type = "POST"
117
130
  @end_point = "/api/v1/create_profile"
118
- @description = "This API will create a profile for a newly registered user"
131
+ @description = <<-eos
132
+ This API will create a profile for a newly registered user
133
+ eos
119
134
 
120
135
  @input_headers = {
121
136
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " },
@@ -140,7 +155,10 @@ module Usman
140
155
  set_title("Update Profile API")
141
156
  @request_type = "POST"
142
157
  @end_point = "/api/v1/update_profile"
143
- @description = "This API will update the profile details"
158
+ @description = <<-eos
159
+ This API will update the profile details. <br>
160
+ Note the the user id is not passed but the API token in header.
161
+ eos
144
162
 
145
163
  @input_headers = {
146
164
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " },
@@ -161,11 +179,13 @@ module Usman
161
179
  render 'kuppayam/api/docs/show'
162
180
  end
163
181
 
164
- def profile
165
- set_title("Profile API")
182
+ def get_profile_info
183
+ set_title("Get Profile Info API")
166
184
  @request_type = "GET"
167
- @end_point = "/api/v1/profile/base64_profile_picture"
168
- @description = "This API will return the details of the profile requested including image urls."
185
+ @end_point = "/api/v1/profile_info"
186
+ @description = <<-eos
187
+ This API will return the details of the profile requested including profile picture urls
188
+ eos
169
189
 
170
190
  @input_headers = {
171
191
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " },
@@ -177,16 +197,21 @@ module Usman
177
197
  @example_path = "usman/api/v1/docs/"
178
198
  @examples = ["pos_case_1", "neg_case_1", "neg_case_2"]
179
199
 
180
- set_nav("docs/profile")
200
+ set_nav("docs/get_profile_info")
181
201
 
182
202
  render 'kuppayam/api/docs/show'
183
203
  end
184
204
 
185
- def base64_profile_picture
205
+ def upload_profile_picture_base64
186
206
  set_title("Upload Profile Picture API (base64)")
187
207
  @request_type = "POST"
188
- @end_point = "/api/v1/profile/base64_profile_picture"
189
- @description = "This API will return the details of the profile requested including image urls."
208
+ @end_point = "/api/v1/profile/profile_picture_base64"
209
+ @description = <<-eos
210
+ This APi will upload an image to a profile and will set it as the profile picture. <br>
211
+ It accept an image embeded in a json with base64 encoding.
212
+ eos
213
+
214
+ @warning = "The image has to be base64 encoded."
190
215
 
191
216
  @input_headers = {
192
217
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " },
@@ -198,16 +223,19 @@ module Usman
198
223
  @example_path = "usman/api/v1/docs/"
199
224
  @examples = ["pos_case_1", "neg_case_1", "neg_case_2"]
200
225
 
201
- set_nav("docs/base64_profile_picture")
226
+ set_nav("docs/upload_profile_picture_base64")
202
227
 
203
228
  render 'kuppayam/api/docs/show'
204
229
  end
205
230
 
206
- def profile_picture
231
+ def upload_profile_picture
207
232
  set_title("Upload Profile Picture API")
208
233
  @request_type = "POST"
209
- @end_point = "/api/v1/profile/profile_picture"
210
- @description = "This API will return the details of the profile requested including image urls."
234
+ @end_point = "/api/v1/profile/upload_profile_picture"
235
+ @description = <<-eos
236
+ This APi will upload an image to a profile and will set it as the profile picture. <br>
237
+ It accept an image in binary format
238
+ eos
211
239
 
212
240
  @input_headers = {
213
241
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " },
@@ -224,11 +252,13 @@ module Usman
224
252
  render 'kuppayam/api/docs/show'
225
253
  end
226
254
 
227
- def destroy_profile_picture
255
+ def delete_profile_picture
228
256
  set_title("Delete Profile Picture API")
229
257
  @request_type = "DELETE"
230
- @end_point = "/api/v1/profile"
231
- @description = "This API will return the details of the profile requested including image urls."
258
+ @end_point = "/api/v1/profile/profile_picture"
259
+ @description = <<-eos
260
+ This API will delete the profile picture
261
+ eos
232
262
 
233
263
  @input_headers = {
234
264
  "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " },
@@ -240,7 +270,7 @@ module Usman
240
270
  @example_path = "usman/api/v1/docs/"
241
271
  @examples = ["pos_case_1", "neg_case_1", "neg_case_2", "neg_case_3"]
242
272
 
243
- set_nav("docs/destroy_profile_picture")
273
+ set_nav("docs/delete_profile_picture")
244
274
 
245
275
  render 'kuppayam/api/docs/show'
246
276
  end
@@ -112,7 +112,7 @@ module Usman
112
112
  render_json_response(proc_code)
113
113
  end
114
114
 
115
- def profile
115
+ def profile_info
116
116
  proc_code = Proc.new do
117
117
  if @current_registration
118
118
  unless @current_user
@@ -5,7 +5,7 @@ module Usman
5
5
 
6
6
  include ImageUploaderHelper
7
7
 
8
- def base64_profile_picture
8
+ def profile_picture_base64
9
9
  proc_code = Proc.new do
10
10
  if @current_registration
11
11
  unless @current_user
@@ -35,26 +35,26 @@
35
35
  <span class="hidden-xs">Update Profile</span>
36
36
  </a>
37
37
  </li>
38
- <li class="<%= nav_active?('docs/profile') ? 'active' : '' %>">
39
- <a href="/docs/api/v1/profile">
38
+ <li class="<%= nav_active?('docs/get_profile_info') ? 'active' : '' %>">
39
+ <a href="/docs/api/v1/get_profile_info">
40
40
  <i class="fa-globe visible-xs"></i>
41
- <span class="hidden-xs">Profile</span>
41
+ <span class="hidden-xs">Get Profile Info</span>
42
42
  </a>
43
43
  </li>
44
- <li class="<%= nav_active?('docs/base64_profile_picture') ? 'active' : '' %>">
45
- <a href="/docs/api/v1/base64_profile_picture">
44
+ <li class="<%= nav_active?('docs/upload_profile_picture_base64') ? 'active' : '' %>">
45
+ <a href="/docs/api/v1/upload_profile_picture_base64">
46
46
  <i class="fa-globe visible-xs"></i>
47
47
  <span class="hidden-xs">Upload Profile Picture (Base64)</span>
48
48
  </a>
49
49
  </li>
50
- <li class="<%= nav_active?('docs/profile_picture') ? 'active' : '' %>">
51
- <a href="/docs/api/v1/profile_picture">
50
+ <li class="<%= nav_active?('docs/upload_profile_picture') ? 'active' : '' %>">
51
+ <a href="/docs/api/v1/upload_profile_picture">
52
52
  <i class="fa-globe visible-xs"></i>
53
53
  <span class="hidden-xs">Upload Profile Picture</span>
54
54
  </a>
55
55
  </li>
56
- <li class="<%= nav_active?('docs/destroy_profile_picture') ? 'active' : '' %>">
57
- <a href="/docs/api/v1/destroy_profile_picture">
56
+ <li class="<%= nav_active?('docs/delete_profile_picture') ? 'active' : '' %>">
57
+ <a href="/docs/api/v1/delete_profile_picture">
58
58
  <i class="fa-globe visible-xs"></i>
59
59
  <span class="hidden-xs">Delete Profile Picture</span>
60
60
  </a>
@@ -96,6 +96,14 @@
96
96
  </li>
97
97
  <% end %>
98
98
 
99
+ <!-- Documentation -->
100
+ <li class="<%= nav_active?('docs/index') ? 'active' : '' %>">
101
+ <a href="/docs/api/v1/register">
102
+ <i class="fa-file-code-o"></i>
103
+ <span class="title">Documentation</span>
104
+ </a>
105
+ </li>
106
+
99
107
  </ul>
100
108
 
101
109
  </div>
@@ -3,6 +3,12 @@
3
3
  api_title = "Negative Case - 1 - should not accept the terms and conditions if the device is not verified"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/accept_tac
9
+
10
+ In the request body, pass the following as raw json:
11
+
6
12
  {
7
13
  "terms_and_conditions": 1,
8
14
  "uuid": "<PENDING UUID>",
@@ -3,6 +3,11 @@
3
3
  api_title = "Negative Case - 2 - should respond with proper errors if no params are passed"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/accept_tac
9
+
10
+ In the request body, pass the following as raw json:
6
11
  {}
7
12
  eos
8
13
 
@@ -3,6 +3,11 @@
3
3
  api_title = "Negative Case - 3 - should respond with proper errors if T&C is not accepted"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/accept_tac
9
+
10
+ In the request body, pass the following as raw json:
6
11
  {
7
12
  "terms_and_conditions": 0,
8
13
  "uuid": "<VERIFIED UUID>",
@@ -3,6 +3,12 @@
3
3
  api_title = "Positive Case - 1 - should accept the terms and conditions if the device is verified and all inputs are valid"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/accept_tac
9
+
10
+ In the request body, pass the following as raw json:
11
+
6
12
  {
7
13
  "terms_and_conditions": 1,
8
14
  "uuid": "<VERIFIED UUID>",
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if api token is not present"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: nil
9
+ POST #{request.base_url}/api/v1/create_profile
6
10
  {
7
11
  "name": "Name",
8
12
  "gender": "male",
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 2 - should set proper errors if the profile already exists"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/create_profile
6
10
  {
7
11
  "name": "Name",
8
12
  "gender": "male",
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 3 - should set proper errors if the inputs are not correct"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/create_profile
6
10
  {}
7
11
  eos
8
12
 
@@ -3,6 +3,10 @@
3
3
  api_title = "Positive Case - 1 - should create the profile"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/create_profile
6
10
  {
7
11
  "name": "Name",
8
12
  "gender": "male",
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if no api token"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: nil
9
+ DELETE #{request.base_url}/api/v1/profile/profile_picture
6
10
  {}
7
11
  eos
8
12
 
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 2 - should set proper errors if the profile doesn't exists"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ DELETE #{request.base_url}/api/v1/profile/profile_picture
6
10
  {}
7
11
  eos
8
12
 
@@ -3,6 +3,10 @@
3
3
  api_title = "Positive Case - 1 - should delete a profile picture for a user"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ DELETE #{request.base_url}/api/v1/profile/profile_picture
6
10
  {}
7
11
  eos
8
12
 
@@ -3,14 +3,10 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if api token is not present"
4
4
 
5
5
  api_input = <<-eos
6
- {
7
- "name": "Name",
8
- "gender": "male",
9
- "date_of_birth": "10/10/1980",
10
- "email": "name@domain.com",
11
- "country_id": "1",
12
- "city_id": "2"
13
- }
6
+ Example:
7
+
8
+ Authorization: nil
9
+ GET #{request.base_url}/api/v1/profile/profile_picture
14
10
  eos
15
11
 
16
12
  api_output = <<-eos
@@ -3,7 +3,10 @@
3
3
  api_title = "Negative Case - 2 - should set proper errors if the profile didn't exist"
4
4
 
5
5
  api_input = <<-eos
6
- {}
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ GET #{request.base_url}/api/v1/profile/profile_picture
7
10
  eos
8
11
 
9
12
  api_output = <<-eos
@@ -3,7 +3,10 @@
3
3
  api_title = "Positive Case - 1 - should return the profile details along with picture"
4
4
 
5
5
  api_input = <<-eos
6
- {}
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ GET #{request.base_url}/api/v1/profile/profile_picture
7
10
  eos
8
11
 
9
12
  api_output = <<-eos
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if no input is given"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {}
7
10
  eos
8
11
 
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 2 - should set proper errors when device information is missing"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {
7
10
  "country_id": "1",
8
11
  "dialing_prefix": "+92",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 3 - should set proper errors when registration information is missing"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {
7
10
  "uuid": "jh01u2g01h301h21h23",
8
11
  "device_token": "0182y3b28107b31",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 4 - should set proper errors for device is blocked"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {
7
10
  "uuid": "<BLOCKED DEVICE UUID>",
8
11
  "device_token": "<BLOCKED DEVICE DEVICE TOKEN>",
@@ -3,6 +3,9 @@
3
3
  api_title = "Positive Case - 1 - should register and add a new device"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {
7
10
  "country_id": "1",
8
11
  "city_id": "2",
@@ -3,6 +3,9 @@
3
3
  api_title = "Positive Case - 2 - should register and reuse an existing registration information"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {
7
10
  "country_id": "1",
8
11
  "city_id": "2",
@@ -3,6 +3,9 @@
3
3
  api_title = "Positive Case - 3 - should register and reuse an existing registration & device information"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/register
6
9
  {
7
10
  "country_id": "1",
8
11
  "city_id": "2",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 1 - should respond with proper errors if no parameters are passed"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/resend_otp
6
9
  {}
7
10
  eos
8
11
 
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 2 - should respond with proper errors if mobile number is not registered"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/resend_otp
6
9
  {
7
10
  "dialing_prefix": "+91",
8
11
  "mobile_number": "<NEW MOBILE NUMBER>",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 3 - should respond with proper errors if uuid is not registered"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/resend_otp
6
9
  {
7
10
  "dialing_prefix": "+91",
8
11
  "mobile_number": "<REGISTERED MOBILE NUMBER>",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 4 - should respond with proper errors if the device is blocked"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/resend_otp
6
9
  {
7
10
  "dialing_prefix": "+91",
8
11
  "mobile_number": "<REGISTERED MOBILE NUMBER>",
@@ -3,6 +3,9 @@
3
3
  api_title = "Positive Case - 1 - should resend the otp for valid inputs"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/resend_otp
6
9
  {
7
10
  "uuid": "asd907asdba78sbda",
8
11
  "mobile_number": "292991230",
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if api token is not present"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: nil
9
+ PUT #{request.base_url}/api/v1/update_profile
6
10
  {
7
11
  "name": "Name",
8
12
  "gender": "male",
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 2 - should set proper errors if the profile doesn't exist"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ PUT #{request.base_url}/api/v1/update_profile
6
10
  {}
7
11
  eos
8
12
 
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 3 - should set proper errors if the inputs are not correct"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ PUT #{request.base_url}/api/v1/update_profile
6
10
  {}
7
11
  eos
8
12
 
@@ -3,6 +3,10 @@
3
3
  api_title = "Positive Case - 1 - should create the profile"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ PUT #{request.base_url}/api/v1/update_profile
6
10
  {
7
11
  "name": "Name",
8
12
  "gender": "male",
@@ -3,7 +3,13 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if no api token"
4
4
 
5
5
  api_input = <<-eos
6
- {}
6
+ Example:
7
+
8
+ Authorization: nil
9
+ POST #{request.base_url}/api/v1/profile/profile_picture
10
+ {
11
+ "image": "<Uploaded File in Binary Format>"
12
+ }
7
13
  eos
8
14
 
9
15
  api_output = <<-eos
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 1 - should respond with proper errors for invalid arguments"
4
4
 
5
5
  api_input = <<-eos
6
+ {}Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/profile/profile_picture
6
10
  {}
7
11
  eos
8
12
 
@@ -3,7 +3,12 @@
3
3
  api_title = "Negative Case - 2 - should set proper errors if invalid image data is passed"
4
4
 
5
5
  api_input = <<-eos
6
- { "image": "<upload a file format which is not supported. e.g: csv>"}
6
+
7
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
8
+ POST #{request.base_url}/api/v1/profile/profile_picture
9
+ {
10
+ "image": "<Uploaded File - Not Support. e.g: CSV>"
11
+ }
7
12
  eos
8
13
 
9
14
  api_output = <<-eos
@@ -3,7 +3,13 @@
3
3
  api_title = "Positive Case - 1 - should upload a profile picture"
4
4
 
5
5
  api_input = <<-eos
6
- {}
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/profile/profile_picture
10
+ {
11
+ "image": "<Uploaded File in Binary Format>"
12
+ }
7
13
  eos
8
14
 
9
15
  api_output = <<-eos
@@ -3,7 +3,13 @@
3
3
  api_title = "Negative Case - 1 - should set proper errors if no api token"
4
4
 
5
5
  api_input = <<-eos
6
- {}
6
+ Example:
7
+
8
+ Authorization: nil
9
+ POST #{request.base_url}/api/v1/profile/profile_picture_base64
10
+ {
11
+ "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCYAAACNbyblAAAAHElEQVQI12P4//8w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
12
+ }
7
13
  eos
8
14
 
9
15
  api_output = <<-eos
@@ -3,6 +3,10 @@
3
3
  api_title = "Negative Case - 1 - should respond with proper errors for invalid arguments"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/profile/profile_picture_base64
6
10
  {}
7
11
  eos
8
12
 
@@ -3,7 +3,13 @@
3
3
  api_title = "Positive Case - 1 - should upload a profile picture in base64 format"
4
4
 
5
5
  api_input = <<-eos
6
- {}
6
+ Example:
7
+
8
+ Authorization: Token token="87b01adbba90824b57add8cc06ad8738"
9
+ POST #{request.base_url}/api/v1/profile/profile_picture_base64
10
+ {
11
+ "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCYAAACNbyblAAAAHElEQVQI12P4//8w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
12
+ }
7
13
  eos
8
14
 
9
15
  api_output = <<-eos
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 1 - should respond with proper errors if no parameters are passed"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/verify_otp
6
9
  {}
7
10
  eos
8
11
 
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 2 - should respond with proper errors if mobile number is not registered"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/verify_otp
6
9
  {
7
10
  "otp": "11111",
8
11
  "dialing_prefix": "+91",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 3 - should respond with proper errors if uuid is not registered"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/verify_otp
6
9
  {
7
10
  "otp": "11111",
8
11
  "dialing_prefix": "+91",
@@ -3,6 +3,9 @@
3
3
  api_title = "Negative Case - 4 - should respond with proper errors if the device is blocked"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/verify_otp
6
9
  {
7
10
  "otp": "11111",
8
11
  "dialing_prefix": "+91",
@@ -3,6 +3,9 @@
3
3
  api_title = "Positive Case - 1 - should verify an otp verification request from a pending device"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/verify_otp
6
9
  {
7
10
  "otp": "11111",
8
11
  "uuid": "<PENDING UUID>",
@@ -3,6 +3,9 @@
3
3
  api_title = "Positive Case - 2 - should verify the otp if the device is verified, tac is accpted and return the api token"
4
4
 
5
5
  api_input = <<-eos
6
+ Example:
7
+
8
+ POST #{request.base_url}/api/v1/verify_otp
6
9
  {
7
10
  "otp": "11111",
8
11
  "uuid": "<REGISTERED UUID>",
data/config/routes.rb CHANGED
@@ -54,11 +54,11 @@ Usman::Engine.routes.draw do
54
54
 
55
55
  # Profile
56
56
  post :create_profile, :controller => "profile"
57
- post :update_profile, :controller => "profile"
58
- get :profile, :controller => "profile"
57
+ put :update_profile, :controller => "profile"
58
+ get :profile_info, :controller => "profile"
59
59
 
60
60
  # Profile Picture
61
- post 'profile/base64_profile_picture', :controller => "profile_picture", action: :base64_profile_picture
61
+ post 'profile/profile_picture_base64', :controller => "profile_picture", action: :profile_picture_base64
62
62
  post 'profile/profile_picture', :controller => "profile_picture", action: :profile_picture
63
63
  delete 'profile/profile_picture', :controller => "profile_picture", action: :destroy_profile_picture
64
64
  end
@@ -75,11 +75,11 @@ Usman::Engine.routes.draw do
75
75
  get 'create_profile', :controller => "docs"
76
76
  get 'update_profile', :controller => "docs"
77
77
  get 'update_profile', :controller => "docs"
78
- get 'profile', :controller => "docs"
78
+ get 'get_profile_info', :controller => "docs"
79
79
 
80
- get 'base64_profile_picture', :controller => "docs"
81
- get 'profile_picture', :controller => "docs"
82
- get 'destroy_profile_picture', :controller => "docs"
80
+ get 'upload_profile_picture_base64', :controller => "docs"
81
+ get 'upload_profile_picture', :controller => "docs"
82
+ get 'delete_profile_picture', :controller => "docs"
83
83
  end
84
84
  end
85
85
  end
data/lib/usman/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Usman
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -127,7 +127,7 @@ dependencies:
127
127
  version: '0.1'
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: 0.1.8
130
+ version: 0.1.9
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
@@ -137,7 +137,7 @@ dependencies:
137
137
  version: '0.1'
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 0.1.8
140
+ version: 0.1.9
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: bcrypt
143
143
  requirement: !ruby/object:Gem::Requirement
@@ -420,23 +420,16 @@ files:
420
420
  - app/views/usman/api/v1/docs/accept_tac/_neg_case_2.html.erb
421
421
  - app/views/usman/api/v1/docs/accept_tac/_neg_case_3.html.erb
422
422
  - app/views/usman/api/v1/docs/accept_tac/_pos_case_1.html.erb
423
- - app/views/usman/api/v1/docs/base64_profile_picture/_neg_case_1.html.erb
424
- - app/views/usman/api/v1/docs/base64_profile_picture/_neg_case_2.html.erb
425
- - app/views/usman/api/v1/docs/base64_profile_picture/_pos_case_1.html.erb
426
423
  - app/views/usman/api/v1/docs/create_profile/_neg_case_1.html.erb
427
424
  - app/views/usman/api/v1/docs/create_profile/_neg_case_2.html.erb
428
425
  - app/views/usman/api/v1/docs/create_profile/_neg_case_3.html.erb
429
426
  - app/views/usman/api/v1/docs/create_profile/_pos_case_1.html.erb
430
- - app/views/usman/api/v1/docs/destroy_profile_picture/_neg_case_1.html.erb
431
- - app/views/usman/api/v1/docs/destroy_profile_picture/_neg_case_2.html.erb
432
- - app/views/usman/api/v1/docs/destroy_profile_picture/_pos_case_1.html.erb
433
- - app/views/usman/api/v1/docs/profile/_neg_case_1.html.erb
434
- - app/views/usman/api/v1/docs/profile/_neg_case_2.html.erb
435
- - app/views/usman/api/v1/docs/profile/_pos_case_1.html.erb
436
- - app/views/usman/api/v1/docs/profile_picture/_neg_case_1.html.erb
437
- - app/views/usman/api/v1/docs/profile_picture/_neg_case_2.html.erb
438
- - app/views/usman/api/v1/docs/profile_picture/_neg_case_3.html.erb
439
- - app/views/usman/api/v1/docs/profile_picture/_pos_case_1.html.erb
427
+ - app/views/usman/api/v1/docs/delete_profile_picture/_neg_case_1.html.erb
428
+ - app/views/usman/api/v1/docs/delete_profile_picture/_neg_case_2.html.erb
429
+ - app/views/usman/api/v1/docs/delete_profile_picture/_pos_case_1.html.erb
430
+ - app/views/usman/api/v1/docs/get_profile_info/_neg_case_1.html.erb
431
+ - app/views/usman/api/v1/docs/get_profile_info/_neg_case_2.html.erb
432
+ - app/views/usman/api/v1/docs/get_profile_info/_pos_case_1.html.erb
440
433
  - app/views/usman/api/v1/docs/register/_neg_case_1.html.erb
441
434
  - app/views/usman/api/v1/docs/register/_neg_case_2.html.erb
442
435
  - app/views/usman/api/v1/docs/register/_neg_case_3.html.erb
@@ -453,6 +446,13 @@ files:
453
446
  - app/views/usman/api/v1/docs/update_profile/_neg_case_2.html.erb
454
447
  - app/views/usman/api/v1/docs/update_profile/_neg_case_3.html.erb
455
448
  - app/views/usman/api/v1/docs/update_profile/_pos_case_1.html.erb
449
+ - app/views/usman/api/v1/docs/upload_profile_picture/_neg_case_1.html.erb
450
+ - app/views/usman/api/v1/docs/upload_profile_picture/_neg_case_2.html.erb
451
+ - app/views/usman/api/v1/docs/upload_profile_picture/_neg_case_3.html.erb
452
+ - app/views/usman/api/v1/docs/upload_profile_picture/_pos_case_1.html.erb
453
+ - app/views/usman/api/v1/docs/upload_profile_picture_base64/_neg_case_1.html.erb
454
+ - app/views/usman/api/v1/docs/upload_profile_picture_base64/_neg_case_2.html.erb
455
+ - app/views/usman/api/v1/docs/upload_profile_picture_base64/_pos_case_1.html.erb
456
456
  - app/views/usman/api/v1/docs/verify_otp/_neg_case_1.html.erb
457
457
  - app/views/usman/api/v1/docs/verify_otp/_neg_case_2.html.erb
458
458
  - app/views/usman/api/v1/docs/verify_otp/_neg_case_3.html.erb