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
- #create_profile ⇒ Object
- #delete_profile_picture ⇒ Object
- #get_profile_info ⇒ Object
- #register ⇒ Object
- #resend_otp ⇒ 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 |
#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_profile_picture ⇒ Object
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 261 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 |
#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
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 236 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
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 |
# File 'app/controllers/usman/api/v1/docs_controller.rb', line 210 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 |