class Object

Public Class Methods

all() click to toggle source
# File lib/not_mcdonalds.rb, line 15
def self.all
  response = HTTP.get("http://localhost:3000/api/buildings")
  data_hash = response.parse
  data_hash.map { |building| Building.new(building) }
end
create(client_params) click to toggle source
# File lib/not_mcdonalds.rb, line 27
def self.create(client_params)
                  
  response = HTTP.post(
                       "http://localhost:3000/api/buildings", 
                       form: client_params
                      )

  data_hash = response.parse
  Building.new(data_hash)
end
find(params_id) click to toggle source
# File lib/not_mcdonalds.rb, line 21
def self.find(params_id)
  response = HTTP.get("http://localhost:3000/api/buildings/#{params_id}")
  data_hash = response.parse
  Building.new(data_hash)
end
test() click to toggle source
# File lib/not_mcdonalds.rb, line 55
def self.test
  puts "goodbye world!"
end

Public Instance Methods

architect_array() click to toggle source
# File lib/not_mcdonalds.rb, line 51
def architect_array
  self.architect.split(",")
end
destroy() click to toggle source
# File lib/not_mcdonalds.rb, line 47
def destroy
  response = HTTP.delete("http://localhost:3000/api/buildings/#{self.id}")
end
update(client_params) click to toggle source
# File lib/not_mcdonalds.rb, line 38
def update(client_params)
  response = HTTP.patch(
                        "http://localhost:3000/api/buildings/#{self.id}", 
                        form: client_params
                        )
  data_hash = response.parse
  Building.new(data_hash)
end