class SematextCloud::Invitation
Attributes
For invite request, only app.id needs to be set.
For invite request, only apps.id needs to be set.
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/SematextCloud/models/invitation.rb, line 62 def self.attribute_map { :'app' => :'app', :'apps' => :'apps', :'id' => :'id', :'invite_date' => :'inviteDate', :'invite_status' => :'inviteStatus', :'invitee_email' => :'inviteeEmail', :'invitee_role' => :'inviteeRole', :'invitee_status' => :'inviteeStatus', :'inviter_email' => :'inviterEmail', :'uuid' => :'uuid' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/SematextCloud/models/invitation.rb, line 95 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?(:'app') self.app = attributes[:'app'] end if attributes.has_key?(:'apps') if (value = attributes[:'apps']).is_a?(Array) self.apps = value end end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'inviteDate') self.invite_date = attributes[:'inviteDate'] end if attributes.has_key?(:'inviteStatus') self.invite_status = attributes[:'inviteStatus'] end if attributes.has_key?(:'inviteeEmail') self.invitee_email = attributes[:'inviteeEmail'] end if attributes.has_key?(:'inviteeRole') self.invitee_role = attributes[:'inviteeRole'] end if attributes.has_key?(:'inviteeStatus') self.invitee_status = attributes[:'inviteeStatus'] end if attributes.has_key?(:'inviterEmail') self.inviter_email = attributes[:'inviterEmail'] end if attributes.has_key?(:'uuid') self.uuid = attributes[:'uuid'] end end
Attribute type mapping.
# File lib/SematextCloud/models/invitation.rb, line 78 def self.swagger_types { :'app' => :'App', :'apps' => :'Array<App>', :'id' => :'Integer', :'invite_date' => :'DateTime', :'invite_status' => :'String', :'invitee_email' => :'String', :'invitee_role' => :'String', :'invitee_status' => :'String', :'inviter_email' => :'String', :'uuid' => :'String' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/SematextCloud/models/invitation.rb, line 195 def ==(o) return true if self.equal?(o) self.class == o.class && app == o.app && apps == o.apps && id == o.id && invite_date == o.invite_date && invite_status == o.invite_status && invitee_email == o.invitee_email && invitee_role == o.invitee_role && invitee_status == o.invitee_status && inviter_email == o.inviter_email && uuid == o.uuid 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/SematextCloud/models/invitation.rb, line 246 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 = SematextCloud.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/SematextCloud/models/invitation.rb, line 312 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
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/SematextCloud/models/invitation.rb, line 225 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/SematextCloud/models/invitation.rb, line 212 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/SematextCloud/models/invitation.rb, line 218 def hash [app, apps, id, invite_date, invite_status, invitee_email, invitee_role, invitee_status, inviter_email, uuid].hash end
Custom attribute writer method checking allowed values (enum). @param [Object] invite_status
Object to be assigned
# File lib/SematextCloud/models/invitation.rb, line 165 def invite_status=(invite_status) validator = EnumAttributeValidator.new('String', ['PENDING', 'ACCEPTED', 'CANCELLED', 'DECLINED']) unless validator.valid?(invite_status) fail ArgumentError, 'invalid value for "invite_status", must be one of #{validator.allowable_values}.' end @invite_status = invite_status end
Custom attribute writer method checking allowed values (enum). @param [Object] invitee_role
Object to be assigned
# File lib/SematextCloud/models/invitation.rb, line 175 def invitee_role=(invitee_role) validator = EnumAttributeValidator.new('String', ['SUPER_USER', 'OWNER', 'ADMIN', 'USER', 'DEMO', 'ANONYMOUS']) unless validator.valid?(invitee_role) fail ArgumentError, 'invalid value for "invitee_role", must be one of #{validator.allowable_values}.' end @invitee_role = invitee_role end
Custom attribute writer method checking allowed values (enum). @param [Object] invitee_status
Object to be assigned
# File lib/SematextCloud/models/invitation.rb, line 185 def invitee_status=(invitee_status) validator = EnumAttributeValidator.new('String', ['INACTIVE', 'ACTIVE']) unless validator.valid?(invitee_status) fail ArgumentError, 'invalid value for "invitee_status", must be one of #{validator.allowable_values}.' end @invitee_status = invitee_status end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/SematextCloud/models/invitation.rb, line 146 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/SematextCloud/models/invitation.rb, line 298 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/SematextCloud/models/invitation.rb, line 286 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/SematextCloud/models/invitation.rb, line 153 def valid? invite_status_validator = EnumAttributeValidator.new('String', ['PENDING', 'ACCEPTED', 'CANCELLED', 'DECLINED']) return false unless invite_status_validator.valid?(@invite_status) invitee_role_validator = EnumAttributeValidator.new('String', ['SUPER_USER', 'OWNER', 'ADMIN', 'USER', 'DEMO', 'ANONYMOUS']) return false unless invitee_role_validator.valid?(@invitee_role) invitee_status_validator = EnumAttributeValidator.new('String', ['INACTIVE', 'ACTIVE']) return false unless invitee_status_validator.valid?(@invitee_status) true end