clashinator 0.1.2 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/clashinator/client.rb +9 -3
- data/lib/clashinator/exceptions/response_error.rb +7 -7
- data/lib/clashinator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f952c87643b9fda960895499fa69677637a18820
|
4
|
+
data.tar.gz: 0ddb384307d5bca6c4a207f8a3466cbe5dd2627c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8695eb545d87f26eb93b1ac6ee627e0bcfd71d1529d12897ba9f5911a334f71fd0bc6cc3635f6f9d7923083f9918e38ecde2e6cb5461effd10eecb5764b53e9d
|
7
|
+
data.tar.gz: 0e0075d75f12d543e52d2b8f2eb09e35f7e641f43a8001362baa65a90d7bac5fec04b4939d7b47fae87712adc6722a6f0a87280a79733d91f8880fd9f3d6024f
|
data/README.md
CHANGED
@@ -36,11 +36,23 @@ client.get_clan_info({clan_tag: '#2U2CYPQ8'})
|
|
36
36
|
|
37
37
|
client.list_clan_members({clan_tag: '#2U2CYPQ8'})
|
38
38
|
|
39
|
+
client.list_war_log({clan_tag: '#2U2CYPQ8'})
|
40
|
+
|
39
41
|
client.list_locations()
|
40
42
|
|
41
43
|
client.get_location_info({location_id: 32000254})
|
42
44
|
|
43
|
-
client.
|
45
|
+
client.get_clan_ranking_for_location({location_id: 32000254})
|
46
|
+
|
47
|
+
client.get_player_ranking_for_location({location_id: 32000254})
|
48
|
+
|
49
|
+
client.list_leagues()
|
50
|
+
|
51
|
+
client.get_league({league_id: 29000022})
|
52
|
+
|
53
|
+
client.get_league_seasons({league_id: 29000022})
|
54
|
+
|
55
|
+
client.get_league_season_rankings({league_id: 29000022, season_id: '2016-04'})
|
44
56
|
```
|
45
57
|
|
46
58
|
## Development
|
data/lib/clashinator/client.rb
CHANGED
@@ -5,9 +5,15 @@ module Clashinator
|
|
5
5
|
find_clan: '/v1/clans',
|
6
6
|
get_clan_info: '/v1/clans/{clan_tag}',
|
7
7
|
list_clan_members: '/v1/clans/{clan_tag}/members',
|
8
|
+
list_war_log: '/v1/clans/{clan_tag}/warlog',
|
8
9
|
list_locations: '/v1/locations',
|
9
10
|
get_location_info: '/v1/locations/{location_id}',
|
10
|
-
|
11
|
+
get_clan_ranking_for_location: '/v1/locations/{location_id}/rankings/clans',
|
12
|
+
get_player_ranking_for_location: '/v1/locations/{location_id}/rankings/players',
|
13
|
+
list_leagues: '/v1/leagues',
|
14
|
+
get_league: '/v1/leagues/{league_id}',
|
15
|
+
get_league_seasons: '/v1/leagues/{league_id}/seasons',
|
16
|
+
get_league_season_rankings: '/v1/leagues/{league_id}/seasons/{season_id}'
|
11
17
|
}
|
12
18
|
|
13
19
|
attr_reader :token
|
@@ -28,9 +34,9 @@ module Clashinator
|
|
28
34
|
connection_params = build_connection_params(method_name, params)
|
29
35
|
response = connection.get(
|
30
36
|
connection_params[:url],
|
31
|
-
connection_params[:query_params]
|
37
|
+
connection_params[:query_params].empty? ? {} : connection_params[:query_params]
|
32
38
|
)
|
33
|
-
if response.
|
39
|
+
if response.success?
|
34
40
|
JSON.parse(response.body.to_json)
|
35
41
|
else
|
36
42
|
raise Exceptions::ResponseError.new(response),
|
@@ -7,14 +7,14 @@ module Clashinator
|
|
7
7
|
@response = response
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def to_s
|
11
|
+
super +
|
12
|
+
format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', '))
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def error_code
|
16
|
+
data[:error_code] || data['error_code']
|
17
|
+
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
data/lib/clashinator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clashinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonardo Cabeza
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|