battle_pet 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. data/lib/battle_pet.rb +11 -1
  2. metadata +2 -2
data/lib/battle_pet.rb CHANGED
@@ -6,7 +6,7 @@ require_relative 'pet_type.rb'
6
6
  require_relative 'pet_ability.rb'
7
7
 
8
8
  class BattlePet
9
- attr_accessor :id, :name, :description, :source, :type, :creature, :abilities
9
+ attr_accessor :id, :name, :description, :source, :type, :creature, :abilities, :added_in_patch
10
10
 
11
11
  REGION_HOSTS = { us: 'us.battle.net',
12
12
  eu: 'eu.battle.net',
@@ -27,6 +27,7 @@ class BattlePet
27
27
  @type = PetType.find info["petTypeId"]
28
28
  @creature = info["creatureId"]
29
29
  @abilities = acquire_abilities info["abilities"]
30
+ @added_in_patch = check_patch
30
31
  end
31
32
 
32
33
  def can_battle?
@@ -48,4 +49,13 @@ class BattlePet
48
49
  abilities.each { |ability| results[ability['requiredLevel']] = PetAbility.new(ability) }
49
50
  results
50
51
  end
52
+
53
+ def check_patch
54
+ case @id
55
+ when 1..864 then '5.0'
56
+ when 865..1013 then '5.1'
57
+ when 1014..1213 then '5.2'
58
+ else '5.3'
59
+ end
60
+ end
51
61
  end
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.2
4
+ version: 0.1.3
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-27 00:00:00.000000000 Z
12
+ date: 2013-05-28 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