battle_pet 0.1.6 → 0.1.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.
@@ -1,10 +1,10 @@
|
|
1
|
-
class
|
1
|
+
class BattlePet::Ability
|
2
2
|
attr_accessor :id, :name, :type, :cooldown, :rounds
|
3
3
|
|
4
4
|
def initialize(params)
|
5
5
|
@id = params["id"]
|
6
6
|
@name = params["name"]
|
7
|
-
@type =
|
7
|
+
@type = BattlePet::Type.find(params["petTypeId"])
|
8
8
|
@cooldown = params["cooldown"]
|
9
9
|
@rounds = params["rounds"]
|
10
10
|
end
|
data/lib/battle_pet.rb
CHANGED
@@ -2,9 +2,6 @@ require 'open-uri'
|
|
2
2
|
require 'json'
|
3
3
|
require 'yaml'
|
4
4
|
|
5
|
-
require_relative 'pet_type.rb'
|
6
|
-
require_relative 'pet_ability.rb'
|
7
|
-
|
8
5
|
class BattlePet
|
9
6
|
attr_accessor :id, :name, :description, :source, :type, :creature, :abilities, :added_in_patch
|
10
7
|
|
@@ -38,7 +35,7 @@ class BattlePet
|
|
38
35
|
@description = data["description"]
|
39
36
|
@source = data["source"]
|
40
37
|
@can_battle = data["canBattle"]
|
41
|
-
@type =
|
38
|
+
@type = Type.find data["petTypeId"]
|
42
39
|
@creature = data["creatureId"]
|
43
40
|
@added_in_patch = BattlePet.check_patch(id)
|
44
41
|
@abilities = acquire_abilities data["abilities"]
|
@@ -54,7 +51,7 @@ class BattlePet
|
|
54
51
|
|
55
52
|
def acquire_abilities(abilities)
|
56
53
|
results = {}
|
57
|
-
abilities.each { |ability| results[ability['requiredLevel']] =
|
54
|
+
abilities.each { |ability| results[ability['requiredLevel']] = Ability.new(ability) }
|
58
55
|
results
|
59
56
|
end
|
60
57
|
|
@@ -67,3 +64,6 @@ class BattlePet
|
|
67
64
|
end
|
68
65
|
end
|
69
66
|
end
|
67
|
+
|
68
|
+
require 'battle_pet/type'
|
69
|
+
require 'battle_pet/ability'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: battle_pet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple gem to get data from WoW BattlePet API
|
15
15
|
email: zwt315@163.com
|
@@ -19,8 +19,8 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- lib/battle_pet.rb
|
21
21
|
- lib/battle_pet.yml
|
22
|
-
- lib/
|
23
|
-
- lib/
|
22
|
+
- lib/battle_pet/ability.rb
|
23
|
+
- lib/battle_pet/type.rb
|
24
24
|
- test/data/mechanical_squirrel_cn.json
|
25
25
|
- test/data/mechanical_squirrel_us.json
|
26
26
|
- test/test_battle_pet.rb
|