Class: Gonebusy::EntitiesScheduleResponse
- Defined in:
- lib/gonebusy/models/entities_schedule_response.rb
Instance Attribute Summary collapse
-
#id ⇒ Integer
id of Schedule.
-
#owner_id ⇒ Integer
id of owner of Schedule.
-
#resource_id ⇒ Integer
id of Resource.
-
#service_id ⇒ Integer
id of Service.
-
#time_windows ⇒ List of EntitiesTimeWindowResponse
array of TimeWindows making up Schedule.
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, resource_id = nil, service_id = nil, time_windows = nil) ⇒ EntitiesScheduleResponse
constructor
A new instance of EntitiesScheduleResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, owner_id = nil, resource_id = nil, service_id = nil, time_windows = nil) ⇒ EntitiesScheduleResponse
Returns a new instance of EntitiesScheduleResponse.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 38 def initialize(id = nil, owner_id = nil, resource_id = nil, service_id = nil, time_windows = nil) @id = id @owner_id = owner_id @resource_id = resource_id @service_id = service_id @time_windows = time_windows end |
Instance Attribute Details
#id ⇒ Integer
id of Schedule
7 8 9 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 7 def id @id end |
#owner_id ⇒ Integer
id of owner of Schedule
11 12 13 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 11 def owner_id @owner_id end |
#resource_id ⇒ Integer
id of Resource
15 16 17 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 15 def resource_id @resource_id end |
#service_id ⇒ Integer
id of Service
19 20 21 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 19 def service_id @service_id end |
#time_windows ⇒ List of EntitiesTimeWindowResponse
array of TimeWindows making up Schedule
23 24 25 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 23 def time_windows @time_windows end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash id = hash['id'] owner_id = hash['owner_id'] resource_id = hash['resource_id'] service_id = hash['service_id'] # Parameter is an array, so we need to iterate through it time_windows = nil if hash['time_windows'] != nil time_windows = Array.new hash['time_windows'].each{|structure| time_windows << (EntitiesTimeWindowResponse.from_hash(structure) if structure)} end # Create object from extracted values EntitiesScheduleResponse.new(id, owner_id, resource_id, service_id, time_windows) end |
.names ⇒ Object
A mapping from model property names to API property names
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gonebusy/models/entities_schedule_response.rb', line 26 def self.names if @_hash.nil? @_hash = {} @_hash["id"] = "id" @_hash["owner_id"] = "owner_id" @_hash["resource_id"] = "resource_id" @_hash["service_id"] = "service_id" @_hash["time_windows"] = "time_windows" end @_hash end |