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 }
|
params = { 'api_dev_key': api_dev_key }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Send a POST request to the /api_post.php endpoint.
|
||||||
|
# @param params [Hash] object
|
||||||
|
# @return [RestClient::Response] object
|
||||||
def api_post(params)
|
def api_post(params)
|
||||||
response = RestClient::Request.execute(
|
response = RestClient::Request.execute(
|
||||||
method: :post,
|
method: :post,
|
||||||
|
@ -109,8 +112,10 @@ module Pastebinner
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# params is optional for now. to query specific language ?lang=ruby as an example
|
# Scrape public pastes can specify specific language with options
|
||||||
# right now its set to grab the max 250, default is 50. param is ?limit=value
|
# @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)
|
def scrape_public_pastes(_params = nil, limit)
|
||||||
response = RestClient::Request.execute(
|
response = RestClient::Request.execute(
|
||||||
method: :get,
|
method: :get,
|
||||||
|
@ -118,13 +123,17 @@ module Pastebinner
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# will extract just the keys from recent public pastes
|
# Extracts just the keys from recent public pastes.
|
||||||
# i think this can be maybe made into a hash instead
|
# @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)
|
def get_unique_paste_keys(public_pastes)
|
||||||
pp = JSON.parse(public_pastes)
|
pp = JSON.parse(public_pastes)
|
||||||
pp.map { |p| p['key'] }
|
pp.map { |p| p['key'] }
|
||||||
end
|
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)
|
def raw_paste_data(unique_paste_key)
|
||||||
response = RestClient::Request.execute(
|
response = RestClient::Request.execute(
|
||||||
method: :get,
|
method: :get,
|
||||||
|
@ -132,6 +141,9 @@ module Pastebinner
|
||||||
)
|
)
|
||||||
end
|
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)
|
def raw_paste_metadata(unique_paste_key)
|
||||||
response = RestClient::Request.execute(
|
response = RestClient::Request.execute(
|
||||||
method: :get,
|
method: :get,
|
||||||
|
|
|
@ -33,5 +33,6 @@ Gem::Specification.new do |spec|
|
||||||
spec.add_development_dependency 'rake', '~> 10.0'
|
spec.add_development_dependency 'rake', '~> 10.0'
|
||||||
spec.add_development_dependency 'rspec', '~> 3.0'
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
||||||
spec.add_development_dependency 'pry', '~> 0.11'
|
spec.add_development_dependency 'pry', '~> 0.11'
|
||||||
|
spec.add_development_dependency 'yard', '~> 0.9.22'
|
||||||
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
spec.add_runtime_dependency 'rest-client', '~> 2.0'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue