Module: FFXIV::Lodestone

Defined in:
lib/ffxiv/lodestone.rb,
lib/ffxiv/lodestone/model.rb,
lib/ffxiv/lodestone/character.rb,
lib/ffxiv/lodestone/linkshell.rb,
lib/ffxiv/lodestone/free-company.rb

Defined Under Namespace

Classes: Character, FreeCompany, Linkshell, Model

Constant Summary collapse

@@debug =
false

Class Method Summary collapse

Class Method Details

.d(str) ⇒ Object



28
29
30
# File 'lib/ffxiv/lodestone.rb', line 28

def d(str)
  puts "\033[35m[Debug]\033[0m #{str}" if @@debug
end

.debugObject



20
21
22
# File 'lib/ffxiv/lodestone.rb', line 20

def debug
  @@debug
end

.debug=(flag) ⇒ Object



24
25
26
# File 'lib/ffxiv/lodestone.rb', line 24

def debug=(flag)
  @@debug = flag
end

.fetch(endpoint) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/ffxiv/lodestone.rb', line 32

def fetch(endpoint)
  uri = "http://na.finalfantasyxiv.com/lodestone/" + endpoint
  d("Fetching #{uri} ......")
  html, charset = open(uri) do |page|
    [page.read, page.charset]
  end
  d("    done (size=#{html.size}, charset=#{charset})")
  Nokogiri::HTML.parse(html, nil, charset)
end