Class: Building
- Inherits:
-
Object
- Object
- Building
- Defined in:
- lib/frozen_yogurt.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#architect ⇒ Object
Returns the value of attribute architect.
-
#construction_date ⇒ Object
Returns the value of attribute construction_date.
-
#height ⇒ Object
Returns the value of attribute height.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
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_hash) ⇒ Object
Constructor Details
#initialize(input_options) ⇒ Building
Returns a new instance of Building.
8 9 10 11 12 13 14 15 |
# File 'lib/frozen_yogurt.rb', line 8 def initialize() @id = ["id"] @name = ["name"] @address = ["address"] @height = ["height"] @construction_date = ["construction_date"] @architect = ["architect"] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
7 8 9 |
# File 'lib/frozen_yogurt.rb', line 7 def address @address end |
#architect ⇒ Object
Returns the value of attribute architect.
7 8 9 |
# File 'lib/frozen_yogurt.rb', line 7 def architect @architect end |
#construction_date ⇒ Object
Returns the value of attribute construction_date.
7 8 9 |
# File 'lib/frozen_yogurt.rb', line 7 def construction_date @construction_date end |
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/frozen_yogurt.rb', line 7 def height @height end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/frozen_yogurt.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/frozen_yogurt.rb', line 7 def name @name end |
Class Method Details
.all ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/frozen_yogurt.rb', line 23 def self.all response = HTTP.get("http://localhost:3000/api/buildings") building_array = response.parse all_building_objects = [] building_array.each do |building| all_building_objects << Building.new(building) end all_building_objects end |
Instance Method Details
#destroy ⇒ Object
50 51 52 |
# File 'lib/frozen_yogurt.rb', line 50 def destroy response = HTTP.delete("http://localhost:3000/api/buildings/#{id}") end |
#update(input_hash) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/frozen_yogurt.rb', line 43 def update(input_hash) response = HTTP.patch( "http://localhost:3000/api/buildings/#{id}", form: input_hash ) end |