ffxiv-lodestone 0.8.0 → 0.9.0

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.
@@ -0,0 +1,103 @@
1
+ $:.unshift("#{File.expand_path(File.dirname(__FILE__))}/../lib")
2
+ require 'bacon'
3
+ require 'ffxiv-lodestone'
4
+
5
+ # Make the character class open our saved HTML...
6
+ class FFXIVLodestone::Character
7
+ def get_profile_html(id)
8
+ open("./characters/#{id}.html")
9
+ end
10
+
11
+ def get_search_html(character,world_id)
12
+ n = character.downcase.gsub(' ','-')
13
+ open("./searches/#{n}_#{world_id}.html")
14
+ end
15
+ end
16
+
17
+ describe 'Character(invalid)' do
18
+ it 'is an invalid id' do
19
+ should.raise(FFXIVLodestone::Character::NotFoundException) { FFXIVLodestone::Character.new('invalid') }
20
+ end
21
+
22
+ it 'is a bad argument list' do
23
+ should.raise(ArgumentError) { FFXIVLodestone::Character.new(:id => 1, :name => 'Ayeron Lifebloom', :world => 'Figaro') }
24
+ should.raise(ArgumentError) { FFXIVLodestone::Character.new(:name => 'Ayeron Lifebloom') }
25
+ should.raise(ArgumentError) { FFXIVLodestone::Character.new(:world => 'Figaro') }
26
+ end
27
+
28
+ it 'is a bad world' do
29
+ should.raise(ArgumentError) { FFXIVLodestone::Character.new(:name => 'Ayeron Lifebloom', :world => 'FAKESERVER') }
30
+ end
31
+
32
+ it 'is an ambiguous name' do
33
+ should.raise(FFXIVLodestone::Character::AmbiguousNameError) { FFXIVLodestone::Character.new(:name => 'Lady', :world => 'Selbina') }
34
+ end
35
+
36
+ it 'should actually work' do
37
+ should.not.raise(ArgumentError) { FFXIVLodestone::Character.new(:id => 1015990) }
38
+ should.not.raise(ArgumentError) { FFXIVLodestone::Character.new(:name => 'Ayeron Lifebloom', :world => 'Figaro') }
39
+ end
40
+ end
41
+
42
+ describe "Character(:name => 'Lady Simmons', :world => 'Selbina')" do
43
+ it 'should find the character' do
44
+ char = FFXIVLodestone::Character.new(:name => 'Lady Simmons', :world => 'Selbina')
45
+ char.name.should.equal 'Lady Simmons'
46
+ char.character_id.should.equal 1015990
47
+
48
+ char = FFXIVLodestone::Character.new(:name => 'Ayeron Lifebloom', :world => 'Figaro')
49
+ char.name.should.equal 'Ayeron Lifebloom'
50
+ char.character_id.should.equal 1502635
51
+
52
+ char = FFXIVLodestone::Character.new(:id => 2172370)
53
+ char.name.should.equal 'Karen Kranfel'
54
+ char.character_id.should.equal 2172370
55
+ end
56
+ end
57
+
58
+ describe 'Character(1015990)' do
59
+ before do
60
+ @char = FFXIVLodestone::Character.new(1015990)
61
+ end
62
+
63
+ it 'should have profile data' do
64
+ @char.character_id.should.equal 1015990
65
+ @char.name.should.equal 'Lady Simmons'
66
+ @char.world.should.equal 'Selbina'
67
+ @char.physical_level.should.equal 12
68
+ @char.exp_to_next_level.should.equal 28000
69
+ @char.current_exp.should.equal 18880
70
+ @char.gender.should.equal 'Female'
71
+ @char.race.should.equal "Miqo'te"
72
+ @char.clan.should.equal 'Seeker of the Sun'
73
+ end
74
+
75
+ it 'should have stat lists' do
76
+ stats = {:strength => 16, :vitality => 24, :dexterity => 17, :intelligence => 36, :mind => 37, :piety => 28}
77
+ resists = {:fire => 28, :water => 29, :lightning => 30, :wind => 30, :earth => 25, :ice => 15}
78
+
79
+ @char.stats.should.equal stats
80
+ @char.stats.strength.should.equal 16
81
+
82
+ @char.resistances.should.equal resists
83
+ @char.resistances.fire.should.equal 28
84
+ end
85
+
86
+ it 'should have job data' do
87
+ @char.skills.carpenter.rank.should.equal 5
88
+ @char.skills.carpenter.current_skill_points.should.equal 305
89
+ @char.skills.carpenter.skillpoint_to_next_level.should.equal 1500
90
+ end
91
+
92
+ it 'should list all leveled jobs' do
93
+ @char.skills.levelled.map(&:name).sort.should.equal ['Conjurer','Carpenter','Leatherworker','Weaver','Alchemist','Miner','Botanist','Fisher'].sort
94
+ end
95
+
96
+ it 'should be convertable to json' do
97
+ json = <<LOLHEREDOC
98
+ {"first_name":"Lady","character_id":1015990,"nameday":"4th Sun of the 3rd Umbral Moon","world":"Selbina","last_name":"Simmons","attributes":{"vitality":24,"dexterity":17,"intelligence":36,"mind":37,"piety":28,"strength":16},"guardian":"Nymeia, the Spinner","current_exp":18880,"starting_city":"Gridania","exp_to_next_level":28000,"race":"Miqo'te","resistances":{"fire":28,"water":29,"lightning":30,"wind":30,"earth":25,"ice":15},"physical_level":12,"jobs":{"armorer":{"skill_name":"Armorcraft","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Armorer"},"miner":{"skill_name":"Mining","rank":1,"current_skill_points":431,"skillpoint_to_next_level":570,"name":"Miner"},"lancer":{"skill_name":"Polearm","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Lancer"},"goldsmith":{"skill_name":"Goldsmithing","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Goldsmith"},"botanist":{"skill_name":"Botany","rank":9,"current_skill_points":1800,"skillpoint_to_next_level":4300,"name":"Botanist"},"thaumaturge":{"skill_name":"Thaumaturgy","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Thaumaturge"},"leatherworker":{"skill_name":"Leatherworking","rank":1,"current_skill_points":78,"skillpoint_to_next_level":570,"name":"Leatherworker"},"pugilist":{"skill_name":"Hand-to-Hand","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Pugilist"},"fisher":{"skill_name":"Fishing","rank":3,"current_skill_points":748,"skillpoint_to_next_level":880,"name":"Fisher"},"conjurer":{"skill_name":"Conjury","rank":1,"current_skill_points":272,"skillpoint_to_next_level":570,"name":"Conjurer"},"weaver":{"skill_name":"Clothcraft","rank":6,"current_skill_points":1145,"skillpoint_to_next_level":1800,"name":"Weaver"},"shield":{"skill_name":"Shield","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Shield"},"gladiator":{"skill_name":"Sword","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Gladiator"},"carpenter":{"skill_name":"Woodworking","rank":5,"current_skill_points":305,"skillpoint_to_next_level":1500,"name":"Carpenter"},"alchemist":{"skill_name":"Alchemy","rank":8,"current_skill_points":1753,"skillpoint_to_next_level":3200,"name":"Alchemist"},"marauder":{"skill_name":"Axe","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Marauder"},"blacksmith":{"skill_name":"Smithing","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Blacksmith"},"culinarian":{"skill_name":"Cooking","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Culinarian"},"archer":{"skill_name":"Archery","rank":0,"current_skill_points":0,"skillpoint_to_next_level":0,"name":"Archer"}},"gender":"Female","clan":"Seeker of the Sun"}
99
+ LOLHEREDOC
100
+
101
+ JSON.parse(@char.to_json).should.equal JSON.parse(json)
102
+ end
103
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffxiv-lodestone
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 8
8
+ - 9
9
9
  - 0
10
- version: 0.8.0
10
+ version: 0.9.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - owlmanatt
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-23 00:00:00 +00:00
18
+ date: 2010-09-24 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,6 +34,20 @@ dependencies:
34
34
  version: 1.4.3
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: bacon
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
37
51
  description: A nice Ruby library for accessing character data on the FFXIV community site. It's a screen scraper, but you can PRETEND you're using something nice.
38
52
  email:
39
53
  - owlmanatt@gmail.com
@@ -45,6 +59,18 @@ extra_rdoc_files: []
45
59
 
46
60
  files:
47
61
  - lib/ffxiv-lodestone.rb
62
+ - test/spec.rb
63
+ - test/searches/ayeron-lifebloom_7.html
64
+ - test/searches/lady_12.html
65
+ - test/searches/lady-simmons_12.html
66
+ - test/searches/fakey-fakerson_12.html
67
+ - test/characters/2172370.html
68
+ - test/characters/1502635.html
69
+ - test/characters/invalid.html
70
+ - test/characters/1015990.html
71
+ - AUTHORS
72
+ - HISTORY
73
+ - LICENSE
48
74
  - README
49
75
  has_rdoc: true
50
76
  homepage: http://github.com/OwlManAtt/FFXIV-Lodestone-API
@@ -60,10 +86,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
86
  requirements:
61
87
  - - ">="
62
88
  - !ruby/object:Gem::Version
63
- hash: 3
89
+ hash: 57
64
90
  segments:
65
- - 0
66
- version: "0"
91
+ - 1
92
+ - 8
93
+ - 7
94
+ version: 1.8.7
67
95
  required_rubygems_version: !ruby/object:Gem::Requirement
68
96
  none: false
69
97
  requirements: