class SwaggerClient::ClientMembership
Attributes
The action taken.
The date that this pricing option became active and could be used to pay for services.
The number of service sessions this pricing option contained when first purchased.
When `true`, there are service sessions remaining on the pricing option that can be used pay for the current session.<br /> When `false`, the client cannot use this pricing option to pay for other services.
The date when the pricing option expires and can no longer be used to pay for services, even if unused service sessions remain on the option; expressed as UTC.
Text code that represents the `MembershipIcon`.
The unique ID assigned to this pricing option.
The name of this pricing option.
The date on which the client paid for this pricing option.
Contains information about the service category this service falls under.
The number of service sessions remaining in the pricing option that can still be used.
The locations that the membership is restricted to, if any.
The ID of the subscriber site associated with this pricing option.
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/swagger_client/models/client_membership.rb, line 79 def self.attribute_map { :'restricted_locations' => :'RestrictedLocations', :'icon_code' => :'IconCode', :'active_date' => :'ActiveDate', :'count' => :'Count', :'current' => :'Current', :'expiration_date' => :'ExpirationDate', :'id' => :'Id', :'name' => :'Name', :'payment_date' => :'PaymentDate', :'program' => :'Program', :'remaining' => :'Remaining', :'site_id' => :'SiteId', :'action' => :'Action' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/swagger_client/models/client_membership.rb, line 118 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?(:'RestrictedLocations') if (value = attributes[:'RestrictedLocations']).is_a?(Array) self.restricted_locations = value end end if attributes.has_key?(:'IconCode') self.icon_code = attributes[:'IconCode'] end if attributes.has_key?(:'ActiveDate') self.active_date = attributes[:'ActiveDate'] end if attributes.has_key?(:'Count') self.count = attributes[:'Count'] end if attributes.has_key?(:'Current') self.current = attributes[:'Current'] end if attributes.has_key?(:'ExpirationDate') self.expiration_date = attributes[:'ExpirationDate'] end if attributes.has_key?(:'Id') self.id = attributes[:'Id'] end if attributes.has_key?(:'Name') self.name = attributes[:'Name'] end if attributes.has_key?(:'PaymentDate') self.payment_date = attributes[:'PaymentDate'] end if attributes.has_key?(:'Program') self.program = attributes[:'Program'] end if attributes.has_key?(:'Remaining') self.remaining = attributes[:'Remaining'] end if attributes.has_key?(:'SiteId') self.site_id = attributes[:'SiteId'] end if attributes.has_key?(:'Action') self.action = attributes[:'Action'] end end
Attribute type mapping.
# File lib/swagger_client/models/client_membership.rb, line 98 def self.swagger_types { :'restricted_locations' => :'Array<Location>', :'icon_code' => :'String', :'active_date' => :'DateTime', :'count' => :'Integer', :'current' => :'BOOLEAN', :'expiration_date' => :'DateTime', :'id' => :'Integer', :'name' => :'String', :'payment_date' => :'DateTime', :'program' => :'Program', :'remaining' => :'Integer', :'site_id' => :'Integer', :'action' => :'String' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/swagger_client/models/client_membership.rb, line 206 def ==(o) return true if self.equal?(o) self.class == o.class && restricted_locations == o.restricted_locations && icon_code == o.icon_code && active_date == o.active_date && count == o.count && current == o.current && expiration_date == o.expiration_date && id == o.id && name == o.name && payment_date == o.payment_date && program == o.program && remaining == o.remaining && site_id == o.site_id && action == o.action 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/client_membership.rb, line 260 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/client_membership.rb, line 326 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] action Object to be assigned
# File lib/swagger_client/models/client_membership.rb, line 196 def action=(action) validator = EnumAttributeValidator.new('String', ['None', 'Added', 'Updated', 'Failed', 'Removed']) unless validator.valid?(action) fail ArgumentError, 'invalid value for "action", must be one of #{validator.allowable_values}.' end @action = action 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/client_membership.rb, line 239 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/client_membership.rb, line 226 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/swagger_client/models/client_membership.rb, line 232 def hash [restricted_locations, icon_code, active_date, count, current, expiration_date, id, name, payment_date, program, remaining, site_id, action].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/client_membership.rb, line 181 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/client_membership.rb, line 312 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/client_membership.rb, line 300 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/client_membership.rb, line 188 def valid? action_validator = EnumAttributeValidator.new('String', ['None', 'Added', 'Updated', 'Failed', 'Removed']) return false unless action_validator.valid?(@action) true end