Class: Konzertmeister::EarlyAccessProgram
- Inherits:
-
Object
- Object
- Konzertmeister::EarlyAccessProgram
- Defined in:
- lib/konzertmeister/early_access_program.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
Returns the value of attribute key.
Class Method Summary collapse
Instance Method Summary collapse
- #backends ⇒ Object
-
#initialize(data = {}) ⇒ EarlyAccessProgram
constructor
A new instance of EarlyAccessProgram.
Constructor Details
#initialize(data = {}) ⇒ EarlyAccessProgram
Returns a new instance of EarlyAccessProgram.
31 32 33 34 35 36 |
# File 'lib/konzertmeister/early_access_program.rb', line 31 def initialize(data = {}) @id = data.fetch('program_id') @key = data.fetch('program_key') @description = data.fetch('program_description') @data = data end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/konzertmeister/early_access_program.rb', line 4 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/konzertmeister/early_access_program.rb', line 3 def id @id end |
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/konzertmeister/early_access_program.rb', line 4 def key @key end |
Class Method Details
.all ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/konzertmeister/early_access_program.rb', line 6 def self.all response = Konzertmeister.session.get('/early_access_programs') if response response.map do |data| Konzertmeister::EarlyAccessProgram.new(data) end.sort_by do |eap| eap.id end end end |
.find_by(attr, value) ⇒ Object
17 18 19 |
# File 'lib/konzertmeister/early_access_program.rb', line 17 def self.find_by(attr, value) EarlyAccessProgram.new(Konzertmeister.session.get("/early_access_programs/#{attr}/#{value}")) end |
Instance Method Details
#backends ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/konzertmeister/early_access_program.rb', line 21 def backends if @data.key?('backends') @data.fetch('backends').map do |be_hash| Konzertmeister::Backend.new(be_hash) end.sort_by(&:short_name) else EarlyAccessProgram.find_by('id', self.id).backends end end |