brawlstars 1.2.1 → 1.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +3 -0
- data/bin/console +1 -1
- data/brawlstars.gemspec +1 -1
- data/lib/brawlstars.rb +33 -3
- data/lib/brawlstars/validation.rb +1 -1
- data/lib/brawlstars/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e014fba4cb97cf0e7469fdd6e38e510060b8dbdc9bf5d13060b46d348f1c7f45
|
|
4
|
+
data.tar.gz: dc5157bbcfed8868af7d81dfac164902381bee9cfbdacf84d8959080bdbafb37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07b7169bdeba67241bb5ba75408e1254b28a0376f95e39f1c98057291f8013b0609607e10755b7d90143907d187d597ec0cc694db704e778d0aff4a97740f5a3
|
|
7
|
+
data.tar.gz: d25fc5a83c01fc732a1de31bfd809b7754dc8a6f7dea563f1fce7303db5abbe03e820701ca9071a52d23cea3b912ed4e39b82b135d0c1b5dc9f96962de99ff45
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [1.3.0]
|
|
3
|
+
### Added
|
|
4
|
+
- `Player` class
|
|
5
|
+
- `getClub` and `getBattleLog` methods under player class
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- `getPlayer` now returns a `Player` object
|
|
9
|
+
- All methods that are supposed to return a hash now actually return one, instead of `HTTParty::Response`
|
|
10
|
+
|
|
2
11
|
## [1.2.1]
|
|
3
12
|
### Added
|
|
4
13
|
- Actual region code checking
|
|
@@ -23,6 +32,7 @@
|
|
|
23
32
|
## [1.0.0]
|
|
24
33
|
Initial version
|
|
25
34
|
|
|
35
|
+
[1.3.0]: https://github.com/Karthik99999/brawlstarsrb/tree/v1.3.0
|
|
26
36
|
[1.2.1]: https://github.com/Karthik99999/brawlstarsrb/tree/v1.2.1
|
|
27
37
|
[1.2.0]: https://github.com/Karthik99999/brawlstarsrb/tree/v1.2.0
|
|
28
38
|
[1.1.0]: https://github.com/Karthik99999/brawlstarsrb/tree/v1.1.0
|
data/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
# brawlstarsrb
|
|
2
|
+
[](https://rubygems.org/gems/brawlstars)
|
|
3
|
+
[](../master/LICENSE)
|
|
4
|
+
[](https://discord.me/brawlapi)
|
|
2
5
|
|
|
3
6
|
brawlstarsrb is a Ruby implementation of [BrawlAPI](https://docs.brawlapi.cf), the unofficial Brawl Stars API.
|
|
4
7
|
|
data/bin/console
CHANGED
data/brawlstars.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
20
|
spec.require_paths = ["lib"]
|
|
21
21
|
spec.required_ruby_version = '>= 2.0.0'
|
|
22
|
-
spec.post_install_message = "Brawlstarsrb is my name,
|
|
22
|
+
spec.post_install_message = "Brawlstarsrb is my name, making API requests is my game!"
|
|
23
23
|
spec.metadata = {
|
|
24
24
|
"bug_tracker_uri" => "https://github.com/Karthik99999/brawlstarsrb/issues",
|
|
25
25
|
"changelog_uri" => "https://github.com/Karthik99999/brawlstarsrb/blob/master/CHANGELOG.md",
|
data/lib/brawlstars.rb
CHANGED
|
@@ -56,11 +56,11 @@ module Brawlstars
|
|
|
56
56
|
# Get a player by their tag
|
|
57
57
|
#
|
|
58
58
|
# @param tag [String] tag of the player to get.
|
|
59
|
-
# @return [
|
|
59
|
+
# @return [Brawlstars::Player] data of the player that was searched.
|
|
60
60
|
|
|
61
61
|
def getPlayer(tag)
|
|
62
62
|
tag = validateTag(tag)
|
|
63
|
-
get("/player?tag=#{tag}")
|
|
63
|
+
Player.new(self, get("/player?tag=#{tag}"))
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# Search for players by their name
|
|
@@ -168,7 +168,7 @@ module Brawlstars
|
|
|
168
168
|
end
|
|
169
169
|
case res.code
|
|
170
170
|
when 200
|
|
171
|
-
res
|
|
171
|
+
res.parsed_response
|
|
172
172
|
when 401
|
|
173
173
|
raise Error::Unauthorized
|
|
174
174
|
when 404
|
|
@@ -182,4 +182,34 @@ module Brawlstars
|
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
|
+
class Player
|
|
186
|
+
def initialize(client, data)
|
|
187
|
+
@client = client
|
|
188
|
+
@data = data
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def method_missing(name, *args, &block)
|
|
192
|
+
if @data.respond_to?(name)
|
|
193
|
+
@data.send(name, *args, &block)
|
|
194
|
+
else
|
|
195
|
+
super
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def getClub
|
|
200
|
+
if !@data["club"]
|
|
201
|
+
nil
|
|
202
|
+
else
|
|
203
|
+
@client.getClub(@data["club"]["tag"])
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def getBattleLog
|
|
208
|
+
@client.getBattleLog(@data["tag"])
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def to_s
|
|
212
|
+
"#{@data}"
|
|
213
|
+
end
|
|
214
|
+
end
|
|
185
215
|
end
|
data/lib/brawlstars/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brawlstars
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Karthik99999
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-07-
|
|
11
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -80,7 +80,7 @@ metadata:
|
|
|
80
80
|
changelog_uri: https://github.com/Karthik99999/brawlstarsrb/blob/master/CHANGELOG.md
|
|
81
81
|
documentation_uri: https://www.rubydoc.info/github/Karthik99999/brawlstarsrb
|
|
82
82
|
source_code_uri: https://github.com/Karthik99999/brawlstarsrb
|
|
83
|
-
post_install_message: Brawlstarsrb is my name,
|
|
83
|
+
post_install_message: Brawlstarsrb is my name, making API requests is my game!
|
|
84
84
|
rdoc_options: []
|
|
85
85
|
require_paths:
|
|
86
86
|
- lib
|