diff --git a/lib/pastebinner/api_client.rb b/lib/pastebinner/api_client.rb index 48e8d07..0385aa7 100644 --- a/lib/pastebinner/api_client.rb +++ b/lib/pastebinner/api_client.rb @@ -41,6 +41,7 @@ module Pastebinner @scraping_api_url = 'https://scrape.pastebin.com' end + # Send a POST request to the /api_post.php endpoint to create a paste. # @param api_dev_key [String] Required: Your unique developer api key # @param api_option [String] Required: Set as paste, this will indicate you want to create a new paste # @param api_paste_code [String] Required: This is the text that will be written inside of your paste @@ -155,6 +156,9 @@ module Pastebinner YAML.safe_load(response.body).first end + # Builds up raw paste and raw paste metadata based on paste keys and creates a hash + # @param [Array] ['paste_key1', 'paste_key2', 'paste_key3'] An Array of Strings that are unique paste keys. + # @return [Hash] def hash_pastes(keys) if keys.is_a? String raw_paste = self.raw_paste_data(keys) @@ -169,11 +173,19 @@ module Pastebinner end end + # Create a hash with paste_metadata and paste_text keys. + # @param raw_paste_data [RestClient::Response] The raw paste data response text + # @param raw_paste_metadata [RestClient::Response] The raw paste metadata response text + # @return [Hash] def hash_paste(raw_paste_data, raw_paste_metadata) { "paste_metadata": raw_paste_metadata, "paste_text": raw_paste_data } end + # Create an Array of json paste documents or a single paste document + # @param key [String] 'pastekey' The unique paste key of the pate intended + # @param keys [Array] ['paste_key1', 'paste_key2', 'paste_key3'] An Array of Strings that are unique paste keys. + # @return [String] || [Array] Json of just one paste document or an Array of multiple. def json_paste(key=nil, keys) # if we give keys, create an array of X json pastes if keys