lib/petit/app.rb
# Returns a JSON formatted representation of a collection of shortcodes
# @param shortcodes [Array<Shortcode>] the shortcodes to format into JSON
# @return [String] a JSON representation of a collection of shortcodes.
#  Note that when text/html is requested and error message is displayed.
# @todo Perhaps this should display something instead of an error for plaintext?
Returns a JSON formatted representation of a collection of shortcodes
Returns a JSON formatted representation of a collection of shortcodes
def return_shortcode_collection(shortcodes)
      if request.accept?('application/json') || request.accept?('application/vnd.api+json')
        response.headers['Content-Type'] = 'application/vnd.api+json'
        JSONAPI::Serializer.serialize(shortcodes, is_collection: true).to_json
      else
        'No Plaintext Representation Exists'
      end
    end
def return_shortcode_collection ( shortcodes ) if request . accept? ( 'application/json' ) || request . accept? ( 'application/vnd.api+json' ) response . headers [ 'Content-Type' ] = 'application/vnd.api+json' JSONAPI :: Serializer . serialize ( shortcodes , is_collection : true ) . to_json else 'No Plaintext Representation Exists' end end
Returns a JSON formatted representation of a collection of shortcodes
Returns a JSON formatted representation of a collection of shortcodes
a JSON representation of a collection of shortcodes. Note that when text/html is requested and error message is displayed.
a JSON representation of a collection of shortcodes . Note that when text / html is requested and error message is displayed .
String
shortcodes
the shortcodes to format into JSON
the shortcodes to format into JSON
todo
None