From fa41c0cb7f51a06eaaff1d6391a93918371fada4 Mon Sep 17 00:00:00 2001 From: booboy Date: Sat, 10 Nov 2018 04:31:32 -0600 Subject: [PATCH] encode_json method and a 1 character change in the filename check --- bin/pastebinner | 2 +- lib/pastebinner.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/pastebinner b/bin/pastebinner index a6516bb..ef92129 100755 --- a/bin/pastebinner +++ b/bin/pastebinner @@ -13,7 +13,7 @@ def download_pastes(pb) data_dir = "../data/" filename = "pastebin_paste_key" keys.map do |id| - if File.exist?(data_dir + filename + "_#{id[:keu]}") + if File.exist?(data_dir + filename + "_#{id[:key]}") puts "#{id[:key]} already exists on your filesystem, skipping..." else File.write(data_dir + filename + "_#{id[:key]}", pb.raw_paste_data(id[:key])) diff --git a/lib/pastebinner.rb b/lib/pastebinner.rb index 286406d..5b35206 100755 --- a/lib/pastebinner.rb +++ b/lib/pastebinner.rb @@ -126,6 +126,11 @@ class Pastebinner url: @scraping_api_url + ENDPOINTS[:scrape_item_meta] + "?i=#{unique_paste_key}") 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 + end + # keep this method private so we are not letting anyone run any method in our program private # this will be the main way to execute any of these methods. this has the exception handling taken care of.