Class: Usman::Api::V1::DocsController
- Inherits:
-
Usman::AdminController
- Object
- Kuppayam::BaseController
- Usman::ApplicationController
- Usman::AdminController
- Usman::Api::V1::DocsController
- Defined in:
- app/controllers/usman/api/v1/docs_controller.rb
Instance Method Summary collapse
- #accept_tac ⇒ Object
- #all_contacts ⇒ Object
- #change_number ⇒ Object
- #contacts_sync ⇒ Object
- #create_profile ⇒ Object
- #delete_account ⇒ Object
- #delete_profile_picture ⇒ Object
- #get_profile_info ⇒ Object
- #register ⇒ Object
- #resend_otp ⇒ Object
- #send_otp_to_change_number ⇒ Object
- #single_contact ⇒ Object
- #update_profile ⇒ Object
- #upload_profile_picture ⇒ Object
- #upload_profile_picture_base64 ⇒ Object
- #verify_otp ⇒ Object
Instance Method Details
#accept_tac ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 103 def accept_tac set_title("Accept T&C API") @request_type = "POST" @end_point = "/api/v1/accept_tac" @description = <<-eos This API record the acceptance of the terms and condition and will finish the registration of user & device. <br> It will return API token which can be used for further communication. eos @info = "The user will have to accept terms and conditions everytime he registers a new device" @input_headers = { "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. " } } @input_params = { uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" } } @example_path = "usman/api/v1/docs/"# @examples = ["pos_case_1", "neg_case_1", "neg_case_2", "neg_case_3"] set_nav("docs/usman/accept_tac") render 'kuppayam/api/docs/show' end |
#all_contacts ⇒ Object
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 255 def all_contacts set_title("Get All Contacts") @request_type = "GET" @end_point = "/api/v1/contacts" @description = <<-eos This API fetch all the contacts of coresponding logged user eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"103652edd6bbdc72b770d3c8cb88b18d\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1"] set_nav("docs/usman/all_contacts") render 'kuppayam/api/docs/show' end |
#change_number ⇒ Object
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 399 def change_number set_title("Change Number API") @request_type = "POST" @end_point = "/api/v1/change_number" @description = <<-eos This API along with the OTP will change the mobile number from old to new. eos @input_headers = { "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. " } } @input_params = { otp: { mandatory: true, description: "One Time Password you have received via SMS. (Five Digit)", example: "51234", default: "" }, uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, old_dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+91", default: "" }, old_mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" }, new_dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, new_mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" } } @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2", "neg_case_3", "neg_case_4", "neg_case_5", "neg_case_6", "neg_case_7"] set_nav("docs/usman/change_number") render 'kuppayam/api/docs/show' end |
#contacts_sync ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 210 def contacts_sync set_title("Sync Contacts") @request_type = "POST" @end_point = "/api/v1/contacts/sync" @description = <<-eos This API sync all the contacts with donedeal backend eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"103652edd6bbdc72b770d3c8cb88b18d\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @input_params = { contacts: { mandatory: true, description: "Json array of contact informations", example: '[ { "name": "Mohanlala", "account_type": "com.mollywood", "email": "[email protected]", "address": "xyz, str, efg", "contact_number": "87393993884" }, { "name": "Mammukka", "account_type": "com.mollywood1", "email": "[email protected]", "address": "xyz, str, efg", "contact_number": "7046338475" } ]', default: "" }, } @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1"] set_nav("docs/usman/contacts_sync") render 'kuppayam/api/docs/show' end |
#create_profile ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 132 def create_profile set_title("Create Profile API") @request_type = "POST" @end_point = "/api/v1/create_profile" @description = <<-eos This API will create a profile for a newly registered user eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"87b01adbba90824b57add8cc06ad8738\"", description: "Put the API Token here. This is must for creating a profile. You need to register with your mobile number and verify the otp before you could create a profile" } } @input_params = { uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" } } @example_path = "usman/api/v1/docs/"# @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "neg_case_1", "neg_case_2", "neg_case_3"] set_nav("docs/usman/create_profile") render 'kuppayam/api/docs/show' end |
#delete_account ⇒ Object
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 428 def delete_account set_title("DELETE ACCOUNT API") @request_type = "DELETE" @end_point = "/api/v1/delete_account" @description = <<-eos This API will delete the account from the system and the user will be logged out from all sessions. eos @warning = "This is an irreversible action and the user will not be able to login back to this account again" @input_headers = { "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. " } } @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2"] set_nav("docs/usman/delete_account") render 'kuppayam/api/docs/show' end |
#delete_profile_picture ⇒ Object
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 352 def delete_profile_picture set_title("Delete Profile Picture API") @request_type = "DELETE" @end_point = "/api/v1/profile/profile_picture" @description = <<-eos This API will delete the profile picture eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"87b01adbba90824b57add8cc06ad8738\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2"] set_nav("docs/usman/delete_profile_picture") render 'kuppayam/api/docs/show' end |
#get_profile_info ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 187 def get_profile_info set_title("Get Profile Info API") @request_type = "GET" @end_point = "/api/v1/profile_info" @description = <<-eos This API will return the details of the profile requested including profile picture urls eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"87b01adbba90824b57add8cc06ad8738\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2"] set_nav("docs/usman/get_profile_info") render 'kuppayam/api/docs/show' end |
#register ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 11 def register set_title("Register API") @request_type = "POST" @end_point = "/api/v1/register" @description = <<-eos This API will register the user and the device and will send an OTP for verification. <br> This API can also be used for user login. <br> If the user is already registered, verifying the OTP will get the user logged in (return API token) eos @input_headers = { "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. " } } @input_params = { country_id: { mandatory: true, description: "Country ID is an integer. You may get it from Countries API", example: "100", default: "" }, city_id: { mandatory: false, description: "City ID is an integer. You may get it from Cities API", example: "1030", default: "" }, dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" }, uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, device_token: { mandatory: true, description: "Device Token is a unique token for your device", example: "", default: "" }, device_name: { mandatory: false, description: "The name of your Device", example: "Apple iPhone", default: "" }, device_type: { mandatory: false, description: "", example: "The kind of device you have", default: "iPhone 7 plus" }, operating_system: { mandatory: false, description: "Operating System Name", example: "", default: "" }, software_version: { mandatory: false, description: "Software / OS Version", example: "", default: "" } } @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "neg_case_1", "neg_case_2", "neg_case_3"] set_nav("docs/usman/register") render 'kuppayam/api/docs/show' end |
#resend_otp ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 46 def resend_otp set_title("Resend OTP API") @request_type = "POST" @end_point = "/api/v1/resend_otp" @description = <<-eos This API will resend the OTP for verification eos @warning = "A maximum of 3 attempt is allowed for resending the OTP. 6th request will block the device." @input_headers = { "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. " } } @input_params = { uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" } } @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2", "neg_case_3", "neg_case_4"] set_nav("docs/usman/resend_otp") render 'kuppayam/api/docs/show' end |
#send_otp_to_change_number ⇒ Object
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 375 def send_otp_to_change_number set_title("Send OTP to Change Number - API") @request_type = "POST" @end_point = "/api/v1/send_otp_to_change_number" @description = <<-eos This API will send the OTP as a confirmation to process the request to change the mobile number eos @input_headers = { "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. " } } @input_params = { uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" } } @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2", "neg_case_3", "neg_case_4"] set_nav("docs/usman/send_otp_to_change_number") render 'kuppayam/api/docs/show' end |
#single_contact ⇒ Object
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 278 def single_contact set_title("Single Contact") @request_type = "GET" @end_point = "/api/v1/contacts/:id" @description = <<-eos This API fetch single contacts from the Data base coresponding logged user eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"103652edd6bbdc72b770d3c8cb88b18d\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1"] set_nav("docs/usman/single_contact") render 'kuppayam/api/docs/show' end |
#update_profile ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 159 def update_profile set_title("Update Profile API") @request_type = "POST" @end_point = "/api/v1/update_profile" @description = <<-eos This API will update the profile details. <br> Note the the user id is not passed but the API token in header. eos @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"87b01adbba90824b57add8cc06ad8738\"", description: "Put the API Token here. This is must for creating a profile. You need to register with your mobile number and verify the otp before you could create a profile" } } @input_params = { uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" } } @example_path = "usman/api/v1/docs/"# @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "neg_case_1", "neg_case_2", "neg_case_3"] set_nav("docs/usman/update_profile") render 'kuppayam/api/docs/show' end |
#upload_profile_picture ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 327 def upload_profile_picture set_title("Upload Profile Picture API") @request_type = "POST" @end_point = "/api/v1/profile/upload_profile_picture" @description = <<-eos This APi will upload an image to a profile and will set it as the profile picture. <br> It accept an image in binary format eos @input_headers = { "Authorization" => { value: "Token token=\"87b01adbba90824b57add8cc06ad8738\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @warning = "Do not set Content Type Json as this is a multipart file upload request" @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2", "neg_case_3"] set_nav("docs/usman/upload_profile_picture") render 'kuppayam/api/docs/show' end |
#upload_profile_picture_base64 ⇒ Object
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 301 def upload_profile_picture_base64 set_title("Upload Profile Picture API (base64)") @request_type = "POST" @end_point = "/api/v1/profile/profile_picture_base64" @description = <<-eos This APi will upload an image to a profile and will set it as the profile picture. <br> It accept an image embeded in a json with base64 encoding. eos @warning = "The image has to be base64 encoded." @input_headers = { "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. " }, "Authorization" => { value: "Token token=\"87b01adbba90824b57add8cc06ad8738\"", description: "Put the API Token here. You shall get the API token after registering your device" } } @input_params = {} @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "neg_case_1", "neg_case_2"] set_nav("docs/usman/upload_profile_picture_base64") render 'kuppayam/api/docs/show' end |
#verify_otp ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 74 def verify_otp set_title("Verify OTP API") @request_type = "POST" @end_point = "/api/v1/verify_otp" @description = <<-eos This API verify the OTP. <br> It will return the API token for further communication if the user & device has already been registered. <br> If not, API token is returned in the positive response of Accpet T&C API eos @input_headers = { "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. " } } @input_params = { otp: { mandatory: true, description: "One Time Password you have received via SMS. (Five Digit)", example: "", default: "" }, uuid: { mandatory: true, description: "Universal Unique Identifier. iOS or Android will give you this programatically.", example: "", default: "" }, dialing_prefix: { mandatory: true, description: "International Dialing Prefix for countries", example: "+971", default: "" }, mobile_number: { mandatory: true, description: "Mobile Number without Dialing Prefix", example: "If your mobile number is +971 54 312 9876, pass '543129876' without spaces.", default: "" } } @example_path = "usman/api/v1/docs/" @examples = ["pos_case_1", "pos_case_2", "neg_case_1", "neg_case_2", "neg_case_3", "neg_case_4"] set_nav("docs/usman/verify_otp") render 'kuppayam/api/docs/show' end |