Class: CalendarApi::FreeBusyRequest
- Defined in:
- lib/calendar_api/models/free_busy_request.rb
Overview
Request body for querying free/busy information.
Instance Attribute Summary collapse
-
#calendar_expansion_max ⇒ Integer
Maximal number of calendars whose free/busy information is to be returned.
-
#group_expansion_max ⇒ Integer
Maximal number of calendar identifiers to be provided for a single group.
-
#items ⇒ Array[FreeBusyRequestItem]
List of calendars and/or groups to query.
-
#time_max ⇒ DateTime
The end of the interval for the query (RFC3339).
-
#time_min ⇒ DateTime
The start of the interval for the query (RFC3339).
-
#time_zone ⇒ String
Time zone used in the response.
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(time_min:, time_max:, items:, time_zone: SKIP, group_expansion_max: SKIP, calendar_expansion_max: SKIP, additional_properties: nil) ⇒ FreeBusyRequest
constructor
A new instance of FreeBusyRequest.
-
#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(time_min:, time_max:, items:, time_zone: SKIP, group_expansion_max: SKIP, calendar_expansion_max: SKIP, additional_properties: nil) ⇒ FreeBusyRequest
Returns a new instance of FreeBusyRequest.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 65 def initialize(time_min:, time_max:, items:, time_zone: SKIP, group_expansion_max: SKIP, calendar_expansion_max: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @time_min = time_min @time_max = time_max @time_zone = time_zone unless time_zone == SKIP @group_expansion_max = group_expansion_max unless group_expansion_max == SKIP @calendar_expansion_max = calendar_expansion_max unless calendar_expansion_max == SKIP @items = items @additional_properties = additional_properties end |
Instance Attribute Details
#calendar_expansion_max ⇒ Integer
Maximal number of calendars whose free/busy information is to be returned. Maximum value is 50.
33 34 35 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 33 def calendar_expansion_max @calendar_expansion_max end |
#group_expansion_max ⇒ Integer
Maximal number of calendar identifiers to be provided for a single group. Maximum value is 100.
28 29 30 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 28 def group_expansion_max @group_expansion_max end |
#items ⇒ Array[FreeBusyRequestItem]
List of calendars and/or groups to query.
37 38 39 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 37 def items @items end |
#time_max ⇒ DateTime
The end of the interval for the query (RFC3339).
19 20 21 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 19 def time_max @time_max end |
#time_min ⇒ DateTime
The start of the interval for the query (RFC3339).
15 16 17 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 15 def time_min @time_min end |
#time_zone ⇒ String
Time zone used in the response. Optional. Defaults to UTC.
23 24 25 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 23 def time_zone @time_zone end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. time_min = if hash.key?('timeMin') (DateTimeHelper.from_rfc3339(hash['timeMin']) if hash['timeMin']) end time_max = if hash.key?('timeMax') (DateTimeHelper.from_rfc3339(hash['timeMax']) if hash['timeMax']) end # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (FreeBusyRequestItem.from_hash(structure) if structure) end end items = nil unless hash.key?('items') time_zone = hash.key?('timeZone') ? hash['timeZone'] : SKIP group_expansion_max = hash.key?('groupExpansionMax') ? hash['groupExpansionMax'] : SKIP calendar_expansion_max = hash.key?('calendarExpansionMax') ? hash['calendarExpansionMax'] : SKIP # 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. FreeBusyRequest.new(time_min: time_min, time_max: time_max, items: items, time_zone: time_zone, group_expansion_max: group_expansion_max, calendar_expansion_max: calendar_expansion_max, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['time_min'] = 'timeMin' @_hash['time_max'] = 'timeMax' @_hash['time_zone'] = 'timeZone' @_hash['group_expansion_max'] = 'groupExpansionMax' @_hash['calendar_expansion_max'] = 'calendarExpansionMax' @_hash['items'] = 'items' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 52 def self.optionals %w[ time_zone group_expansion_max calendar_expansion_max ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
142 143 144 145 146 147 148 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 142 def inspect class_name = self.class.name.split('::').last "<#{class_name} time_min: #{@time_min.inspect}, time_max: #{@time_max.inspect}, time_zone:"\ " #{@time_zone.inspect}, group_expansion_max: #{@group_expansion_max.inspect},"\ " calendar_expansion_max: #{@calendar_expansion_max.inspect}, items: #{@items.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_time_max ⇒ Object
128 129 130 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 128 def to_custom_time_max DateTimeHelper.to_rfc3339(time_max) end |
#to_custom_time_min ⇒ Object
124 125 126 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 124 def to_custom_time_min DateTimeHelper.to_rfc3339(time_min) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
133 134 135 136 137 138 139 |
# File 'lib/calendar_api/models/free_busy_request.rb', line 133 def to_s class_name = self.class.name.split('::').last "<#{class_name} time_min: #{@time_min}, time_max: #{@time_max}, time_zone: #{@time_zone},"\ " group_expansion_max: #{@group_expansion_max}, calendar_expansion_max:"\ " #{@calendar_expansion_max}, items: #{@items}, additional_properties:"\ " #{@additional_properties}>" end |