brawlstats 1.0.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 +7 -0
- data/brawlstats.rb +53 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e3484b55eb069fcd4b538d82115bb0e7bb400cb
|
4
|
+
data.tar.gz: f41f5130cc8117ddd5234a9e9bda91bad8532068
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c6f619419edffc9ea8802caa3f47b6bb843f61a2e0b44e2163807dde3ab46b1f5448a8756bb782d134588de986346c3f89a59d0216bf0c2dceaacc1d73e8e48f
|
7
|
+
data.tar.gz: 1909ba038a03cf9f7fcc3fd9593a0b9139d570538a52a59705e5bfd460c2dce46599e69f0ca84efc6ac1e6565bfd57dcda9934760eb732b91a57c5dc98ce400d
|
data/brawlstats.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require "json"
|
2
|
+
require "uri"
|
3
|
+
require "net/http"
|
4
|
+
|
5
|
+
def make_req url, authorization
|
6
|
+
uri = URI url
|
7
|
+
res = Net::HTTP.start uri.host, uri.port, use_ssl: true do |http|
|
8
|
+
req = Net::HTTP::Get.new uri
|
9
|
+
req["Authorization"] = authorization
|
10
|
+
http.request req
|
11
|
+
end
|
12
|
+
return(JSON.parse(res.body))
|
13
|
+
end
|
14
|
+
|
15
|
+
class Brawlstats
|
16
|
+
def initialize api_key
|
17
|
+
@base_url = "https://api.brawlstars.com/v1"
|
18
|
+
@authorization = "Bearer #{api_key}"
|
19
|
+
end
|
20
|
+
def get_player player_tag
|
21
|
+
return make_req "#{@base_url}/players/%23#{player_tag}", @authorization
|
22
|
+
end
|
23
|
+
def get_player_battlelog player_tag
|
24
|
+
return make_req "#{@base_url}/players/%23#{player_tag}/battlelog", @authorization
|
25
|
+
end
|
26
|
+
def get_club club_tag
|
27
|
+
return make_req "#{@base_url}/clubs/%23#{club_tag}", @authorization
|
28
|
+
end
|
29
|
+
def get_club_members club_tag
|
30
|
+
return make_req "#{@base_url}/clubs/%23#{club_tag}/members", @authorization
|
31
|
+
end
|
32
|
+
def get_powerplay_rankings season_id, country_code='global'
|
33
|
+
return make_req "#{@base_url}/rankings/#{country_code}/powerplay/seasons/#{season_id}", @authorization
|
34
|
+
end
|
35
|
+
def get_powerplay_seasons country_code='global'
|
36
|
+
return make_req "#{@base_url}/rankings/#{country_code}/powerplay/seasons", @authorization
|
37
|
+
end
|
38
|
+
def get_club_rankings country_code='global'
|
39
|
+
return make_req "#{@base_url}/rankings/#{country_code}/clubs", @authorization
|
40
|
+
end
|
41
|
+
def get_brawler_rankings brawler_id, country_code='global'
|
42
|
+
return make_req "#{@base_url}/rankings/#{country_code}/brawlers/#{brawler_id}", @authorization
|
43
|
+
end
|
44
|
+
def get_player_rankings country_code='global'
|
45
|
+
return make_req "#{@base_url}/rankings/#{country_code}/players", @authorization
|
46
|
+
end
|
47
|
+
def get_brawlers
|
48
|
+
return make_req "#{@base_url}/brawlers", @authorization
|
49
|
+
end
|
50
|
+
def get_brawler brawler_id
|
51
|
+
return make_req "#{@base_url}/brawlers/#{brawler_id}", @authorization
|
52
|
+
end
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brawlstats
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aarav Borthakur
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A super basic wrapper for the Brawl Stars API
|
14
|
+
email: ''
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- brawlstats.rb
|
20
|
+
homepage: https://github.com/gadhagod/brawlstars
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.5.2.3
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Brawl Stars API wrapper
|
44
|
+
test_files: []
|