xiv_lodestone 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/xiv_lodestone/lodestone_character.rb +1 -1
- data/lib/xiv_lodestone/lodestone_character_attribute.rb +41 -39
- data/lib/xiv_lodestone/lodestone_character_collectable.rb +29 -29
- data/lib/xiv_lodestone/lodestone_character_disciple.rb +44 -44
- data/lib/xiv_lodestone/lodestone_character_gear.rb +70 -70
- data/lib/xiv_lodestone/lodestone_helper.rb +4 -4
- data/lib/xiv_lodestone/lodestone_server.rb +33 -33
- data/lib/xiv_lodestone/version.rb +1 -1
- data/spec/resources/character.html +1446 -957
- data/spec/xiv_lodestone_character_attribute_spec.rb +26 -26
- data/spec/xiv_lodestone_character_collectable_spec.rb +28 -28
- data/spec/xiv_lodestone_character_disciple_spec.rb +33 -33
- data/spec/xiv_lodestone_character_gear_spec.rb +37 -37
- data/spec/xiv_lodestone_helper_spec.rb +52 -52
- data/spec/xiv_lodestone_server_spec.rb +27 -27
- data/spec/xiv_lodestone_spec.rb +3 -3
- metadata +3 -3
@@ -1,26 +1,26 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xiv_lodestone/lodestone_character_attribute'
|
3
|
-
|
4
|
-
describe XIVLodestone::AttributeList do
|
5
|
-
let (:valid) {
|
6
|
-
XIVLodestone::AttributeList.new(Nokogiri::HTML(open(LOCAL_FILE)).
|
7
|
-
xpath('//div[starts-with(@class,"param_left_area_inner")]/ul/li'))
|
8
|
-
}
|
9
|
-
|
10
|
-
let (:invalid) {
|
11
|
-
XIVLodestone::AttributeList.new(Nokogiri::HTML(open(INVALID_FILE)).
|
12
|
-
xpath('//div[starts-with(@class, "param_left_area_inner")]/ul/li'))
|
13
|
-
}
|
14
|
-
|
15
|
-
it 'to json dump check' do
|
16
|
-
expect(valid.to_json).to eq("{\"
|
17
|
-
expect(invalid.to_json).to eq("{}")
|
18
|
-
expect(valid.to_json.is_a?(String)).to eq(true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'method missing check' do
|
22
|
-
expect(valid.method_missing(:
|
23
|
-
expect(valid.method_missing(:
|
24
|
-
expect(valid.method_missing(:fire)).to eql(
|
25
|
-
end
|
26
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xiv_lodestone/lodestone_character_attribute'
|
3
|
+
|
4
|
+
describe XIVLodestone::AttributeList do
|
5
|
+
let (:valid) {
|
6
|
+
XIVLodestone::AttributeList.new(Nokogiri::HTML(open(LOCAL_FILE)).
|
7
|
+
xpath('//div[starts-with(@class,"param_left_area_inner")]/ul/li'))
|
8
|
+
}
|
9
|
+
|
10
|
+
let (:invalid) {
|
11
|
+
XIVLodestone::AttributeList.new(Nokogiri::HTML(open(INVALID_FILE)).
|
12
|
+
xpath('//div[starts-with(@class, "param_left_area_inner")]/ul/li'))
|
13
|
+
}
|
14
|
+
|
15
|
+
it 'to json dump check' do
|
16
|
+
expect(valid.to_json).to eq("{\"strength\":117,\"dexterity\":229,\"vitality\":620,\"intelligence\":227,\"mind\":943,\"piety\":494,\"fire\":283,\"ice\":280,\"wind\":284,\"earth\":282,\"lightning\":282,\"water\":282,\"accuracy\":354,\"critical_hit_rate\":484,\"determination\":545,\"defense\":726,\"parry\":354,\"magic_defense\":1267,\"attack_power\":117,\"skill_speed\":354,\"attack_magic_potency\":227,\"healing_magic_potency\":943,\"spell_speed\":622,\"slow_resistance\":0,\"silence_resistance\":0,\"blind_resistance\":0,\"poison_resistance\":0,\"stun_resistance\":0,\"sleep_resistance\":0,\"bind_resistance\":0,\"heavy_resistance\":0,\"slashing_resistance\":100,\"piercing_resistance\":100,\"blunt_resistance\":100}")
|
17
|
+
expect(invalid.to_json).to eq("{}")
|
18
|
+
expect(valid.to_json.is_a?(String)).to eq(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'method missing check' do
|
22
|
+
expect(valid.method_missing(:strength)).to eql(117)
|
23
|
+
expect(valid.method_missing(:dexterity)).to eql(229)
|
24
|
+
expect(valid.method_missing(:fire)).to eql(283)
|
25
|
+
end
|
26
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xiv_lodestone/lodestone_character_collectable'
|
3
|
-
|
4
|
-
describe XIVLodestone::CollectableList do
|
5
|
-
let (:valid) {
|
6
|
-
XIVLodestone::CollectableList.new(Nokogiri::HTML(open(LOCAL_FILE)).xpath('(//div[@class="minion_box clearfix"])[1]/a'))
|
7
|
-
}
|
8
|
-
let (:invalid) {
|
9
|
-
XIVLodestone::CollectableList.new(Nokogiri::HTML(open(INVALID_FILE)).xpath('(//div[@class="minion_box clearfix"])[1]/a'))
|
10
|
-
}
|
11
|
-
|
12
|
-
it 'Get array of collectables' do
|
13
|
-
expect(valid.list.is_a?(Array)).to eq(true)
|
14
|
-
expect(valid.list.size).to eq(
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'Dump json of collectables' do
|
18
|
-
expect(valid.to_json).to eq("[{\"name\":\"Company Chocobo\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/49/4911a5bb2afb40de2a737cac98ecbe734698d26d.png?
|
19
|
-
expect(invalid.to_json).to eq("[]")
|
20
|
-
expect(valid.to_json.is_a?(String)).to eq(true)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'Build a collectable' do
|
24
|
-
mount = XIVLodestone::CollectableList::Collectable.new("Bomb Palanquin", "http")
|
25
|
-
expect(mount.name).to eq("Bomb Palanquin")
|
26
|
-
expect(mount.icon_url).to eq("http")
|
27
|
-
end
|
28
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xiv_lodestone/lodestone_character_collectable'
|
3
|
+
|
4
|
+
describe XIVLodestone::CollectableList do
|
5
|
+
let (:valid) {
|
6
|
+
XIVLodestone::CollectableList.new(Nokogiri::HTML(open(LOCAL_FILE)).xpath('(//div[@class="minion_box clearfix"])[1]/a'))
|
7
|
+
}
|
8
|
+
let (:invalid) {
|
9
|
+
XIVLodestone::CollectableList.new(Nokogiri::HTML(open(INVALID_FILE)).xpath('(//div[@class="minion_box clearfix"])[1]/a'))
|
10
|
+
}
|
11
|
+
|
12
|
+
it 'Get array of collectables' do
|
13
|
+
expect(valid.list.is_a?(Array)).to eq(true)
|
14
|
+
expect(valid.list.size).to eq(18)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'Dump json of collectables' do
|
18
|
+
expect(valid.to_json).to eq("[{\"name\":\"Company Chocobo\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/49/4911a5bb2afb40de2a737cac98ecbe734698d26d.png?1418207968\"},{\"name\":\"Black Chocobo\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/51/51920328db4361a6e01ea27ea472ee422259c6a8.png?1430448016\"},{\"name\":\"Twintania\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/87/8724ba22d2464ecf550f84d0949f91ec9506a613.png?1430448021\"},{\"name\":\"Fat Chocobo\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/f2/f20a405d9db772c0d429b19b11248d7e32785b87.png?1418207976\"},{\"name\":\"Magitek Armor\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/1c/1ce3841890b1d22b689545ccba1c9572fe89c230.png?1418207971\"},{\"name\":\"Laurel Goobbue\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/30/307a840fd965b95e2f81ba0ba68bf0ba8e3a8763.png?1418207974\"},{\"name\":\"Coeurl\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/4c/4cad467d11b008e63567bdca93543f791baafa9c.png?1418207971\"},{\"name\":\"Ahriman\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/fa/facbad5e6cf82ed4d43d243367dffbac270b1d6b.png?1418207970\"},{\"name\":\"Behemoth\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/44/44911f30e4f853cf10ed00da286240dd6e649e7d.png?1418207973\"},{\"name\":\"Cavalry Drake\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/26/2608067295c0be514a632a4054260f65300a1991.png?1418207973\"},{\"name\":\"Cavalry Elbst\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/01/0199c22a96c92b069eed99907a58dae60444b096.png?1418207977\"},{\"name\":\"Bomb Palanquin\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/92/92fb151ac9596bc548ccbe0ffb13d7c587921697.png?1418207978\"},{\"name\":\"Direwolf\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/58/58040c44a7ce316d254a3e7fec3930265a173f6c.png?1418207983\"},{\"name\":\"Griffin\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/99/99db2a5956bf5b95d59a9e4363e63c6c6241ba6c.png?1430448018\"},{\"name\":\"Manacutter\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/98/9851d80779006c99599dc0ba368a2f8fb573f8d7.png?1430448019\"},{\"name\":\"Unicorn\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/eb/eb9cc5fd160b25f2dd9438937589628c6a7ae029.png?1418207972\"},{\"name\":\"Aithon\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/14/148c9f36e50c2a56b6be72e319312dc39421ed76.png?1418207978\"},{\"name\":\"Midgardsormr\",\"icon_url\":\"http://img.finalfantasyxiv.com/lds/pc/global/images/itemicon/cf/cf8196cb9ebf4aab95a6033b4317159d61bd4f4a.png?1432533195\"}]")
|
19
|
+
expect(invalid.to_json).to eq("[]")
|
20
|
+
expect(valid.to_json.is_a?(String)).to eq(true)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'Build a collectable' do
|
24
|
+
mount = XIVLodestone::CollectableList::Collectable.new("Bomb Palanquin", "http")
|
25
|
+
expect(mount.name).to eq("Bomb Palanquin")
|
26
|
+
expect(mount.icon_url).to eq("http")
|
27
|
+
end
|
28
|
+
end
|
@@ -1,33 +1,33 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xiv_lodestone/lodestone_character_disciple'
|
3
|
-
|
4
|
-
describe XIVLodestone::DiscipleList do
|
5
|
-
let (:valid) {
|
6
|
-
XIVLodestone::DiscipleList.new(Nokogiri::HTML(open(LOCAL_FILE)).xpath("//table[@class='class_list']/tr/td"))
|
7
|
-
}
|
8
|
-
let (:invalid) {
|
9
|
-
XIVLodestone::DiscipleList.new(Nokogiri::HTML(open(INVALID_FILE)).xpath("//table[@class='class_list']/tr/td"))
|
10
|
-
}
|
11
|
-
|
12
|
-
it 'Dump json of disciples' do
|
13
|
-
expect(valid.to_json).to eq("{\"gladiator\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Gladiator\\\", level=1, current_exp=0, total_exp=300, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/ec5d264e53ea7749d916d7d8bc235ec9c8bb7b51.png?1367039495\\\">\",\"pugilist\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Pugilist\\\", level=
|
14
|
-
expect(invalid.to_json).to eq("{}")
|
15
|
-
expect(valid.to_json.is_a?(String)).to eq(true)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'method missing check' do
|
19
|
-
expect(valid.method_missing(:rogue).is_a?(XIVLodestone::DiscipleList::Disciple)).to eql(true)
|
20
|
-
expect(valid.method_missing(:goldsmith).is_a?(XIVLodestone::DiscipleList::Disciple)).to eql(true)
|
21
|
-
expect(valid.method_missing(:arcanist).is_a?(XIVLodestone::DiscipleList::Disciple)).to eql(true)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'Build a disciple' do
|
25
|
-
d = XIVLodestone::DiscipleList::Disciple.new("Rogue", 1, 0, 300, "http")
|
26
|
-
expect(d.name).to eq("Rogue")
|
27
|
-
expect(d.level).to eq(1)
|
28
|
-
expect(d.current_exp).to eq(0)
|
29
|
-
expect(d.total_exp).to eq(300)
|
30
|
-
expect(d.icon_url).to eq("http")
|
31
|
-
expect(d.next_level).to eq(300)
|
32
|
-
end
|
33
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xiv_lodestone/lodestone_character_disciple'
|
3
|
+
|
4
|
+
describe XIVLodestone::DiscipleList do
|
5
|
+
let (:valid) {
|
6
|
+
XIVLodestone::DiscipleList.new(Nokogiri::HTML(open(LOCAL_FILE)).xpath("//table[@class='class_list']/tr/td"))
|
7
|
+
}
|
8
|
+
let (:invalid) {
|
9
|
+
XIVLodestone::DiscipleList.new(Nokogiri::HTML(open(INVALID_FILE)).xpath("//table[@class='class_list']/tr/td"))
|
10
|
+
}
|
11
|
+
|
12
|
+
it 'Dump json of disciples' do
|
13
|
+
expect(valid.to_json).to eq("{\"gladiator\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Gladiator\\\", level=1, current_exp=0, total_exp=300, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/ec5d264e53ea7749d916d7d8bc235ec9c8bb7b51.png?1367039495\\\">\",\"pugilist\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Pugilist\\\", level=60, current_exp=0, total_exp=0, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/9fe08b7e2827a51fc216e6407646ffba716a44b8.png?1367039495\\\">\",\"marauder\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Marauder\\\", level=1, current_exp=0, total_exp=300, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/5ca476c2166b399e3ec92e8008544fdbea75b6a2.png?1367039495\\\">\",\"lancer\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Lancer\\\", level=15, current_exp=279, total_exp=30500, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/924ded09293b2a04c4cd662afbf7cda7b0576888.png?1367039495\\\">\",\"archer\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Archer\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/d39804e8810aa3d8e467b7a476d01965510c5d18.png?1367039495\\\">\",\"rogue\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Rogue\\\", level=0, current_exp=0, total_exp=0, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/2d0ac2fdb4fd432d6b91acd7afbc335e87e877fb.png?1427347185\\\">\",\"conjurer\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Conjurer\\\", level=60, current_exp=0, total_exp=0, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/6157497a98f55a73af4c277f383d0a23551e9e98.png?1367039495\\\">\",\"thaumaturge\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Thaumaturge\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/e2a98c81ca279607fc1706e5e1b11bc08cac2578.png?1367039495\\\">\",\"arcanist\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Arcanist\\\", level=50, current_exp=666000, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/59fde9fca303490477962039f6cd0d0101caeabe.png?1367039495\\\">\",\"dark_knight\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Dark Knight\\\", level=30, current_exp=0, total_exp=162500, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/a2a6213832a266f8c5145f7cbb8b8e8c9d8c6e25.png?1434679077\\\">\",\"machinist\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Machinist\\\", level=30, current_exp=0, total_exp=162500, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/2f21a984aab9ff20acc2cc9bcf0ffe544a33f3a1.png?1434679077\\\">\",\"astrologian\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Astrologian\\\", level=52, current_exp=53648, total_exp=1267200, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/970e5301281cba4ce374530f5949b74d7df083af.png?1434679077\\\">\",\"carpenter\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Carpenter\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/d41cb306af74bb5407bc74fa865e9207a5ce4899.png?1367039495\\\">\",\"blacksmith\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Blacksmith\\\", level=50, current_exp=12660, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/6e0223f41a926eab7e6bc42af7dd29b915999db1.png?1367039495\\\">\",\"armorer\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Armorer\\\", level=52, current_exp=515795, total_exp=1267200, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/aab4391a4a5633684e1b93174713c1c52f791930.png?1367039495\\\">\",\"goldsmith\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Goldsmith\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/605aa74019178eef7d8ba790b3db10ac8e9cd4ca.png?1367039495\\\">\",\"leatherworker\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Leatherworker\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/f358b50ff0a1b1dcb67490ba8f4c480e01e4edd7.png?1367039495\\\">\",\"weaver\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Weaver\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/131b914b2be4563ec76b870d1fa44aa8da0f1ee6.png?1367039495\\\">\",\"alchemist\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Alchemist\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/343bce834add76f5d714f33154d0c70e99d495a3.png?1367039495\\\">\",\"culinarian\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Culinarian\\\", level=50, current_exp=0, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/86f1875ebc31f88eb917283665be128689a9669b.png?1367039495\\\">\",\"miner\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Miner\\\", level=60, current_exp=0, total_exp=0, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/8e82259fcd979378632cde0c9767c15dba3790af.png?1367039495\\\">\",\"botanist\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Botanist\\\", level=50, current_exp=50703, total_exp=864000, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/937d3313d9d7ef491319c38a4d4cde4035eb1ab3.png?1367039495\\\">\",\"fisher\":\"#<struct XIVLodestone::DiscipleList::Disciple name=\\\"Fisher\\\", level=60, current_exp=0, total_exp=0, icon_url=\\\"http://img.finalfantasyxiv.com/lds/pc/global/images/class/24/289dbc0b50956ce10a2195a75a22b500a648284e.png?1367039495\\\">\"}")
|
14
|
+
expect(invalid.to_json).to eq("{}")
|
15
|
+
expect(valid.to_json.is_a?(String)).to eq(true)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'method missing check' do
|
19
|
+
expect(valid.method_missing(:rogue).is_a?(XIVLodestone::DiscipleList::Disciple)).to eql(true)
|
20
|
+
expect(valid.method_missing(:goldsmith).is_a?(XIVLodestone::DiscipleList::Disciple)).to eql(true)
|
21
|
+
expect(valid.method_missing(:arcanist).is_a?(XIVLodestone::DiscipleList::Disciple)).to eql(true)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'Build a disciple' do
|
25
|
+
d = XIVLodestone::DiscipleList::Disciple.new("Rogue", 1, 0, 300, "http")
|
26
|
+
expect(d.name).to eq("Rogue")
|
27
|
+
expect(d.level).to eq(1)
|
28
|
+
expect(d.current_exp).to eq(0)
|
29
|
+
expect(d.total_exp).to eq(300)
|
30
|
+
expect(d.icon_url).to eq("http")
|
31
|
+
expect(d.next_level).to eq(300)
|
32
|
+
end
|
33
|
+
end
|
@@ -1,37 +1,37 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xiv_lodestone/lodestone_character_gear'
|
3
|
-
|
4
|
-
describe XIVLodestone::GearList do
|
5
|
-
let (:valid) {
|
6
|
-
XIVLodestone::GearList.new(Nokogiri::HTML(open(LOCAL_FILE)).
|
7
|
-
xpath("(//div[@class='item_detail_box'])[position() < 13]"))
|
8
|
-
}
|
9
|
-
let (:invalid) {
|
10
|
-
XIVLodestone::GearList.new(Nokogiri::HTML(open(INVALID_FILE)).
|
11
|
-
xpath("(//div[@class='item_detail_box'])[position() < 13]"))
|
12
|
-
}
|
13
|
-
|
14
|
-
it 'Dump json of items' do
|
15
|
-
expect(valid.to_json).to eq("{\"weapon\":\"#<struct XIVLodestone::GearList::Gear name=\\\"
|
16
|
-
expect(invalid.to_json).to eq("{}")
|
17
|
-
expect(valid.to_json.is_a?(String)).to eq(true)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'calculate ilevel' do
|
21
|
-
expect(valid.ilevel).to eq(
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'method missing check' do
|
25
|
-
expect(valid.method_missing(:head).is_a?(XIVLodestone::GearList::Gear)).to eql(true)
|
26
|
-
expect(valid.method_missing(:weapon).is_a?(XIVLodestone::GearList::Gear)).to eql(true)
|
27
|
-
expect(valid.method_missing(:ring1).is_a?(XIVLodestone::GearList::Gear)).to eql(true)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'Build a Gear' do
|
31
|
-
d = XIVLodestone::GearList::Gear.new("Sword", 100, "Two Hand", "http")
|
32
|
-
expect(d.name).to eq("Sword")
|
33
|
-
expect(d.ilevel).to eq(100)
|
34
|
-
expect(d.slot).to eq("Two Hand")
|
35
|
-
expect(d.url).to eq("http")
|
36
|
-
end
|
37
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xiv_lodestone/lodestone_character_gear'
|
3
|
+
|
4
|
+
describe XIVLodestone::GearList do
|
5
|
+
let (:valid) {
|
6
|
+
XIVLodestone::GearList.new(Nokogiri::HTML(open(LOCAL_FILE)).
|
7
|
+
xpath("(//div[@class='item_detail_box'])[position() < 13]"))
|
8
|
+
}
|
9
|
+
let (:invalid) {
|
10
|
+
XIVLodestone::GearList.new(Nokogiri::HTML(open(INVALID_FILE)).
|
11
|
+
xpath("(//div[@class='item_detail_box'])[position() < 13]"))
|
12
|
+
}
|
13
|
+
|
14
|
+
it 'Dump json of items' do
|
15
|
+
expect(valid.to_json).to eq("{\"weapon\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Hive Cane\\\", ilevel=190, slot=\\\"Two-handed Conjurer's Arm\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/ae2adefe648/\\\">\",\"head\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Crown of Healing\\\", ilevel=190, slot=\\\"Head\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/fb382760fc7/\\\">\",\"body\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Asuran Dogi of Healing\\\", ilevel=180, slot=\\\"Body\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/640fb89bc54/\\\">\",\"hands\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Gloves of Healing\\\", ilevel=190, slot=\\\"Hands\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/0e4a2312183/\\\">\",\"waist\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Belt of Healing\\\", ilevel=190, slot=\\\"Waist\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/3e34da93e7a/\\\">\",\"legs\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Asuran Hakama of Healing\\\", ilevel=180, slot=\\\"Legs\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/77aa0f2c25a/\\\">\",\"feet\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Gambieras of Healing\\\", ilevel=190, slot=\\\"Feet\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/c4c4a74f87f/\\\">\",\"necklace\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Neckband of Healing\\\", ilevel=190, slot=\\\"Necklace\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/be05b30cd9c/\\\">\",\"earrings\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Earrings of Healing\\\", ilevel=190, slot=\\\"Earrings\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/a4219a01db7/\\\">\",\"bracelets\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Wristband of Healing\\\", ilevel=190, slot=\\\"Bracelets\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/9042ef4ee11/\\\">\",\"ring1\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Asuran Ring of Healing\\\", ilevel=180, slot=\\\"Ring\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/475abf45d63/\\\">\",\"ring2\":\"#<struct XIVLodestone::GearList::Gear name=\\\"Prototype Gordian Ring of Healing\\\", ilevel=190, slot=\\\"Ring\\\", url=\\\"http://na.finalfantasyxiv.com/lodestone/playguide/db/item/ae1e3d72c8e/\\\">\"}")
|
16
|
+
expect(invalid.to_json).to eq("{}")
|
17
|
+
expect(valid.to_json.is_a?(String)).to eq(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'calculate ilevel' do
|
21
|
+
expect(valid.ilevel).to eq(187)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'method missing check' do
|
25
|
+
expect(valid.method_missing(:head).is_a?(XIVLodestone::GearList::Gear)).to eql(true)
|
26
|
+
expect(valid.method_missing(:weapon).is_a?(XIVLodestone::GearList::Gear)).to eql(true)
|
27
|
+
expect(valid.method_missing(:ring1).is_a?(XIVLodestone::GearList::Gear)).to eql(true)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'Build a Gear' do
|
31
|
+
d = XIVLodestone::GearList::Gear.new("Sword", 100, "Two Hand", "http")
|
32
|
+
expect(d.name).to eq("Sword")
|
33
|
+
expect(d.ilevel).to eq(100)
|
34
|
+
expect(d.slot).to eq("Two Hand")
|
35
|
+
expect(d.url).to eq("http")
|
36
|
+
end
|
37
|
+
end
|
@@ -1,52 +1,52 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xiv_lodestone/lodestone_helper'
|
3
|
-
|
4
|
-
describe XIVLodestone::Helper do
|
5
|
-
let(:helper) { XIVLodestone::Helper }
|
6
|
-
|
7
|
-
it 'Find character from name and server' do
|
8
|
-
page = helper.open_url("
|
9
|
-
expect(page.xpath('//h2/a')[0].text).to eq("
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'Invalid character name' do
|
13
|
-
expect { helper.open_url("#$%#FG", "Tonberry") }.to raise_error(URI::InvalidURIError)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'No character found exception' do
|
17
|
-
expect { helper.open_url("Yoloswaggings", "Tonberry") }.to raise_error(XIVLodestone::CharacterNotFound)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'Find character from id' do
|
21
|
-
page = helper.open_id("1549391")
|
22
|
-
expect(page.xpath('//h2/a')[0].text).to eql("
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'invalid character id' do
|
26
|
-
expect { helper.open_id("154") }.to raise_error(OpenURI::HTTPError)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'invalid arguments' do
|
30
|
-
expect { helper.process_args(:server => "Tonberry")}. to raise_error(ArgumentError)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'replace_downcase case test' do
|
34
|
-
expect(helper.replace_downcase("HELLO WORLD")).to eq("hello_world")
|
35
|
-
expect(helper.replace_downcase("well_yea")).to eq("well_yea")
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'sucessful call of get methods' do
|
39
|
-
valid = Nokogiri::HTML(open(LOCAL_FILE))
|
40
|
-
expect(helper.get_hp(valid)).to eq(
|
41
|
-
expect(helper.get_mp(valid)).to eq(
|
42
|
-
expect(helper.get_tp(valid)).to eq(1000)
|
43
|
-
expect(helper.get_sex(valid)).to eq("Male")
|
44
|
-
expect(helper.get_race(valid)).to eq("Miqo'te")
|
45
|
-
expect(helper.get_clan(valid)).to eq("Keeper of the Moon")
|
46
|
-
expect(helper.get_nameday(valid)).to eq("27th Sun of the 1st Astral Moon")
|
47
|
-
expect(helper.get_guardian(valid)).to eq("Oschon, the Wanderer")
|
48
|
-
expect(helper.get_city(valid)).to eq("Gridania")
|
49
|
-
expect(helper.get_grand_company(valid)).to eq("
|
50
|
-
expect(helper.get_free_company(valid)).to eq(["
|
51
|
-
end
|
52
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xiv_lodestone/lodestone_helper'
|
3
|
+
|
4
|
+
describe XIVLodestone::Helper do
|
5
|
+
let(:helper) { XIVLodestone::Helper }
|
6
|
+
|
7
|
+
it 'Find character from name and server' do
|
8
|
+
page = helper.open_url("Benji Ro", "Tonberry")
|
9
|
+
expect(page.xpath('//h2/a')[0].text).to eq("Benji Ro")
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'Invalid character name' do
|
13
|
+
expect { helper.open_url("#$%#FG", "Tonberry") }.to raise_error(URI::InvalidURIError)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'No character found exception' do
|
17
|
+
expect { helper.open_url("Yoloswaggings", "Tonberry") }.to raise_error(XIVLodestone::CharacterNotFound)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'Find character from id' do
|
21
|
+
page = helper.open_id("1549391")
|
22
|
+
expect(page.xpath('//h2/a')[0].text).to eql("Benji Ro")
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'invalid character id' do
|
26
|
+
expect { helper.open_id("154") }.to raise_error(OpenURI::HTTPError)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'invalid arguments' do
|
30
|
+
expect { helper.process_args(:server => "Tonberry")}. to raise_error(ArgumentError)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'replace_downcase case test' do
|
34
|
+
expect(helper.replace_downcase("HELLO WORLD")).to eq("hello_world")
|
35
|
+
expect(helper.replace_downcase("well_yea")).to eq("well_yea")
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'sucessful call of get methods' do
|
39
|
+
valid = Nokogiri::HTML(open(LOCAL_FILE))
|
40
|
+
expect(helper.get_hp(valid)).to eq(10971)
|
41
|
+
expect(helper.get_mp(valid)).to eq(12393)
|
42
|
+
expect(helper.get_tp(valid)).to eq(1000)
|
43
|
+
expect(helper.get_sex(valid)).to eq("Male")
|
44
|
+
expect(helper.get_race(valid)).to eq("Miqo'te")
|
45
|
+
expect(helper.get_clan(valid)).to eq("Keeper of the Moon")
|
46
|
+
expect(helper.get_nameday(valid)).to eq("27th Sun of the 1st Astral Moon")
|
47
|
+
expect(helper.get_guardian(valid)).to eq("Oschon, the Wanderer")
|
48
|
+
expect(helper.get_city(valid)).to eq("Gridania")
|
49
|
+
expect(helper.get_grand_company(valid)).to eq("Order of the Twin Adder/Second Serpent Lieutenant")
|
50
|
+
expect(helper.get_free_company(valid)).to eq(["Air Skip One", "http://na.finalfantasyxiv.com/lodestone/freecompany/9233505136016405449/"])
|
51
|
+
end
|
52
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'xiv_lodestone/lodestone_helper'
|
3
|
-
require 'xiv_lodestone/lodestone_server'
|
4
|
-
|
5
|
-
describe XIVLodestone::ServerStatus do
|
6
|
-
let (:server) { XIVLodestone::ServerStatus.new }
|
7
|
-
|
8
|
-
it 'Pull server status' do
|
9
|
-
expect(server.nil?).not_to be
|
10
|
-
expect(server.tonberry.nil?).not_to be
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'method missing check' do
|
14
|
-
expect(server.method_missing(:aegis).is_a?(XIVLodestone::ServerStatus::Server)).to eql(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'updating server information' do
|
18
|
-
server.fetch_server_status(Nokogiri::HTML(open(SERVER_FILE)))
|
19
|
-
expect(server.tonberry.status).to eq("Offline")
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'build a server' do
|
23
|
-
s = XIVLodestone::ServerStatus::Server.new("Hello", "World", "Yay")
|
24
|
-
expect(s.name).to eq("Hello")
|
25
|
-
expect(s.status).to eq("World")
|
26
|
-
expect(s.registration).to eq("Yay")
|
27
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'xiv_lodestone/lodestone_helper'
|
3
|
+
require 'xiv_lodestone/lodestone_server'
|
4
|
+
|
5
|
+
describe XIVLodestone::ServerStatus do
|
6
|
+
let (:server) { XIVLodestone::ServerStatus.new }
|
7
|
+
|
8
|
+
it 'Pull server status' do
|
9
|
+
expect(server.nil?).not_to be
|
10
|
+
expect(server.tonberry.nil?).not_to be
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'method missing check' do
|
14
|
+
expect(server.method_missing(:aegis).is_a?(XIVLodestone::ServerStatus::Server)).to eql(true)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'updating server information' do
|
18
|
+
server.fetch_server_status(Nokogiri::HTML(open(SERVER_FILE)))
|
19
|
+
expect(server.tonberry.status).to eq("Offline")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'build a server' do
|
23
|
+
s = XIVLodestone::ServerStatus::Server.new("Hello", "World", "Yay")
|
24
|
+
expect(s.name).to eq("Hello")
|
25
|
+
expect(s.status).to eq("World")
|
26
|
+
expect(s.registration).to eq("Yay")
|
27
|
+
end
|
28
28
|
end
|
data/spec/xiv_lodestone_spec.rb
CHANGED
@@ -2,12 +2,12 @@ require 'spec_helper'
|
|
2
2
|
require 'xiv_lodestone'
|
3
3
|
|
4
4
|
describe XIVLodestone::Character do
|
5
|
-
let(:character) { XIVLodestone::Character.new(name: "
|
5
|
+
let(:character) { XIVLodestone::Character.new(name: "Benji Ro", server: "Tonberry") }
|
6
6
|
|
7
7
|
it 'Character profile found' do
|
8
8
|
expect(character.nil?).to eq(false)
|
9
|
-
expect(character.first_name).to eq("
|
10
|
-
expect(character.last_name).to eq("
|
9
|
+
expect(character.first_name).to eq("Benji")
|
10
|
+
expect(character.last_name).to eq("Ro")
|
11
11
|
expect(character.mounts.is_a?(Array)).to be
|
12
12
|
expect(character.minions.is_a?(Array)).to be
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xiv_lodestone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Evenson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.4.
|
127
|
+
rubygems_version: 2.4.8
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: A webscraper for FFXIV:ARR lodestone website.
|