added an encode_json method to prep for db

This commit is contained in:
booboy 2018-11-17 18:37:26 -06:00
parent 4d0dbb46c4
commit fa0bd05b06

View file

@ -127,8 +127,14 @@ class Pastebinner
end
def encode_json(raw_paste_text)
# add in a method here that will add serialize the raw paste data in json, and add in two keys i think should be good enough to send off to a db?
# full_text: text, #paste_key_name: paste_key
# raw_paste_text should be a RestClient response.body or a string
time = Time.new
hashed_data =
{
"date": time.strftime("%Y-%m-%d %H:%M:%S"),
"text": raw_paste_text
}
hashed_data.to_json
end
# keep this method private so we are not letting anyone run any method in our program