slowly updating documentation with rdoc stuff so we can generate yard server
This commit is contained in:
parent
606efdf3b2
commit
bb84940a7a
2 changed files with 17 additions and 4 deletions
|
@ -101,6 +101,9 @@ module Pastebinner
|
|||
params = { 'api_dev_key': api_dev_key }
|
||||
end
|
||||
|
||||
# Send a POST request to the /api_post.php endpoint.
|
||||
# @param params [Hash] object
|
||||
# @return [RestClient::Response] object
|
||||
def api_post(params)
|
||||
response = RestClient::Request.execute(
|
||||
method: :post,
|
||||
|
@ -109,8 +112,10 @@ module Pastebinner
|
|||
)
|
||||
end
|
||||
|
||||
# params is optional for now. to query specific language ?lang=ruby as an example
|
||||
# right now its set to grab the max 250, default is 50. param is ?limit=value
|
||||
# Scrape public pastes can specify specific language with options
|
||||
# @param params DOES NOT WORK - optional, specific language query with ?lang=ruby as an example.
|
||||
# @param limit the number of pastes to scrape
|
||||
# @return [RestClient::Response] object
|
||||
def scrape_public_pastes(_params = nil, limit)
|
||||
response = RestClient::Request.execute(
|
||||
method: :get,
|
||||
|
@ -118,13 +123,17 @@ module Pastebinner
|
|||
)
|
||||
end
|
||||
|
||||
# will extract just the keys from recent public pastes
|
||||
# i think this can be maybe made into a hash instead
|
||||
# Extracts just the keys from recent public pastes.
|
||||
# @param public_pastes [Restclient::Resposne, Restclient::Response] An array of public paste responses returned from the scrape_public_pastes method.
|
||||
# @return ['paste_key1, paste_key2, paste_key3'] An Array of Strings that are unique paste keys.
|
||||
def get_unique_paste_keys(public_pastes)
|
||||
pp = JSON.parse(public_pastes)
|
||||
pp.map { |p| p['key'] }
|
||||
end
|
||||
|
||||
# Sends a GET request to the scraping API with the unique paste key of the paste intended to download
|
||||
# @param unique_paste_key [String] The unique paste key of the paste
|
||||
# @return [RestClient::Response] object
|
||||
def raw_paste_data(unique_paste_key)
|
||||
response = RestClient::Request.execute(
|
||||
method: :get,
|
||||
|
@ -132,6 +141,9 @@ module Pastebinner
|
|||
)
|
||||
end
|
||||
|
||||
# Sends a GET request to the scraping API with the unique paste key of the paste intended. Pulls metadata info.
|
||||
# @param raw_paste_metadata [String] The unique paste key of the paste
|
||||
# @return [Json object?] need to test this.
|
||||
def raw_paste_metadata(unique_paste_key)
|
||||
response = RestClient::Request.execute(
|
||||
method: :get,
|
||||
|
|
|
@ -33,5 +33,6 @@ Gem::Specification.new do |spec|
|
|||
spec.add_development_dependency 'rake', '~> 10.0'
|
||||
spec.add_development_dependency 'rspec', '~> 3.0'
|
||||
spec.add_development_dependency 'pry', '~> 0.11'
|
||||
spec.add_development_dependency 'yard', '~> 0.9.22'
|
||||
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue