class SwaggerClient::ModelClass

Represents a single class instance. The class meets at the start time, goes until the end time.

Attributes

active[RW]

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.

booking_status[RW]

Contains the booking’s payment status.

booking_window[RW]

Contains information about the window for booking.

class_description[RW]

Contains information that defines the class.

class_schedule_id[RW]

The ID used to retrieve the class schedule for the desired class.

clients[RW]

Contains information about clients.

end_date_time[RW]

The time this class is scheduled to end.

hide_cancel[RW]

When `true`, indicates that this class is hidden when cancelled.<br /> When `false`, indicates that this class is not hidden when cancelled.

id[RW]

The unique identifier for the class.

is_available[RW]

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.

is_canceled[RW]

When `true`, indicates that the class has been cancelled.<br /> When `false`, indicates that the class has not been cancelled.

is_enrolled[RW]

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.

is_waitlist_available[RW]

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.

last_modified_date_time[RW]

The last time this class was modified.

location[RW]

Contains information about a location.

max_capacity[RW]

The maximum number of clients allowed in the class.

resource[RW]

Contains information about a resource, such as a room, assigned to a class.

semester_id[RW]

The ID of the semester that the class is a part of, if any.

staff[RW]

Contains information about the staff member.

start_date_time[RW]

The time this class is scheduled to start.

substitute[RW]

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.

total_booked[RW]

The total number of clients booked in the class.

total_booked_waitlist[RW]

The total number of booked clients on the waiting list for the class.

visits[RW]

Contains information about visits.

web_booked[RW]

The total number of clients who signed up online for the class.

web_capacity[RW]

The maximum number of clients allowed to sign up online for the class.

Public Class Methods

attribute_map() click to toggle source

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
new(attributes = {}) click to toggle source

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
swagger_types() click to toggle source

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

==(o) click to toggle source

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
_deserialize(type, value) click to toggle source

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
_to_hash(value) click to toggle source

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
booking_status=(booking_status) click to toggle source

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
build_from_hash(attributes) click to toggle source

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
eql?(o) click to toggle source

@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
hash() click to toggle source

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
list_invalid_properties() click to toggle source

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
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/swagger_client/models/model_class.rb, line 439
def to_body
  to_hash
end
to_hash() click to toggle source

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
to_s() click to toggle source

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
valid?() click to toggle source

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