cocRb 0.1.5 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +54 -5
- data/lib/cocRb/clan.rb +26 -6
- data/lib/cocRb/clanWar.rb +33 -7
- data/lib/cocRb/league.rb +1 -1
- data/lib/cocRb/location.rb +5 -5
- data/lib/cocRb/player.rb +1 -1
- data/lib/cocRb/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b993cb156228909ec86fb7a2602349d0716bb3f7d992f6ee6dda3170956e0fed
|
4
|
+
data.tar.gz: 8cd7de5ac75640877bf3050202eb09c800e7ad2a53f4958b899a4f31cb8dd91e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17538b7183c09c3787d0cf9577b5aee4948acd1c213da5ace2b981dea8b3476056edcf317b8aca1e5aa969b2ade1df8b693fc9e463ca1733bd3a37cbbf830ed5
|
7
|
+
data.tar.gz: 9d04f8a661feebf5619607d96c55999e7186ba8e387608a997906950a6b578786740acac868937948260fa3d6b8f24c6f737bdfb3b3e6dcdaa3752a182b358ed
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
# CocRb
|
4
4
|
|
5
|
-
Welcome everyone to your Ruby Gem CocRb. By using this gem you can easily interact with the Game API of Clash of Clans without using any external gems to call this
|
5
|
+
Welcome everyone to your Ruby Gem CocRb. By using this gem you can easily interact with the Game API of Clash of Clans without using any external gems to call this service.
|
6
|
+
|
7
|
+
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -20,6 +22,51 @@ Or install it yourself as:
|
|
20
22
|
|
21
23
|
$ gem install cocRb
|
22
24
|
|
25
|
+
|
26
|
+
# Links
|
27
|
+
|
28
|
+
* Full Documentation
|
29
|
+
* [GEM](https://rubygems.org/gems/cocRb)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
## Optional Paramters
|
34
|
+
|
35
|
+
* **status**: This is default set to false on every method except *verify_PlayerByToken* method. The method Parameter takes any String as an arguement.
|
36
|
+
**Returns => Status Code for a method**
|
37
|
+
|
38
|
+
* **_limit**: This is also set to false. You can *limit* any request where limit parameter is available for a method.
|
39
|
+
**Paramter Data Type => Integer**
|
40
|
+
|
41
|
+
|
42
|
+
## Method Options
|
43
|
+
|
44
|
+
### Filter Options
|
45
|
+
|
46
|
+
* warFrequency
|
47
|
+
* locationId
|
48
|
+
* minMembers
|
49
|
+
* maxMembers
|
50
|
+
* minClanPoints
|
51
|
+
* minClanLevel
|
52
|
+
|
53
|
+
### Team Input Options
|
54
|
+
|
55
|
+
* clan
|
56
|
+
* opponent
|
57
|
+
|
58
|
+
## Status Codes
|
59
|
+
|
60
|
+
* **200**: Successful Response.
|
61
|
+
* **400**: Client provided incorrect parameters for the request.
|
62
|
+
* **403**: Access denied, either because of missing/incorrect credentials or used API token does not grant access to the requested resource.
|
63
|
+
* **404**: Resource was not found.
|
64
|
+
* **429**: Request was throttled, because amount of requests was above the threshold defined for the used API token.
|
65
|
+
* **500**: Unknown error happened when handling the request.
|
66
|
+
* **503**: Service is temporarily unavailable because of maintenance.
|
67
|
+
* **504**: Request Timeout.
|
68
|
+
|
69
|
+
|
23
70
|
## Usage
|
24
71
|
CocRb Gem is categorized with [Classes](https://www.tutorialspoint.com/ruby/ruby_classes.htm) and [Methods](https://www.tutorialspoint.com/ruby/ruby_methods.htm) as below down you can see but before accessing any of those we have to set **Configuration** in order to setup the Authorization for accessing the [Clash of Clans API](https://developer.clashofclans.com/#) so to do that we have set **Configure** block and inside that block we have configured our **TOKEN** and the **URL**.
|
25
72
|
|
@@ -35,7 +82,7 @@ end
|
|
35
82
|
```
|
36
83
|
After done setting up the Authorization we now need to call the API as you can see down below we called the API using **call_API** method now just before that line we have set the class **ClashApi** by name_spacing with **CocRb** [Module](https://www.tutorialspoint.com/ruby/ruby_modules.htm).
|
37
84
|
|
38
|
-
**Note:** All the data that we will get from the API
|
85
|
+
**Note:** All the data that we will get from the API response was in [JSON](https://jsonapi.org/) but since you are using this gem all of the responses has been **parsed** to Ruby [Hashes](https://www.tutorialspoint.com/ruby/ruby_hashes.htm) so that its get easy for you to access the data.
|
39
86
|
|
40
87
|
|
41
88
|
```ruby
|
@@ -52,9 +99,6 @@ The API can also be called without using the **URL** in the Configuration block
|
|
52
99
|
|
53
100
|
|
54
101
|
|
55
|
-
The Detailed info about all the Classes and Methods for this Library can be found in our Documentation.
|
56
|
-
|
57
|
-
|
58
102
|
```ruby
|
59
103
|
|
60
104
|
CocRb.configure do |config|
|
@@ -69,6 +113,11 @@ response = set_var.verify_PlayerByToken(tag: "#PG8RLGQ2", playertoken: "7jeagw4c
|
|
69
113
|
|
70
114
|
```
|
71
115
|
|
116
|
+
## Support
|
117
|
+
|
118
|
+
* If you need any help understanding the Library, you can join our [Discord Server](https://discord.gg/Eaja7gJ)
|
119
|
+
* OR You can create a new Issue on this Repo.
|
120
|
+
|
72
121
|
## License
|
73
122
|
|
74
123
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/cocRb/clan.rb
CHANGED
@@ -37,6 +37,12 @@ module CocRb
|
|
37
37
|
end
|
38
38
|
|
39
39
|
class Clan < Settings
|
40
|
+
# This method gets clan according to clan filter option. Takes name, filterOptions and filterValue as a parameter.
|
41
|
+
#
|
42
|
+
# If you want to know about _filterOptions_ please check the Github README page for that.
|
43
|
+
#
|
44
|
+
# Paramter Data Types => _String_, _String_, _Integer_
|
45
|
+
|
40
46
|
def self.get_FiltredClan(name:, filterOptions:, filterValue:, _limit: false, status: false)
|
41
47
|
get
|
42
48
|
|
@@ -91,7 +97,9 @@ module CocRb
|
|
91
97
|
puts "Not a valid input option for this method"
|
92
98
|
end
|
93
99
|
end
|
94
|
-
|
100
|
+
# This method gets Clan Information, Takes tag as a parameter.
|
101
|
+
#
|
102
|
+
# Paramter Data Type => _String_
|
95
103
|
def self.get_ClanByTag(tag:, status: false)
|
96
104
|
get
|
97
105
|
io = tag
|
@@ -107,7 +115,9 @@ module CocRb
|
|
107
115
|
convert = JSON.parse(val)
|
108
116
|
end
|
109
117
|
end
|
110
|
-
|
118
|
+
# This method gets Clans by name, Takes name as a parameter.
|
119
|
+
#
|
120
|
+
# Paramter Data Type => _String_
|
111
121
|
def self.get_ClanByName(name:, _limit: false, status: false)
|
112
122
|
get
|
113
123
|
count = name.split(/[^-a-zA-Z]/).size
|
@@ -155,7 +165,9 @@ module CocRb
|
|
155
165
|
end
|
156
166
|
end
|
157
167
|
end
|
158
|
-
|
168
|
+
# This method gets clan by Location ID. Takes Location ID as a parameter.
|
169
|
+
#
|
170
|
+
# Paramter Data Type => _Integer_
|
159
171
|
def self.get_ClanByLocationID(id:, _limit: false, status:false)
|
160
172
|
get
|
161
173
|
|
@@ -174,7 +186,9 @@ module CocRb
|
|
174
186
|
convert = JSON.parse(val)
|
175
187
|
end
|
176
188
|
end
|
177
|
-
|
189
|
+
# This method gets clan by minimum Clan Level. Takes clan level as a parameter.
|
190
|
+
#
|
191
|
+
# Paramter Data Type => _Integer_
|
178
192
|
def self.get_ClanByMinClanLevel(clanLevel:, _limit: false, status: false)
|
179
193
|
get
|
180
194
|
res = @conn.get('v1/clans') do |req|
|
@@ -191,7 +205,9 @@ module CocRb
|
|
191
205
|
convert = JSON.parse(val)
|
192
206
|
end
|
193
207
|
end
|
194
|
-
|
208
|
+
# This method gets clan members. Takes clan tag as a parameter.
|
209
|
+
#
|
210
|
+
# Paramter Data Type => _String_
|
195
211
|
def self.get_ClanMembers(tag:, _limit:false, status:false)
|
196
212
|
get
|
197
213
|
io = tag
|
@@ -209,7 +225,11 @@ module CocRb
|
|
209
225
|
convert = JSON.parse(val)
|
210
226
|
end
|
211
227
|
end
|
212
|
-
|
228
|
+
# This method gets detailed clan members. Takes clan tag as a parameter.
|
229
|
+
#
|
230
|
+
# Note: _This method might take 1-2 min time to get execute depending on the data you are requesting_
|
231
|
+
#
|
232
|
+
# Paramter Data Type => _String_
|
213
233
|
def self.get_DetailedClanMembers(tag:, _limit: false, status: false)
|
214
234
|
get
|
215
235
|
|
data/lib/cocRb/clanWar.rb
CHANGED
@@ -38,6 +38,9 @@ module CocRb
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class ClanWar < Settings
|
41
|
+
# This methods gets the current warLog for a clan, Takes clan tag as a paramter
|
42
|
+
#
|
43
|
+
# Paramter Data Type => _String_
|
41
44
|
def self.get_WarLog(tag:, _limit:false, status: false)
|
42
45
|
get
|
43
46
|
io = tag
|
@@ -53,7 +56,9 @@ module CocRb
|
|
53
56
|
convert = JSON.parse(val)
|
54
57
|
end
|
55
58
|
end
|
56
|
-
|
59
|
+
# This method gets information about current on-going war,Takes tag as a paramter
|
60
|
+
#
|
61
|
+
# Paramter Data Type => _String_
|
57
62
|
def self.get_ClanWar(tag:, status: false)
|
58
63
|
get
|
59
64
|
io = tag
|
@@ -68,7 +73,11 @@ module CocRb
|
|
68
73
|
convert = JSON.parse(val)
|
69
74
|
end
|
70
75
|
end
|
71
|
-
|
76
|
+
# This method gets the members that are in war. In Descending to Ascending TH order. Takes tag as a paramter and teamInput.
|
77
|
+
#
|
78
|
+
# Note: _The team Input options can be found in Github README._
|
79
|
+
#
|
80
|
+
# Paramter Data Types => _String_
|
72
81
|
def self.get_ClanWarMembers(tag:, teamInput:, status: false)
|
73
82
|
get
|
74
83
|
teamInput_Options = ["clan", "opponent"]
|
@@ -98,7 +107,11 @@ module CocRb
|
|
98
107
|
end
|
99
108
|
end
|
100
109
|
end
|
101
|
-
|
110
|
+
# This method gets all the timings for on-going war in UTC Time Zone, Takes tag as a paramater
|
111
|
+
#
|
112
|
+
# Note: _This method will also return the War Times in parsed Format_
|
113
|
+
#
|
114
|
+
# Paramter Data Type => _String_
|
102
115
|
def self.get_WarTime(tag:, status: false)
|
103
116
|
get
|
104
117
|
io = tag
|
@@ -136,6 +149,9 @@ module CocRb
|
|
136
149
|
end
|
137
150
|
|
138
151
|
class ClanWarLeague < Settings
|
152
|
+
# This method gets Clan War League Group, Takes tag as a paramter.
|
153
|
+
#
|
154
|
+
# Paramter Data Type => _String_
|
139
155
|
def self.get_ClanWarLeagueGroup(tag:,status: false)
|
140
156
|
get
|
141
157
|
io = tag
|
@@ -151,7 +167,9 @@ end
|
|
151
167
|
convert = JSON.parse(val)
|
152
168
|
end
|
153
169
|
end
|
154
|
-
|
170
|
+
# This method only returns the filtred items [tag, name,ClanLevel,badgeUrls] from Clan War League Group Endpoint. Takes tag as a paramter
|
171
|
+
#
|
172
|
+
# Paramter Data Type => _String_
|
155
173
|
def self.get_ClanWarLeagueClanItems(tag:,status: false)
|
156
174
|
get
|
157
175
|
io = tag
|
@@ -227,7 +245,9 @@ end
|
|
227
245
|
|
228
246
|
end
|
229
247
|
end
|
230
|
-
|
248
|
+
# This method returns the WarTags for all the Groups. Takes tag as a paramter.
|
249
|
+
#
|
250
|
+
# Paramter Data Type => _String_
|
231
251
|
def self.get_WarTags(tag:, status:false)
|
232
252
|
get
|
233
253
|
|
@@ -248,7 +268,9 @@ end
|
|
248
268
|
|
249
269
|
end
|
250
270
|
end
|
251
|
-
|
271
|
+
# This method gets info for a particular War, Takes WarTag as a Paramter
|
272
|
+
#
|
273
|
+
# Paramter Data Type => _String_
|
252
274
|
def self.get_ClanWarLeagueWars(warTag:, status:false)
|
253
275
|
get
|
254
276
|
io = warTag
|
@@ -264,7 +286,11 @@ end
|
|
264
286
|
convert = JSON.parse(val)
|
265
287
|
end
|
266
288
|
end
|
267
|
-
|
289
|
+
# This method gets all the timings for on-going Clan War League in UTC Time Zone, Takes tag as a paramater
|
290
|
+
#
|
291
|
+
# Note: _This method will also return the War Times in parsed Format_
|
292
|
+
#
|
293
|
+
# Paramter Data Type => _String_
|
268
294
|
def self.get_ClanWarLeagueWarTimes(warTag:, status: false)
|
269
295
|
get
|
270
296
|
io = warTag
|
data/lib/cocRb/league.rb
CHANGED
@@ -55,7 +55,7 @@ class League < Settings
|
|
55
55
|
end
|
56
56
|
# This method gets season Info for Legend League, Takes League ID as a parameter.
|
57
57
|
#
|
58
|
-
#
|
58
|
+
# Paramter Data Type => _Integer_
|
59
59
|
def self.get_Seasons(leagueId:, _limit:false, status:false)
|
60
60
|
get
|
61
61
|
if leagueId != 29000022
|
data/lib/cocRb/location.rb
CHANGED
@@ -52,7 +52,7 @@ class Location < Settings
|
|
52
52
|
end
|
53
53
|
# This method gets detailed location information, takes Location ID as a paramter.
|
54
54
|
#
|
55
|
-
#
|
55
|
+
# Paramter Data Type => _Integer_
|
56
56
|
def self.get_LocationInfo(locationId:, status:false)
|
57
57
|
get
|
58
58
|
res = @conn.get("v1/locations/#{locationId}")
|
@@ -66,7 +66,7 @@ end
|
|
66
66
|
|
67
67
|
# This method gets all the Ranked clans for a particular Location, Takes Location id as a paramter.
|
68
68
|
#
|
69
|
-
#
|
69
|
+
# Paramter Data Type => _Integer_
|
70
70
|
def self.get_LocationRankClan(locationId:, _limit:false, status:false)
|
71
71
|
get
|
72
72
|
res = @conn.get("v1/locations/#{locationId}/rankings/clans") do |req|
|
@@ -81,7 +81,7 @@ end
|
|
81
81
|
end
|
82
82
|
# This method gets all the Ranked palyers for a particular Location, Takes Location id as a paramter.
|
83
83
|
#
|
84
|
-
#
|
84
|
+
# Paramter Data Type => _Integer_
|
85
85
|
def self.get_LocationRankPlayer(locationId:, _limit:false, status:false)
|
86
86
|
get
|
87
87
|
res = @conn.get("v1/locations/#{locationId}/rankings/players") do |req|
|
@@ -96,7 +96,7 @@ end
|
|
96
96
|
end
|
97
97
|
# This method gets all the Ranked clans for Builder Base Clan Versus Trophies, Takes Location id as a paramter.
|
98
98
|
#
|
99
|
-
#
|
99
|
+
# Paramter Data Type => _Integer_
|
100
100
|
def self.get_LocationRankClanVersus(locationId:, _limit:false, status:false)
|
101
101
|
get
|
102
102
|
res = @conn.get("v1/locations/#{locationId}/rankings/clans-versus") do |req|
|
@@ -111,7 +111,7 @@ end
|
|
111
111
|
end
|
112
112
|
# This method gets all the Ranked players for Builder Base Player Versus Trophies, Takes Location id as a paramter.
|
113
113
|
#
|
114
|
-
#
|
114
|
+
# Paramter Data Type => _Integer_
|
115
115
|
def self.get_LocationRankPlayerVersus(locationId:, _limit:false, status:false)
|
116
116
|
get
|
117
117
|
res = @conn.get("v1/locations/#{locationId}/rankings/players-versus") do |req|
|
data/lib/cocRb/player.rb
CHANGED
data/lib/cocRb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocRb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crusader123
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.1.0
|
97
|
-
description:
|
97
|
+
description:
|
98
98
|
email:
|
99
99
|
- crazyboy15october@gmail.com
|
100
100
|
executables: []
|
@@ -136,5 +136,5 @@ requirements: []
|
|
136
136
|
rubygems_version: 3.2.15
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
|
-
summary: A Gem for
|
139
|
+
summary: A Gem for interacting with the Clash of Clans API easily!
|
140
140
|
test_files: []
|