Class: BrZipCode::ZipCodeController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- BrZipCode::ZipCodeController
- Defined in:
- app/controllers/br_zip_code/zip_code_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/br_zip_code/zip_code_controller.rb', line 3 def show begin response = BrZipCode.get(params[:zip_code] || params[:id]) if response.nil? render json: { success: false, error: 'not-found', message: I18n.t('br_zip_code.not_found') } else render json: { success: true, zip_code_info: response } end rescue Net::OpenTimeout render json: { success: false, error: 'not-found', message: I18n.t('br_zip_code.timeout') } end end |