class ConnectWise::Activity

Attributes

_info[RW]

Metadata of the entity

agreement[RW]
assign_to[RW]
assigned_by[RW]
campaign[RW]
company[RW]
contact[RW]
currency[RW]
custom_fields[RW]
date_end[RW]
date_start[RW]
email[RW]
id[RW]
mobile_guid[RW]
name[RW]
notes[RW]
notify_flag[RW]
opportunity[RW]
phone_number[RW]
reminder[RW]
schedule_status[RW]
status[RW]
ticket[RW]
type[RW]
where[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/connectwise-ruby-sdk/models/activity.rb, line 60
def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'type' => :'type',
    :'company' => :'company',
    :'contact' => :'contact',
    :'phone_number' => :'phoneNumber',
    :'email' => :'email',
    :'status' => :'status',
    :'opportunity' => :'opportunity',
    :'ticket' => :'ticket',
    :'agreement' => :'agreement',
    :'campaign' => :'campaign',
    :'notes' => :'notes',
    :'date_start' => :'dateStart',
    :'date_end' => :'dateEnd',
    :'assigned_by' => :'assignedBy',
    :'assign_to' => :'assignTo',
    :'schedule_status' => :'scheduleStatus',
    :'reminder' => :'reminder',
    :'where' => :'where',
    :'notify_flag' => :'notifyFlag',
    :'mobile_guid' => :'mobileGuid',
    :'currency' => :'currency',
    :'_info' => :'_info',
    :'custom_fields' => :'customFields'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/connectwise-ruby-sdk/models/activity.rb, line 123
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?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'company')
    self.company = attributes[:'company']
  end

  if attributes.has_key?(:'contact')
    self.contact = attributes[:'contact']
  end

  if attributes.has_key?(:'phoneNumber')
    self.phone_number = attributes[:'phoneNumber']
  end

  if attributes.has_key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'opportunity')
    self.opportunity = attributes[:'opportunity']
  end

  if attributes.has_key?(:'ticket')
    self.ticket = attributes[:'ticket']
  end

  if attributes.has_key?(:'agreement')
    self.agreement = attributes[:'agreement']
  end

  if attributes.has_key?(:'campaign')
    self.campaign = attributes[:'campaign']
  end

  if attributes.has_key?(:'notes')
    self.notes = attributes[:'notes']
  end

  if attributes.has_key?(:'dateStart')
    self.date_start = attributes[:'dateStart']
  end

  if attributes.has_key?(:'dateEnd')
    self.date_end = attributes[:'dateEnd']
  end

  if attributes.has_key?(:'assignedBy')
    self.assigned_by = attributes[:'assignedBy']
  end

  if attributes.has_key?(:'assignTo')
    self.assign_to = attributes[:'assignTo']
  end

  if attributes.has_key?(:'scheduleStatus')
    self.schedule_status = attributes[:'scheduleStatus']
  end

  if attributes.has_key?(:'reminder')
    self.reminder = attributes[:'reminder']
  end

  if attributes.has_key?(:'where')
    self.where = attributes[:'where']
  end

  if attributes.has_key?(:'notifyFlag')
    self.notify_flag = attributes[:'notifyFlag']
  end

  if attributes.has_key?(:'mobileGuid')
    self.mobile_guid = attributes[:'mobileGuid']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'_info')
    self._info = attributes[:'_info']
  end

  if attributes.has_key?(:'customFields')
    if (value = attributes[:'customFields']).is_a?(Array)
      self.custom_fields = value
    end
  end

end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/connectwise-ruby-sdk/models/activity.rb, line 91
def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'type' => :'ActivityTypeReference',
    :'company' => :'CompanyReference',
    :'contact' => :'ContactReference',
    :'phone_number' => :'String',
    :'email' => :'String',
    :'status' => :'ActivityStatusReference',
    :'opportunity' => :'OpportunityReference',
    :'ticket' => :'TicketReference',
    :'agreement' => :'AgreementReference',
    :'campaign' => :'CampaignReference',
    :'notes' => :'String',
    :'date_start' => :'DateTime',
    :'date_end' => :'DateTime',
    :'assigned_by' => :'MemberReference',
    :'assign_to' => :'MemberReference',
    :'schedule_status' => :'ScheduleStatusReference',
    :'reminder' => :'ReminderReference',
    :'where' => :'ServiceLocationReference',
    :'notify_flag' => :'BOOLEAN',
    :'mobile_guid' => :'Guid',
    :'currency' => :'CurrencyReference',
    :'_info' => :'Metadata',
    :'custom_fields' => :'Array<CustomFieldValue>'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/connectwise-ruby-sdk/models/activity.rb, line 309
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      type == o.type &&
      company == o.company &&
      contact == o.contact &&
      phone_number == o.phone_number &&
      email == o.email &&
      status == o.status &&
      opportunity == o.opportunity &&
      ticket == o.ticket &&
      agreement == o.agreement &&
      campaign == o.campaign &&
      notes == o.notes &&
      date_start == o.date_start &&
      date_end == o.date_end &&
      assigned_by == o.assigned_by &&
      assign_to == o.assign_to &&
      schedule_status == o.schedule_status &&
      reminder == o.reminder &&
      where == o.where &&
      notify_flag == o.notify_flag &&
      mobile_guid == o.mobile_guid &&
      currency == o.currency &&
      _info == o._info &&
      custom_fields == o.custom_fields
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/connectwise-ruby-sdk/models/activity.rb, line 375
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 = ConnectWise.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/connectwise-ruby-sdk/models/activity.rb, line 441
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/connectwise-ruby-sdk/models/activity.rb, line 354
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
email=(email) click to toggle source

Custom attribute writer method with validation @param [Object] email Value to be assigned

# File lib/connectwise-ruby-sdk/models/activity.rb, line 298
def email=(email)

  if !email.nil? && email.to_s.length > 250
    fail ArgumentError, "invalid value for 'email', the character length must be smaller than or equal to 250."
  end

  @email = email
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/connectwise-ruby-sdk/models/activity.rb, line 341
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/connectwise-ruby-sdk/models/activity.rb, line 347
def hash
  [id, name, type, company, contact, phone_number, email, status, opportunity, ticket, agreement, campaign, notes, date_start, date_end, assigned_by, assign_to, schedule_status, reminder, where, notify_flag, mobile_guid, currency, _info, custom_fields].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons

# File lib/connectwise-ruby-sdk/models/activity.rb, line 235
def list_invalid_properties
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push("invalid value for 'name', name cannot be nil.")
  end

  if @name.to_s.length > 100
    invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 100.")
  end

  if !@phone_number.nil? && @phone_number.to_s.length > 30
    invalid_properties.push("invalid value for 'phone_number', the character length must be smaller than or equal to 30.")
  end

  if !@email.nil? && @email.to_s.length > 250
    invalid_properties.push("invalid value for 'email', the character length must be smaller than or equal to 250.")
  end

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

  return invalid_properties
end
name=(name) click to toggle source

Custom attribute writer method with validation @param [Object] name Value to be assigned

# File lib/connectwise-ruby-sdk/models/activity.rb, line 273
def name=(name)
  if name.nil?
    fail ArgumentError, "name cannot be nil"
  end

  if name.to_s.length > 100
    fail ArgumentError, "invalid value for 'name', the character length must be smaller than or equal to 100."
  end

  @name = name
end
phone_number=(phone_number) click to toggle source

Custom attribute writer method with validation @param [Object] phone_number Value to be assigned

# File lib/connectwise-ruby-sdk/models/activity.rb, line 287
def phone_number=(phone_number)

  if !phone_number.nil? && phone_number.to_s.length > 30
    fail ArgumentError, "invalid value for 'phone_number', the character length must be smaller than or equal to 30."
  end

  @phone_number = phone_number
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/connectwise-ruby-sdk/models/activity.rb, line 421
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/connectwise-ruby-sdk/models/activity.rb, line 427
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/connectwise-ruby-sdk/models/activity.rb, line 415
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/connectwise-ruby-sdk/models/activity.rb, line 262
def valid?
  return false if @name.nil?
  return false if @name.to_s.length > 100
  return false if !@phone_number.nil? && @phone_number.to_s.length > 30
  return false if !@email.nil? && @email.to_s.length > 250
  return false if @assign_to.nil?
  return true
end