Class: Infostrada::Edition
- Inherits:
-
Object
- Object
- Infostrada::Edition
- Extended by:
- Forwardable
- Defined in:
- lib/infostrada/edition.rb
Instance Attribute Summary collapse
-
#competition ⇒ Object
Returns the value of attribute competition.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#id ⇒ Object
Returns the value of attribute id.
-
#season ⇒ Object
Returns the value of attribute season.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash = {}, &block) ⇒ Edition
constructor
A new instance of Edition.
-
#phases ⇒ Object
Get phases for this edition.
- #teams ⇒ Object
Constructor Details
#initialize(hash = {}, &block) ⇒ Edition
Returns a new instance of Edition.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/infostrada/edition.rb', line 27 def initialize(hash = {}, &block) @id = hash.delete('n_EditionID') @season = hash.delete('c_Season') if hash['d_EditionStartDate'] @start_date = Formatter.format_date(hash.delete('d_EditionStartDate')) end @end_date = Formatter.format_date(hash.delete('d_EditionEndDate')) if hash['d_EditionEndDate'] @competition = Competition.new(hash) block.call(self) if block_given? self end |
Instance Attribute Details
#competition ⇒ Object
Returns the value of attribute competition.
7 8 9 |
# File 'lib/infostrada/edition.rb', line 7 def competition @competition end |
#end_date ⇒ Object
Returns the value of attribute end_date.
7 8 9 |
# File 'lib/infostrada/edition.rb', line 7 def end_date @end_date end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/infostrada/edition.rb', line 7 def id @id end |
#season ⇒ Object
Returns the value of attribute season.
7 8 9 |
# File 'lib/infostrada/edition.rb', line 7 def season @season end |
#start_date ⇒ Object
Returns the value of attribute start_date.
7 8 9 |
# File 'lib/infostrada/edition.rb', line 7 def start_date @start_date end |
Class Method Details
.all ⇒ Object
12 13 14 |
# File 'lib/infostrada/edition.rb', line 12 def self.all editions = EditionRequest.get_list end |
.from_json(json = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/infostrada/edition.rb', line 16 def self.from_json(json = {}) self.new do |edition| edition.id = json['id'] edition.competition = json['competition'] edition.season = json['season'] edition.start_date = json['start_date'] edition.end_date = json['end_date'] edition.competition = Competition.from_json(json['competition']) end end |