Class: Fanfeedrb::Fanfeedr::League
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Abstract
accessor, date_reader, #id, reader, #to_xml
Constructor Details
#initialize(fanfeedr, attributes = {}) ⇒ League
Returns a new instance of League.
8
9
10
11
12
|
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 8
def initialize(fanfeedr, attributes = {})
p "league attr: #{attributes}"
@fanfeedr = fanfeedr
super(attributes)
end
|
Instance Attribute Details
#fanfeedr ⇒ Object
Returns the value of attribute fanfeedr.
4
5
6
|
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 4
def fanfeedr
@fanfeedr
end
|
Instance Method Details
#conference(conference_id) ⇒ Object
14
15
16
17
|
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 14
def conference(conference_id)
raise Error, "No conference id given" if conference_id.to_s.empty?
Conference.new(self,fanfeedr.get_json("/conferences/#{conference_id}"))
end
|
#conferences(*args) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 18
def conferences(*args)
path = "/leagues/#{id}/conferences"
response = fanfeedr.get_json(path)
[response].flatten.compact.map {|s| Conference.new(self,s)}
end
|
#event(event_id) ⇒ Object
25
26
27
28
|
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 25
def event(event_id)
raise Error, "No conference id given" if event_id.to_s.empty?
Event.new(self,fanfeedr.get_json("/events/#{event_id}"))
end
|
#events(startdate = Time.now, enddate = Time.now) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 30
def events(startdate = Time.now, enddate = Time.now)
today = startdate.strftime("%m/%d/%Y") == enddate.strftime("%m/%d/%Y") && startdate.strftime("%m/%d/%Y") == Time.now.strftime("%m/%d/%Y")
path = "/leagues/#{id}/events/today"
response = fanfeedr.get_json(path)
end
|