class Nokaya::ADN

Attributes

author[R]

Public Class Methods

new(args, options = {}) click to toggle source
Calls superclass method
# File lib/nokaya/adn.rb, line 8
def initialize args, options = {}
  super(args, options)
  url = if options[:post]
          "https://photos.app.net/#{args[0]}/1"
        else
          args[0]
        end
  @type = :adn
  parsed = parse(url)
  @urls = [get_basic(parsed)].compact
  @author = author_name(parsed)
  @filenames = name_files()
end

Private Instance Methods

author_name(page) click to toggle source
# File lib/nokaya/adn.rb, line 24
def author_name page
  page.css('.p-nickname')[0].text unless page.nil?
end
name_files() click to toggle source
# File lib/nokaya/adn.rb, line 32
def name_files
  unless @urls.empty?
    @name ||= @workers.sanitize(@author)
    ["#{@type.to_s}-#{@name}-#{post_id(args)}.jpg"]
  else
    []
  end
end
post_id(args) click to toggle source
# File lib/nokaya/adn.rb, line 28
def post_id args
  /\d+{2}/.match(args[0])
end