Class: CocRb::League

Inherits:
Settings show all
Defined in:
lib/cocRb/league.rb

Class Method Summary collapse

Methods inherited from Settings

get

Class Method Details

.get_LeagueInfo(leagueId:, status: false) ⇒ Object

This method gets League Info for a particular league ID.

*Paramter Data Type* => Integer



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cocRb/league.rb', line 98

def self.get_LeagueInfo(leagueId:, status:false)
              get
              res = @conn.get("v1/leagues/#{leagueId}")
       if status
              res.status
       else
              val = res.body
              convert = JSON.parse(val)

    end
end

.get_LeagueSeasonRank(leagueId:, seasonId:, _limit: false, status: false) ⇒ Object

This method gets Season Rank for Legend League, Takes League ID and Season ID as parameter.

*Paramter Data Types* => Integer, String



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/cocRb/league.rb', line 79

def self.get_LeagueSeasonRank(leagueId:, seasonId:, _limit:false, status:false)
              get
      if leagueId != 29000022
              puts "Not a valid League id,Seasons are only available for Legend League"
      else
              res = @conn.get("v1/leagues/#{leagueId}/seasons/#{seasonId}") do |req|
              req.params[:limit] = _limit if _limit
   end
       if status
              res.status
       else
              val = res.body
              convert = JSON.parse(val)
      end
   end
end

.get_LeaguesID(_limit: false, status: false) ⇒ Object

This method gets League ID for all the Leagues.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cocRb/league.rb', line 41

def self.get_LeaguesID(_limit:false, status:false)
              get
              res = @conn.get('v1/leagues') do |req|
              req.params[:limit] = _limit if _limit
   end

         if status
              res.status

         else
              val = res.body
              convert = JSON.parse(val)

  end
end

.get_Seasons(leagueId:, _limit: false, status: false) ⇒ Object

This method gets season Info for Legend League, Takes League ID as a parameter.

Paramter Data Type => Integer



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/cocRb/league.rb', line 59

def self.get_Seasons(leagueId:, _limit:false, status:false)
          get
   if leagueId != 29000022
          puts "Not a valid League id,Seasons are only available for Legend League"
   else
          res = @conn.get("v1/leagues/#{leagueId}/seasons") do |req|
          req.params[:limit] = _limit if _limit
  end

    if status
          res.status
    else
          val = res.body
          convert = JSON.parse(val)
      end
   end
end

.get_WarLeagueId(_limit: false, status: false) ⇒ Object

This method gets War League ID.



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cocRb/league.rb', line 111

def self.get_WarLeagueId(_limit:false, status:false)
         get
         res = @conn.get("v1/warleagues") do |req|
         req.params[:limit] = _limit if _limit
end

   if status
         res.status
   else
         val = res.body
         convert = JSON.parse(val)
    end
end

.get_WarLeagueInfo(warLeagueId:, status: false) ⇒ Object

This method gets War League Info takes warLeagueId as a paramter.

*Paramter Data Type* => Integer



127
128
129
130
131
132
133
134
135
136
# File 'lib/cocRb/league.rb', line 127

def self.get_WarLeagueInfo(warLeagueId:, status:false)
     get
     res = @conn.get("v1/warleagues/#{warLeagueId}")
     if status
     res.status
     else
     val = res.body
     convert = JSON.parse(val)
    end
end