class DMMCrawler::Attributes::BaseAttributes
Constants
- HTTP_STATUS_CODE_OF_SUCCESS
Public Class Methods
new(url, agent: Agent.instance.agent)
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 8 def initialize(url, agent: Agent.instance.agent) @page = agent.get(url) @r_client = Rdmm::Client.new(affiliate_id: ENV['DMM_AFFILIATE_ID'], api_id: ENV['DMM_API_ID']) end
Public Instance Methods
to_a()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 13 def to_a raise NotImplementedError end
Private Instance Methods
adult_game?()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 27 def adult_game? @page.uri.to_s =~ /dlsoft/ end
affiliateable?()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 19 def affiliateable? @r_client.list_items(site: 'DMM.R18', keyword: title).body['result']['status'] == HTTP_STATUS_CODE_OF_SUCCESS end
art_page?()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 23 def art_page? @page.uri.to_s =~ /doujin/ end
brand()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 51 def brand raise NotImplementedError end
image_url()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 39 def image_url raise NotImplementedError end
submedia()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 43 def submedia raise NotImplementedError end
title()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 31 def title raise NotImplementedError end
title_link()
click to toggle source
# File lib/dmm-crawler/attributes/base_attributes.rb, line 35 def title_link raise NotImplementedError end