pastebinner/examples/examples.rb

28 lines
899 B
Ruby
Raw Permalink Normal View History

#### INITIAL STEPS
#
# setup our object and grab a session key
pb = Pastebinner::ApiClient.new(ENV['pastebin_api_key'], ENV['pastebin_username'], ENV['pastebin_password'])
api_dev_key = ENV['pastebin_api_key']
#### CREATE PASTE
# prepare some sample paste data to send
paste_data = 'this is a test paste two two two.'
# prepare our paste params
params = { "api_dev_key": api_dev_key, "api_option": 'paste', "api_paste_code": paste_data }
puts pb.create_paste(params)
#### SCRAPE PUBLIC PASTES
paste_max = 50
# set to scrape 50 pastes, max is 250 (sometimes can get rate limited when around 250 range)
puts pb.scrape_public_pastes(paste_max)
#### SCRAPING - WHITELISTED IP ONLY
#### SCRAPE RAW PASTE DATA OF A PASTE KEY
puts pb.raw_paste_data('Gkb4ukK9')
#### SCRAPE RAW METADATA OF A PASTE KEY (WORKS WITH WHITELISTED IP ONLY)
puts pb.raw_paste_metadata('Gkb4ukK9')
### MORE EXAMPLES TO COME