class Strepi::Services::Crunchyroll
Public Class Methods
new(options={})
click to toggle source
# File lib/strepi/crunchyroll.rb, line 4 def initialize(options={}) @endpoint_url = "http://www.crunchyroll.com" @ignore_media = [] end
Public Instance Methods
search(title)
click to toggle source
# File lib/strepi/crunchyroll.rb, line 10 def search(title) new_title = title.gsub(/[^a-z0-9\s]/i, '').gsub(' ', '-') #new title foormat to be inserted into URL for crunchyroll, takes away all non-alphanumeric character and then replaces spaces with dashes titles = [] page_request = Net::HTTP.get_response(URI.parse("#{@endpoint_url}/#{new_title}")) if page_request.code != "200" nil else titles << "#{title} is on Crunchyroll!" end titles end