class MailSlurpClient::WebhookResultDto

Attributes

created_at[RW]
http_method[RW]
id[RW]
inbox_id[RW]
message_id[RW]
redrive_id[RW]
response_body_extract[RW]
response_status[RW]
response_time_millis[RW]
result_type[RW]
updated_at[RW]
user_id[RW]
webhook_event[RW]
webhook_id[RW]
webhook_url[RW]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 70
def self.attribute_map
  {
    :'created_at' => :'createdAt',
    :'http_method' => :'httpMethod',
    :'id' => :'id',
    :'inbox_id' => :'inboxId',
    :'message_id' => :'messageId',
    :'redrive_id' => :'redriveId',
    :'response_body_extract' => :'responseBodyExtract',
    :'response_status' => :'responseStatus',
    :'response_time_millis' => :'responseTimeMillis',
    :'result_type' => :'resultType',
    :'updated_at' => :'updatedAt',
    :'user_id' => :'userId',
    :'webhook_event' => :'webhookEvent',
    :'webhook_id' => :'webhookId',
    :'webhook_url' => :'webhookUrl'
  }
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/mailslurp_client/models/webhook_result_dto.rb, line 329
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 119
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::WebhookResultDto` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::WebhookResultDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'http_method')
    self.http_method = attributes[:'http_method']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'inbox_id')
    self.inbox_id = attributes[:'inbox_id']
  end

  if attributes.key?(:'message_id')
    self.message_id = attributes[:'message_id']
  end

  if attributes.key?(:'redrive_id')
    self.redrive_id = attributes[:'redrive_id']
  end

  if attributes.key?(:'response_body_extract')
    self.response_body_extract = attributes[:'response_body_extract']
  end

  if attributes.key?(:'response_status')
    self.response_status = attributes[:'response_status']
  end

  if attributes.key?(:'response_time_millis')
    self.response_time_millis = attributes[:'response_time_millis']
  end

  if attributes.key?(:'result_type')
    self.result_type = attributes[:'result_type']
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end

  if attributes.key?(:'user_id')
    self.user_id = attributes[:'user_id']
  end

  if attributes.key?(:'webhook_event')
    self.webhook_event = attributes[:'webhook_event']
  end

  if attributes.key?(:'webhook_id')
    self.webhook_id = attributes[:'webhook_id']
  end

  if attributes.key?(:'webhook_url')
    self.webhook_url = attributes[:'webhook_url']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 112
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 91
def self.openapi_types
  {
    :'created_at' => :'DateTime',
    :'http_method' => :'String',
    :'id' => :'String',
    :'inbox_id' => :'String',
    :'message_id' => :'String',
    :'redrive_id' => :'String',
    :'response_body_extract' => :'String',
    :'response_status' => :'Integer',
    :'response_time_millis' => :'Integer',
    :'result_type' => :'String',
    :'updated_at' => :'DateTime',
    :'user_id' => :'String',
    :'webhook_event' => :'String',
    :'webhook_id' => :'String',
    :'webhook_url' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 294
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created_at == o.created_at &&
      http_method == o.http_method &&
      id == o.id &&
      inbox_id == o.inbox_id &&
      message_id == o.message_id &&
      redrive_id == o.redrive_id &&
      response_body_extract == o.response_body_extract &&
      response_status == o.response_status &&
      response_time_millis == o.response_time_millis &&
      result_type == o.result_type &&
      updated_at == o.updated_at &&
      user_id == o.user_id &&
      webhook_event == o.webhook_event &&
      webhook_id == o.webhook_id &&
      webhook_url == o.webhook_url
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/mailslurp_client/models/webhook_result_dto.rb, line 357
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
    MailSlurpClient.const_get(type).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/mailslurp_client/models/webhook_result_dto.rb, line 426
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
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/mailslurp_client/models/webhook_result_dto.rb, line 336
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that 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/mailslurp_client/models/webhook_result_dto.rb, line 316
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 322
def hash
  [created_at, http_method, id, inbox_id, message_id, redrive_id, response_body_extract, response_status, response_time_millis, result_type, updated_at, user_id, webhook_event, webhook_id, webhook_url].hash
end
http_method=(http_method) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] http_method Object to be assigned

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 264
def http_method=(http_method)
  validator = EnumAttributeValidator.new('String', ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE"])
  unless validator.valid?(http_method)
    fail ArgumentError, "invalid value for \"http_method\", must be one of #{validator.allowable_values}."
  end
  @http_method = http_method
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/mailslurp_client/models/webhook_result_dto.rb, line 195
def list_invalid_properties
  invalid_properties = Array.new
  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @http_method.nil?
    invalid_properties.push('invalid value for "http_method", http_method cannot be nil.')
  end

  if @inbox_id.nil?
    invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
  end

  if @message_id.nil?
    invalid_properties.push('invalid value for "message_id", message_id cannot be nil.')
  end

  if @response_time_millis.nil?
    invalid_properties.push('invalid value for "response_time_millis", response_time_millis cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  if @user_id.nil?
    invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
  end

  if @webhook_event.nil?
    invalid_properties.push('invalid value for "webhook_event", webhook_event cannot be nil.')
  end

  if @webhook_id.nil?
    invalid_properties.push('invalid value for "webhook_id", webhook_id cannot be nil.')
  end

  if @webhook_url.nil?
    invalid_properties.push('invalid value for "webhook_url", webhook_url cannot be nil.')
  end

  invalid_properties
end
result_type=(result_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] result_type Object to be assigned

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 274
def result_type=(result_type)
  validator = EnumAttributeValidator.new('String', ["BAD_RESPONSE", "EXCEPTION", "SUCCESS"])
  unless validator.valid?(result_type)
    fail ArgumentError, "invalid value for \"result_type\", must be one of #{validator.allowable_values}."
  end
  @result_type = result_type
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/mailslurp_client/models/webhook_result_dto.rb, line 402
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/mailslurp_client/models/webhook_result_dto.rb, line 408
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end
    
    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/mailslurp_client/models/webhook_result_dto.rb, line 396
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/mailslurp_client/models/webhook_result_dto.rb, line 242
def valid?
  return false if @created_at.nil?
  return false if @http_method.nil?
  http_method_validator = EnumAttributeValidator.new('String', ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE"])
  return false unless http_method_validator.valid?(@http_method)
  return false if @inbox_id.nil?
  return false if @message_id.nil?
  return false if @response_time_millis.nil?
  result_type_validator = EnumAttributeValidator.new('String', ["BAD_RESPONSE", "EXCEPTION", "SUCCESS"])
  return false unless result_type_validator.valid?(@result_type)
  return false if @updated_at.nil?
  return false if @user_id.nil?
  return false if @webhook_event.nil?
  webhook_event_validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ"])
  return false unless webhook_event_validator.valid?(@webhook_event)
  return false if @webhook_id.nil?
  return false if @webhook_url.nil?
  true
end
webhook_event=(webhook_event) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] webhook_event Object to be assigned

# File lib/mailslurp_client/models/webhook_result_dto.rb, line 284
def webhook_event=(webhook_event)
  validator = EnumAttributeValidator.new('String', ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ"])
  unless validator.valid?(webhook_event)
    fail ArgumentError, "invalid value for \"webhook_event\", must be one of #{validator.allowable_values}."
  end
  @webhook_event = webhook_event
end