Class: CalendarApi::FreeBusyResponse
- Defined in:
- lib/calendar_api/models/free_busy_response.rb
Overview
Response with free/busy information.
Instance Attribute Summary collapse
-
#calendars ⇒ Hash[String, FreeBusyCalendar]
Free/busy information for each requested calendar.
-
#groups ⇒ Hash[String, FreeBusyGroup]
Expansion of groups.
-
#kind ⇒ String
Type of the resource.
-
#time_max ⇒ DateTime
The end of the time range queried.
-
#time_min ⇒ DateTime
The start of the time range queried.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(kind: 'calendar#freeBusy', time_min: SKIP, time_max: SKIP, calendars: SKIP, groups: SKIP, additional_properties: nil) ⇒ FreeBusyResponse
constructor
A new instance of FreeBusyResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_time_max ⇒ Object
- #to_custom_time_min ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(kind: 'calendar#freeBusy', time_min: SKIP, time_max: SKIP, calendars: SKIP, groups: SKIP, additional_properties: nil) ⇒ FreeBusyResponse
Returns a new instance of FreeBusyResponse.
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 60 def initialize(kind: 'calendar#freeBusy', time_min: SKIP, time_max: SKIP, calendars: SKIP, groups: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @kind = kind unless kind == SKIP @time_min = time_min unless time_min == SKIP @time_max = time_max unless time_max == SKIP @calendars = calendars unless calendars == SKIP @groups = groups unless groups == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#calendars ⇒ Hash[String, FreeBusyCalendar]
Free/busy information for each requested calendar.
27 28 29 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 27 def calendars @calendars end |
#groups ⇒ Hash[String, FreeBusyGroup]
Expansion of groups.
31 32 33 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 31 def groups @groups end |
#kind ⇒ String
Type of the resource.
15 16 17 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 15 def kind @kind end |
#time_max ⇒ DateTime
The end of the time range queried.
23 24 25 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 23 def time_max @time_max end |
#time_min ⇒ DateTime
The start of the time range queried.
19 20 21 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 19 def time_min @time_min end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. kind = hash['kind'] ||= 'calendar#freeBusy' time_min = if hash.key?('timeMin') (DateTimeHelper.from_rfc3339(hash['timeMin']) if hash['timeMin']) else SKIP end time_max = if hash.key?('timeMax') (DateTimeHelper.from_rfc3339(hash['timeMax']) if hash['timeMax']) else SKIP end calendars = FreeBusyCalendar.from_hash(hash['calendars']) if hash['calendars'] calendars = SKIP unless hash.key?('calendars') groups = FreeBusyGroup.from_hash(hash['groups']) if hash['groups'] groups = SKIP unless hash.key?('groups') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. FreeBusyResponse.new(kind: kind, time_min: time_min, time_max: time_max, calendars: calendars, groups: groups, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['kind'] = 'kind' @_hash['time_min'] = 'timeMin' @_hash['time_max'] = 'timeMax' @_hash['calendars'] = 'calendars' @_hash['groups'] = 'groups' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 45 def self.optionals %w[ kind time_min time_max calendars groups ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} kind: #{@kind.inspect}, time_min: #{@time_min.inspect}, time_max:"\ " #{@time_max.inspect}, calendars: #{@calendars.inspect}, groups: #{@groups.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_time_max ⇒ Object
116 117 118 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 116 def to_custom_time_max DateTimeHelper.to_rfc3339(time_max) end |
#to_custom_time_min ⇒ Object
112 113 114 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 112 def to_custom_time_min DateTimeHelper.to_rfc3339(time_min) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
121 122 123 124 125 |
# File 'lib/calendar_api/models/free_busy_response.rb', line 121 def to_s class_name = self.class.name.split('::').last "<#{class_name} kind: #{@kind}, time_min: #{@time_min}, time_max: #{@time_max}, calendars:"\ " #{@calendars}, groups: #{@groups}, additional_properties: #{@additional_properties}>" end |