Class: Asdawqw::Bedroom
- Defined in:
- lib/asdawqw/models/bedroom.rb
Overview
Bedroom Model.
Instance Attribute Summary collapse
-
#beds ⇒ Beds
Beds information per room.
-
#private_bathroom ⇒ Boolean
Room have private bathroom.
-
#type ⇒ BedroomTypeEnum
Living Room Type of room.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(beds = nil, type = nil, private_bathroom = nil) ⇒ Bedroom
constructor
A new instance of Bedroom.
Methods inherited from BaseModel
Constructor Details
#initialize(beds = nil, type = nil, private_bathroom = nil) ⇒ Bedroom
Returns a new instance of Bedroom.
30 31 32 33 34 35 36 |
# File 'lib/asdawqw/models/bedroom.rb', line 30 def initialize(beds = nil, type = nil, private_bathroom = nil) @beds = beds @type = type @private_bathroom = private_bathroom end |
Instance Attribute Details
#beds ⇒ Beds
Beds information per room
11 12 13 |
# File 'lib/asdawqw/models/bedroom.rb', line 11 def beds @beds end |
#private_bathroom ⇒ Boolean
Room have private bathroom
19 20 21 |
# File 'lib/asdawqw/models/bedroom.rb', line 19 def private_bathroom @private_bathroom end |
#type ⇒ BedroomTypeEnum
Living Room Type of room
15 16 17 |
# File 'lib/asdawqw/models/bedroom.rb', line 15 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/asdawqw/models/bedroom.rb', line 39 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. beds = Beds.from_hash(hash['beds']) if hash['beds'] type = hash['type'] private_bathroom = hash['privateBathroom'] # Create object from extracted values. Bedroom.new(beds, type, private_bathroom) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 28 |
# File 'lib/asdawqw/models/bedroom.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['beds'] = 'beds' @_hash['type'] = 'type' @_hash['private_bathroom'] = 'privateBathroom' @_hash end |