lib/petit/app.rb
# Gets a suggested name for a shortcode
# @return [String] the suggested shortcode name
Gets a suggested name for a shortcode
Gets a suggested name for a shortcode
def return_suggestion
      suggestion = Petit::Shortcode.suggest
      if request.accept?('application/json') || request.accept?('application/vnd.api+json')
        response.headers['Content-Type'] = 'application/vnd.api+json'
        json_body = {
          data: {
            type: 'suggestion',
            id: suggestion,
            attributes: {
              name: suggestion
            }
          }
        }
        json_body.to_json
      else
        suggestion
      end
    end
def return_suggestion suggestion = Petit :: Shortcode . suggest if request . accept? ( 'application/json' ) || request . accept? ( 'application/vnd.api+json' ) response . headers [ 'Content-Type' ] = 'application/vnd.api+json' json_body = { data : { type : 'suggestion' , id : suggestion , attributes : { name : suggestion } } } json_body . to_json else suggestion end end
Gets a suggested name for a shortcode
Gets a suggested name for a shortcode
the suggested shortcode name
the suggested shortcode name
String