class FFXIV::Lodestone::Linkshell

Attributes

id[RW]
members[RW]
name[RW]
num_members[RW]
server[RW]

Public Class Methods

find_by_id(id) click to toggle source
# File lib/ffxiv/lodestone/linkshell.rb, line 49
def find_by_id(id)
  begin
    dom = Lodestone.fetch("linkshell/#{id}")
    props = {}
    props[:id] = id
    buff = dom.at("div.contents_header h2").content.match(/^(.+)\s\((.+)\)$/)
    props[:name] = buff[1]
    props[:server] = buff[2]
    props[:num_members] = dom.at("h3.ic_silver").content.match(/\s\((\d+)\s/)[1].to_i
    self.new(props)
  rescue => e
    pp e
    nil
  end
end
name_to_id(name, server) click to toggle source
# File lib/ffxiv/lodestone/linkshell.rb, line 39
def name_to_id(name, server)
  search_results = self.search(name, server: server)
  if search_results
    search_results[:linkshells].each do |ls|
      return ls.id if name.downcase == ls.name.downcase
    end
  end
  nil
end