sightstone 0.4.0 → 0.4.1
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/lib/sightstone/champion.rb +12 -0
- data/lib/sightstone/modules/champion_module.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a14fd5b00ace824df9ad9774ec2fb36c318d790a
|
4
|
+
data.tar.gz: 973d2381f2b9e1037b40cfdfb9496fe91c384888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69e19754eaf85ee74b5d6c468baa67940f1773413fe7bb7a6e5eacf77b54955ef52f6edc2b0d8af7d41dc2568c4cb3090999b7f7f3acd4a4cf14193885301fa7
|
7
|
+
data.tar.gz: 487e0f66303a84faa1a3a5dcc59542c1f967747c254744c2f1a95e546112eb9d933951405247d064315c9fb67412761929a472ade6cd7077f4c85a1978bf2142
|
data/lib/sightstone/champion.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# Class to represent a champion
|
2
|
+
# @attr [Boolean] active determines if champion is active
|
3
|
+
# @attr [Integer] attackRank attack rank
|
4
|
+
# @attr [Boolean] botEnabled Bot enabled flag (for custom games)
|
5
|
+
# @attr [Boolean] botMmEnabled Bot Match Made enabeld flag (for Coop/AI games)
|
6
|
+
# @attr [Integer] defenseRank Champion defense rank.
|
7
|
+
# @attr [Integer] difficultyRank Champion difficulty rank.
|
8
|
+
# @attr [Boolean] freeToPlay Indicates if the champion is free to play. Free to play champions are rotated periodically.
|
9
|
+
# @attr [Fixnum] id Champion ID.
|
10
|
+
# @attr [Integer] magicRank Champion magic rank.
|
11
|
+
# @attr [String] name Champion name.
|
12
|
+
# @attr [boolean] rankedPlayEnabled Ranked play enabled flag.
|
1
13
|
class Champion
|
2
14
|
attr_accessor :active, :attackRank, :botEnabled, :botMmEnabled
|
3
15
|
attr_accessor :defenseRank, :difficultyRank, :freeToPlay, :id, :magicRank, :name, :rankedPlayEnabled
|
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'sightstone/champion'
|
2
2
|
require 'sightstone/modules/sightstone_base_module'
|
3
3
|
|
4
|
+
# Module to provide calls to the summoner api
|
4
5
|
class ChampionModule < SightstoneBaseModule
|
5
6
|
|
6
7
|
def initialize(sightstone)
|
7
8
|
@sightstone = sightstone
|
8
9
|
end
|
9
10
|
|
11
|
+
# call to get champions
|
12
|
+
# @param optional [Hash] optional arguments: :region => replaces default region, :free_to_play => boolean (only free to play champs if true)
|
13
|
+
# @return [Array<Champion>] array of champs
|
10
14
|
def champions(optional={})
|
11
15
|
region = optional[:region] || @sightstone.region
|
12
16
|
free_to_play = optional[:free_to_play]
|
13
17
|
uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.1/champion"
|
14
18
|
response = _get_api_response(uri, {'freeToPlay' => free_to_play})
|
15
|
-
puts response
|
16
19
|
|
17
20
|
_parse_response(response) { |resp|
|
18
21
|
data = JSON.parse(resp)
|