Class: Cricket::Request

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/CricApi/helper/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(service, page) ⇒ Request

Returns a new instance of Request.



9
10
11
# File 'lib/CricApi/helper/request.rb', line 9

def initialize(service, page)
  @options = { query: {site: service, page: page} }
end

Instance Method Details

#ballByball(id) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/CricApi/helper/request.rb', line 45

def ballByball(id)
  self.class.post("/api/ballByBall",
  :body => {
    :unique_id => id
  }
  )
end

#commentry(id) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/CricApi/helper/request.rb', line 53

def commentry(id)
  self.class.post("/api/commentry",
  :body => {
    :unique_id => id
  }
  )
end

#cricketObject



13
14
15
# File 'lib/CricApi/helper/request.rb', line 13

def cricket
  self.class.get("/api/cricket", @options)
end

#cricketScore(id) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/CricApi/helper/request.rb', line 29

def cricketScore(id)
  self.class.post("/api/cricketScore",
  :body => {
    :unique_id => id
  }
  )
end

#getNewsObject



25
26
27
# File 'lib/CricApi/helper/request.rb', line 25

def getNews
  self.class.get("/api/news", @options)
end

#matchCalendarObject



21
22
23
# File 'lib/CricApi/helper/request.rb', line 21

def matchCalendar
  self.class.get("/api/matchCalendar", @options)
end

#matchesObject



17
18
19
# File 'lib/CricApi/helper/request.rb', line 17

def matches
  self.class.get("/api/matches", @options)
end

#news(id) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/CricApi/helper/request.rb', line 61

def news(id)
  self.class.post("/api/news",
  :body => {
    :unique_id => id
  }
  )
end

#playerStats(id) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/CricApi/helper/request.rb', line 37

def playerStats(id)
  self.class.post("/api/playerStats",
  :body => {
    :pid => id
  }
  )
end

#score(id) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/CricApi/helper/request.rb', line 69

def score(id)
  self.class.post("/api/score",
  :body => {
    :unique_id => id
  }
  )
end