Class: Building
- Inherits:
-
Object
- Object
- Building
- Defined in:
- lib/b_rabbit.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#architect ⇒ Object
readonly
Returns the value of attribute architect.
-
#construction_date ⇒ Object
readonly
Returns the value of attribute construction_date.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(input_options) ⇒ Building
constructor
A new instance of Building.
- #update(input_options) ⇒ Object
Constructor Details
#initialize(input_options) ⇒ Building
Returns a new instance of Building.
5 6 7 8 9 10 11 12 |
# File 'lib/b_rabbit.rb', line 5 def initialize() @id = ["id"] @name = ["name"] @address = ["address"] @height = ["height"] @construction_date = ["construction_date"] @architect = ["architect"] end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
3 4 5 |
# File 'lib/b_rabbit.rb', line 3 def address @address end |
#architect ⇒ Object (readonly)
Returns the value of attribute architect.
3 4 5 |
# File 'lib/b_rabbit.rb', line 3 def architect @architect end |
#construction_date ⇒ Object (readonly)
Returns the value of attribute construction_date.
3 4 5 |
# File 'lib/b_rabbit.rb', line 3 def construction_date @construction_date end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
3 4 5 |
# File 'lib/b_rabbit.rb', line 3 def height @height end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/b_rabbit.rb', line 3 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/b_rabbit.rb', line 3 def name @name end |
Class Method Details
.all ⇒ Object
20 21 22 23 |
# File 'lib/b_rabbit.rb', line 20 def self.all response = HTTP.get("http://localhost:3000/api/buildings") response.parse.map {|element| Building.new(element)} end |
Instance Method Details
#destroy ⇒ Object
39 40 41 |
# File 'lib/b_rabbit.rb', line 39 def destroy response = HTTP.delete("http://localhost:3000/api/buildings/#{self.id}") end |