Class: Fanfeedrb::Fanfeedr::League
- Defined in:
- lib/fanfeedrb/fanfeedr/league.rb
Instance Attribute Summary collapse
-
#fanfeedr ⇒ Object
readonly
Returns the value of attribute fanfeedr.
Instance Method Summary collapse
- #conference(conference_id) ⇒ Object
- #conferences(*args) ⇒ Object
- #events(startdate = Time.now, enddate = Time.now) ⇒ Object
-
#initialize(fanfeedr, attributes = {}) ⇒ League
constructor
A new instance of League.
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 (readonly)
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" #path << "?api_key=#{CGI.escape(Fanfeedrb.config['api_token'])}" #if filter response = fanfeedr.get_json(path) [response].flatten.compact.map {|s| Conference.new(self,s)} end |
#events(startdate = Time.now, enddate = Time.now) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fanfeedrb/fanfeedr/league.rb', line 26 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" #today = startdate.strftime("%m/%d/%Y") == enddate.strftime("%m/%d/%Y") && startdate.strftime("%m/%d/%Y") == Time.now.strftime("%m/%d/%Y") #subpath = #path << "?api_key=#{CGI.escape(Fanfeedrb.config['api_token'])}" #if filter response = fanfeedr.get_json(path) end |