added an encode_json method to prep for db
This commit is contained in:
parent
4d0dbb46c4
commit
fa0bd05b06
1 changed files with 8 additions and 2 deletions
|
@ -127,8 +127,14 @@ class Pastebinner
|
||||||
end
|
end
|
||||||
|
|
||||||
def encode_json(raw_paste_text)
|
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?
|
# raw_paste_text should be a RestClient response.body or a string
|
||||||
# full_text: text, #paste_key_name: paste_key
|
time = Time.new
|
||||||
|
hashed_data =
|
||||||
|
{
|
||||||
|
"date": time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
"text": raw_paste_text
|
||||||
|
}
|
||||||
|
hashed_data.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
# keep this method private so we are not letting anyone run any method in our program
|
# keep this method private so we are not letting anyone run any method in our program
|
||||||
|
|
Loading…
Add table
Reference in a new issue