class SwaggerClient::ModelClass
Represents a single class instance. The class meets at the start time, goes until the end time.
Attributes
When `true`, indicates that the class is shown to clients when in consumer mode.<br /> When `false`, indicates that the class is not shown to clients when in consumer mode.
Contains the booking’s payment status.
Contains information about the window for booking.
Contains information that defines the class.
The ID used to retrieve the class schedule for the desired class.
Contains information about clients.
The time this class is scheduled to end.
When `true`, indicates that this class is hidden when cancelled.<br /> When `false`, indicates that this class is not hidden when cancelled.
The unique identifier for the class.
When `true`, indicates that the client with the given client ID can book this class.<br /> When `false`, indicates that the client with the given client ID cannot book this class.
When `true`, indicates that the class has been cancelled.<br /> When `false`, indicates that the class has not been cancelled.
When `true`, indicates that the client with the given `ClientId` is enrolled in this class.<br /> When `false`, indicates that the client with the given `ClientId` is not enrolled in this class.
When `true`, indicates that the clients can be placed on a waiting list for the class.<br /> When `false`, indicates that the clients cannot be placed on a waiting list for the class.
The last time this class was modified.
Contains information about a location.
The maximum number of clients allowed in the class.
Contains information about a resource, such as a room, assigned to a class.
The ID of the semester that the class is a part of, if any.
Contains information about the staff member.
The time this class is scheduled to start.
When `true`, indicates that the class is being taught by a substitute teacher.<br /> When `false`, indicates that the class is being taught by its regular teacher.
The total number of clients booked in the class.
The total number of booked clients on the waiting list for the class.
Contains information about visits.
The total number of clients who signed up online for the class.
The maximum number of clients allowed to sign up online for the class.
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/swagger_client/models/model_class.rb, line 119 def self.attribute_map { :'class_schedule_id' => :'ClassScheduleId', :'visits' => :'Visits', :'clients' => :'Clients', :'location' => :'Location', :'resource' => :'Resource', :'max_capacity' => :'MaxCapacity', :'web_capacity' => :'WebCapacity', :'total_booked' => :'TotalBooked', :'total_booked_waitlist' => :'TotalBookedWaitlist', :'web_booked' => :'WebBooked', :'semester_id' => :'SemesterId', :'is_canceled' => :'IsCanceled', :'substitute' => :'Substitute', :'active' => :'Active', :'is_waitlist_available' => :'IsWaitlistAvailable', :'is_enrolled' => :'IsEnrolled', :'hide_cancel' => :'HideCancel', :'id' => :'Id', :'is_available' => :'IsAvailable', :'start_date_time' => :'StartDateTime', :'end_date_time' => :'EndDateTime', :'last_modified_date_time' => :'LastModifiedDateTime', :'class_description' => :'ClassDescription', :'staff' => :'Staff', :'booking_window' => :'BookingWindow', :'booking_status' => :'BookingStatus' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/swagger_client/models/model_class.rb, line 184 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'ClassScheduleId') self.class_schedule_id = attributes[:'ClassScheduleId'] end if attributes.has_key?(:'Visits') if (value = attributes[:'Visits']).is_a?(Array) self.visits = value end end if attributes.has_key?(:'Clients') if (value = attributes[:'Clients']).is_a?(Array) self.clients = value end end if attributes.has_key?(:'Location') self.location = attributes[:'Location'] end if attributes.has_key?(:'Resource') self.resource = attributes[:'Resource'] end if attributes.has_key?(:'MaxCapacity') self.max_capacity = attributes[:'MaxCapacity'] end if attributes.has_key?(:'WebCapacity') self.web_capacity = attributes[:'WebCapacity'] end if attributes.has_key?(:'TotalBooked') self.total_booked = attributes[:'TotalBooked'] end if attributes.has_key?(:'TotalBookedWaitlist') self.total_booked_waitlist = attributes[:'TotalBookedWaitlist'] end if attributes.has_key?(:'WebBooked') self.web_booked = attributes[:'WebBooked'] end if attributes.has_key?(:'SemesterId') self.semester_id = attributes[:'SemesterId'] end if attributes.has_key?(:'IsCanceled') self.is_canceled = attributes[:'IsCanceled'] end if attributes.has_key?(:'Substitute') self.substitute = attributes[:'Substitute'] end if attributes.has_key?(:'Active') self.active = attributes[:'Active'] end if attributes.has_key?(:'IsWaitlistAvailable') self.is_waitlist_available = attributes[:'IsWaitlistAvailable'] end if attributes.has_key?(:'IsEnrolled') self.is_enrolled = attributes[:'IsEnrolled'] end if attributes.has_key?(:'HideCancel') self.hide_cancel = attributes[:'HideCancel'] end if attributes.has_key?(:'Id') self.id = attributes[:'Id'] end if attributes.has_key?(:'IsAvailable') self.is_available = attributes[:'IsAvailable'] end if attributes.has_key?(:'StartDateTime') self.start_date_time = attributes[:'StartDateTime'] end if attributes.has_key?(:'EndDateTime') self.end_date_time = attributes[:'EndDateTime'] end if attributes.has_key?(:'LastModifiedDateTime') self.last_modified_date_time = attributes[:'LastModifiedDateTime'] end if attributes.has_key?(:'ClassDescription') self.class_description = attributes[:'ClassDescription'] end if attributes.has_key?(:'Staff') self.staff = attributes[:'Staff'] end if attributes.has_key?(:'BookingWindow') self.booking_window = attributes[:'BookingWindow'] end if attributes.has_key?(:'BookingStatus') self.booking_status = attributes[:'BookingStatus'] end end
Attribute type mapping.
# File lib/swagger_client/models/model_class.rb, line 151 def self.swagger_types { :'class_schedule_id' => :'Integer', :'visits' => :'Array<Visit>', :'clients' => :'Array<Client>', :'location' => :'Location', :'resource' => :'Resource', :'max_capacity' => :'Integer', :'web_capacity' => :'Integer', :'total_booked' => :'Integer', :'total_booked_waitlist' => :'Integer', :'web_booked' => :'Integer', :'semester_id' => :'Integer', :'is_canceled' => :'BOOLEAN', :'substitute' => :'BOOLEAN', :'active' => :'BOOLEAN', :'is_waitlist_available' => :'BOOLEAN', :'is_enrolled' => :'BOOLEAN', :'hide_cancel' => :'BOOLEAN', :'id' => :'Integer', :'is_available' => :'BOOLEAN', :'start_date_time' => :'DateTime', :'end_date_time' => :'DateTime', :'last_modified_date_time' => :'DateTime', :'class_description' => :'ClassDescription', :'staff' => :'Staff', :'booking_window' => :'BookingWindow', :'booking_status' => :'String' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/swagger_client/models/model_class.rb, line 326 def ==(o) return true if self.equal?(o) self.class == o.class && class_schedule_id == o.class_schedule_id && visits == o.visits && clients == o.clients && location == o.location && resource == o.resource && max_capacity == o.max_capacity && web_capacity == o.web_capacity && total_booked == o.total_booked && total_booked_waitlist == o.total_booked_waitlist && web_booked == o.web_booked && semester_id == o.semester_id && is_canceled == o.is_canceled && substitute == o.substitute && active == o.active && is_waitlist_available == o.is_waitlist_available && is_enrolled == o.is_enrolled && hide_cancel == o.hide_cancel && id == o.id && is_available == o.is_available && start_date_time == o.start_date_time && end_date_time == o.end_date_time && last_modified_date_time == o.last_modified_date_time && class_description == o.class_description && staff == o.staff && booking_window == o.booking_window && booking_status == o.booking_status end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/swagger_client/models/model_class.rb, line 393 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = SwaggerClient.const_get(type).new temp_model.build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/swagger_client/models/model_class.rb, line 459 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
Custom attribute writer method checking allowed values (enum). @param [Object] booking_status
Object to be assigned
# File lib/swagger_client/models/model_class.rb, line 316 def booking_status=(booking_status) validator = EnumAttributeValidator.new('String', ['PaymentRequired', 'BookAndPayLater', 'Free']) unless validator.valid?(booking_status) fail ArgumentError, 'invalid value for "booking_status", must be one of #{validator.allowable_values}.' end @booking_status = booking_status end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/swagger_client/models/model_class.rb, line 372 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] Object to be compared
# File lib/swagger_client/models/model_class.rb, line 359 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/swagger_client/models/model_class.rb, line 365 def hash [class_schedule_id, visits, clients, location, resource, max_capacity, web_capacity, total_booked, total_booked_waitlist, web_booked, semester_id, is_canceled, substitute, active, is_waitlist_available, is_enrolled, hide_cancel, id, is_available, start_date_time, end_date_time, last_modified_date_time, class_description, staff, booking_window, booking_status].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/swagger_client/models/model_class.rb, line 301 def list_invalid_properties invalid_properties = Array.new invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/swagger_client/models/model_class.rb, line 445 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/swagger_client/models/model_class.rb, line 433 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/swagger_client/models/model_class.rb, line 308 def valid? booking_status_validator = EnumAttributeValidator.new('String', ['PaymentRequired', 'BookAndPayLater', 'Free']) return false unless booking_status_validator.valid?(@booking_status) true end