Class: House

Inherits:
Object
  • Object
show all
Defined in:
lib/house_test.rb

Overview

Object to represent a client creating objects against a server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ House

Create a new house

Parameters:

  • params (Hash) (defaults to: {})

    Parameters to create new house with name, rooms, bathrooms, garages



33
34
35
36
37
# File 'lib/house_test.rb', line 33

def initialize(params = {})
  self.handler = HouseHandler
  exchange = handler.post(body: params)
  self.id = exchange.response.body
end

Instance Attribute Details

#handlerObject

Handles API calls



26
27
28
# File 'lib/house_test.rb', line 26

def handler
  @handler
end

#idObject

Attributes mapping to fields in the backend



28
29
30
# File 'lib/house_test.rb', line 28

def id
  @id
end