Class: CocRb::ClanWarLeague
Class Method Summary collapse
-
.get_ClanWarLeagueClanItems(tag:, status: false) ⇒ Object
This method only returns the filtred items [tag, name,ClanLevel,badgeUrls] from Clan War League Group Endpoint.
-
.get_ClanWarLeagueGroup(tag:, status: false) ⇒ Object
This method gets Clan War League Group, Takes tag as a paramter.
-
.get_ClanWarLeagueWars(warTag:, status: false) ⇒ Object
This method gets info for a particular War, Takes WarTag as a Paramter.
-
.get_ClanWarLeagueWarTimes(warTag:, status: false) ⇒ Object
This method gets all the timings for on-going Clan War League in UTC Time Zone, Takes tag as a paramater.
-
.get_WarTags(tag:, status: false) ⇒ Object
This method returns the WarTags for all the Groups.
Methods inherited from Settings
Class Method Details
.get_ClanWarLeagueClanItems(tag:, status: false) ⇒ Object
This method only returns the filtred items [tag, name,ClanLevel,badgeUrls] from Clan War League Group Endpoint. Takes tag as a paramter
Paramter Data Type => String
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/cocRb/clanWar.rb', line 173 def self.get_ClanWarLeagueClanItems(tag:,status: false) get io = tag tag = io.gsub('#', '%23') res = @conn.get("v1/clans/#{tag}/currentwar/leaguegroup") if status res.status else parse = res.body convert = JSON.parse(parse) clans = convert['clans'] items_name = clans.map { |n| n['name'] } items_tag = clans.map { |t| t['tag'] } items_clanLevel = clans.map { |c| c['clanLevel'] } items_badgeUrls = clans.map { |b| b['badgeUrls'] } clanItems = { 'tag' => items_tag[0], 'name' => items_name[0], 'clanLevel' => items_clanLevel[0], 'badgeUrls' => items_badgeUrls[0] }, { 'tag' => items_tag[1], 'name' => items_name[1], 'clanLevel' => items_clanLevel[1], 'badgeUrls' => items_badgeUrls[1] }, { 'tag' => items_tag[2], 'name' => items_name[2], 'clanLevel' => items_clanLevel[2], 'badgeUrls' => items_badgeUrls[2] }, { 'tag' => items_tag[3], 'name' => items_name[3], 'clanLevel' => items_clanLevel[3], 'badgeUrls' => items_badgeUrls[3] }, { 'tag' => items_tag[4], 'name' => items_name[4], 'clanLevel' => items_clanLevel[4], 'badgeUrls' => items_badgeUrls[4] }, { 'tag' => items_tag[5], 'name' => items_name[5], 'clanLevel' => items_clanLevel[5], 'badgeUrls' => items_badgeUrls[5] }, { 'tag' => items_tag[6], 'name' => items_name[6], 'clanLevel' => items_clanLevel[6], 'badgeUrls' => items_badgeUrls[6] }, { 'tag' => items_tag[7], 'name' => items_name[7], 'clanLevel' => items_clanLevel[7], 'badgeUrls' => items_badgeUrls[7] }.freeze end end |
.get_ClanWarLeagueGroup(tag:, status: false) ⇒ Object
This method gets Clan War League Group, Takes tag as a paramter.
Paramter Data Type => String
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/cocRb/clanWar.rb', line 155 def self.get_ClanWarLeagueGroup(tag:,status: false) get io = tag tag = io.gsub('#', '%23') res = @conn.get("v1/clans/#{tag}/currentwar/leaguegroup") if status res.status else val = res.body convert = JSON.parse(val) end end |
.get_ClanWarLeagueWars(warTag:, status: false) ⇒ Object
This method gets info for a particular War, Takes WarTag as a Paramter
Paramter Data Type => String
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/cocRb/clanWar.rb', line 274 def self.get_ClanWarLeagueWars(warTag:, status:false) get io = warTag tag = io.gsub('#', '%23') res = @conn.get("v1/clanwarleagues/wars/#{tag}") if status res.status else val = res.body convert = JSON.parse(val) end end |
.get_ClanWarLeagueWarTimes(warTag:, status: false) ⇒ Object
This method gets all the timings for on-going Clan War League in UTC Time Zone, Takes tag as a paramater
Note: _This method will also return the War Times in parsed Format_
Paramter Data Type => String
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/cocRb/clanWar.rb', line 294 def self.get_ClanWarLeagueWarTimes(warTag:, status: false) get io = warTag tag = io.gsub('#', '%23') res = @conn.get("v1/clanwarleagues/wars/#{tag}") if status res.status else val = res.body convert = JSON.parse(val) prepStartTime = convert["preparationStartTime"] startTime = convert["startTime"] endTime = convert["endTime"] parsed_preparationStartTime = Time.parse(prepStartTime).strftime('%y-%m-%d, %I:%M:%S %p') parsed_startTime = Time.parse(startTime).strftime('%y-%m-%d, %I:%M:%S %p') parsed_endTime = Time.parse(endTime).strftime('%y-%m-%d, %I:%M:%S %p') times = { "preparationStartTime" => prepStartTime, "startTime" => startTime, "endTime" => endTime }, { "parsed_preparationStartTime" => parsed_preparationStartTime, "parsed_startTime" => parsed_startTime, "parsed_endTime" => parsed_endTime } end end |
.get_WarTags(tag:, status: false) ⇒ Object
This method returns the WarTags for all the Groups. Takes tag as a paramter.
Paramter Data Type => String
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/cocRb/clanWar.rb', line 251 def self.get_WarTags(tag:, status:false) get io = tag tag = io.gsub('#', '%23') res = @conn.get("v1/clans/#{tag}/currentwar/leaguegroup") if status res.status else val = res.body convert = JSON.parse(val) rounds = convert['rounds'] end end |