Class: Gonebusy::EntitiesResourceAvailabilities
- Defined in:
- lib/gonebusy/models/entities_resource_availabilities.rb
Instance Attribute Summary collapse
-
#available_slots ⇒ List of EntitiesSlots
array of available date and time slots.
-
#id ⇒ Integer
id of Resource.
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(available_slots = nil, id = nil) ⇒ EntitiesResourceAvailabilities
constructor
A new instance of EntitiesResourceAvailabilities.
Methods inherited from BaseModel
Constructor Details
#initialize(available_slots = nil, id = nil) ⇒ EntitiesResourceAvailabilities
Returns a new instance of EntitiesResourceAvailabilities.
23 24 25 26 27 |
# File 'lib/gonebusy/models/entities_resource_availabilities.rb', line 23 def initialize(available_slots = nil, id = nil) @available_slots = available_slots @id = id end |
Instance Attribute Details
#available_slots ⇒ List of EntitiesSlots
array of available date and time slots
7 8 9 |
# File 'lib/gonebusy/models/entities_resource_availabilities.rb', line 7 def available_slots @available_slots end |
#id ⇒ Integer
id of Resource
11 12 13 |
# File 'lib/gonebusy/models/entities_resource_availabilities.rb', line 11 def id @id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gonebusy/models/entities_resource_availabilities.rb', line 30 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash # Parameter is an array, so we need to iterate through it available_slots = nil if hash["available_slots"] != nil available_slots = Array.new hash["available_slots"].each{|structure| available_slots << (EntitiesSlots.from_hash(structure) if structure)} end id = hash["id"] # Create object from extracted values EntitiesResourceAvailabilities.new(available_slots, id) end end |
.names ⇒ Object
A mapping from model property names to API property names
14 15 16 17 18 19 20 21 |
# File 'lib/gonebusy/models/entities_resource_availabilities.rb', line 14 def self.names if @hash.nil? @hash = {} @hash["available_slots"] = "available_slots" @hash["id"] = "id" end @hash end |