class IntegrationApi::Transaction

Attributes

account_amount[RW]
account_balance[RW]
account_type[RW]
comment[RW]
dividend[RW]
dividend_tax[RW]
dnb[RW]
fee_base[RW]
fee_exchange[RW]
fee_sec[RW]
fee_taf[RW]
fee_xtra_shares[RW]
fill_px[RW]
fill_qty[RW]
fin_tran_id[RW]
fin_tran_type_id[RW]
instrument[RW]
merger_acquisition[RW]
order_id[RW]
position_delta[RW]
system_amount[RW]
tran_when[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/integration_api/models/transaction.rb, line 62
def self.attribute_map
  {
    :'account_amount' => :'account_amount',
    :'account_balance' => :'account_balance',
    :'account_type' => :'account_type',
    :'comment' => :'comment',
    :'dividend' => :'dividend',
    :'dividend_tax' => :'dividend_tax',
    :'dnb' => :'dnb',
    :'fee_base' => :'fee_base',
    :'fee_exchange' => :'fee_exchange',
    :'fee_sec' => :'fee_sec',
    :'fee_taf' => :'fee_taf',
    :'fee_xtra_shares' => :'fee_xtra_shares',
    :'fill_px' => :'fill_px',
    :'fill_qty' => :'fill_qty',
    :'fin_tran_id' => :'fin_tran_id',
    :'fin_tran_type_id' => :'fin_tran_type_id',
    :'instrument' => :'instrument',
    :'merger_acquisition' => :'merger_acquisition',
    :'order_id' => :'order_id',
    :'position_delta' => :'position_delta',
    :'system_amount' => :'system_amount',
    :'tran_when' => :'tran_when'
  }
end
new(attributes = {}) click to toggle source

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

# File lib/integration_api/models/transaction.rb, line 119
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?(:'account_amount')
    self.account_amount = attributes[:'account_amount']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'tran_when')
    self.tran_when = attributes[:'tran_when']
  end
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/integration_api/models/transaction.rb, line 90
def self.swagger_types
  {
    :'account_amount' => :'Float',
    :'account_balance' => :'Float',
    :'account_type' => :'String',
    :'comment' => :'String',
    :'dividend' => :'Dividend',
    :'dividend_tax' => :'DividendTax',
    :'dnb' => :'BOOLEAN',
    :'fee_base' => :'Float',
    :'fee_exchange' => :'Float',
    :'fee_sec' => :'Float',
    :'fee_taf' => :'Float',
    :'fee_xtra_shares' => :'Float',
    :'fill_px' => :'Float',
    :'fill_qty' => :'Float',
    :'fin_tran_id' => :'String',
    :'fin_tran_type_id' => :'String',
    :'instrument' => :'Instrument',
    :'merger_acquisition' => :'MergerAcquisition',
    :'order_id' => :'String',
    :'position_delta' => :'Float',
    :'system_amount' => :'Float',
    :'tran_when' => :'DateTime'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/integration_api/models/transaction.rb, line 229
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      account_amount == o.account_amount &&
      account_balance == o.account_balance &&
      account_type == o.account_type &&
      comment == o.comment &&
      dividend == o.dividend &&
      dividend_tax == o.dividend_tax &&
      dnb == o.dnb &&
      fee_base == o.fee_base &&
      fee_exchange == o.fee_exchange &&
      fee_sec == o.fee_sec &&
      fee_taf == o.fee_taf &&
      fee_xtra_shares == o.fee_xtra_shares &&
      fill_px == o.fill_px &&
      fill_qty == o.fill_qty &&
      fin_tran_id == o.fin_tran_id &&
      fin_tran_type_id == o.fin_tran_type_id &&
      instrument == o.instrument &&
      merger_acquisition == o.merger_acquisition &&
      order_id == o.order_id &&
      position_delta == o.position_delta &&
      system_amount == o.system_amount &&
      tran_when == o.tran_when
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/integration_api/models/transaction.rb, line 291
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    value
  when :Date
    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 = IntegrationApi.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/integration_api/models/transaction.rb, line 355
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/integration_api/models/transaction.rb, line 271
def build_from_hash(attributes)
  self.class.swagger_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/integration_api/models/transaction.rb, line 258
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/integration_api/models/transaction.rb, line 264
def hash
  [account_amount, account_balance, account_type, comment, dividend, dividend_tax, dnb, fee_base, fee_exchange, fee_sec, fee_taf, fee_xtra_shares, fill_px, fill_qty, fin_tran_id, fin_tran_type_id, instrument, merger_acquisition, order_id, position_delta, system_amount, tran_when].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/integration_api/models/transaction.rb, line 216
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/integration_api/models/transaction.rb, line 336
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/integration_api/models/transaction.rb, line 342
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    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/integration_api/models/transaction.rb, line 330
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/integration_api/models/transaction.rb, line 223
def valid?
  true
end