# frozen_string_literal: true require 'memoist' module PhoneSites module GsmArena class PhoneModel < PhoneSites::PhoneModel extend ::Memoist ITEMS_PER_PAGE = 40 def parse(data, attr_name) case attr_name when :name data.children.last.text when :url data.attribute("href").text when :picture_url data.css("img").attribute("src").text when :description data.css("img").attribute("title").text else raise NotImplementedError end end def info ModelInfoResponse.new.perform(URI.join(PhoneSites::GsmArena::BASE_URL, url).to_s) end memoize :info end end end