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