module BadASS
@todo Add rspec testing. Contains a few constants used across BD's site, and a few helper methods.
Constants
- BAD_DRAGON_SKUS
A hash of API mappings of toy SKU to toy name.
- FIRMNESSES
A hash of API mappings of number to firmness.
- SIZES
A hash of API mappings to correctly capitalize a size.
Public Class Methods
drops()
click to toggle source
Get the current drops on the site. @return [Array<BadASS::Toy>]
# File lib/badass.rb, line 24 def self.drops page = 1 toy_list = [] loop do newtoys = JSON.parse(Net::HTTP.get(URI("https://bad-dragon.com/api/inventory-toys?price[min]=0&price[max]=300&noAccessories=false&cumtube=false&suctionCup=false&sort[field]=price&&sort[direction]=asc&page=#{page}&limit=60"))) page += 1 newtoys['toys'].each do |toy| toy_list << BadASS::Toy.new(toy) end break if page > newtoys['totalPages'] end toy_list end
sales()
click to toggle source
Get the current sales on the site. @return [Array<BadASS::Sale>]
# File lib/badass.rb, line 16 def self.sales JSON.parse(Net::HTTP.get(URI('https://bad-dragon.com/api/sales'))).map do |sale| BadASS::Sale.new(sale) end end