Class: IntegrationApi::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/integration_api/models/transaction.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Transaction

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# 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. = attributes[:'account_amount']
  end

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

  if attributes.has_key?(:'account_type')
    self. = 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

Instance Attribute Details

#account_amountObject

Returns the value of attribute account_amount.



17
18
19
# File 'lib/integration_api/models/transaction.rb', line 17

def 
  @account_amount
end

#account_balanceObject

Returns the value of attribute account_balance.



19
20
21
# File 'lib/integration_api/models/transaction.rb', line 19

def 
  @account_balance
end

#account_typeObject

Returns the value of attribute account_type.



21
22
23
# File 'lib/integration_api/models/transaction.rb', line 21

def 
  @account_type
end

#commentObject

Returns the value of attribute comment.



23
24
25
# File 'lib/integration_api/models/transaction.rb', line 23

def comment
  @comment
end

#dividendObject

Returns the value of attribute dividend.



25
26
27
# File 'lib/integration_api/models/transaction.rb', line 25

def dividend
  @dividend
end

#dividend_taxObject

Returns the value of attribute dividend_tax.



27
28
29
# File 'lib/integration_api/models/transaction.rb', line 27

def dividend_tax
  @dividend_tax
end

#dnbObject

Returns the value of attribute dnb.



29
30
31
# File 'lib/integration_api/models/transaction.rb', line 29

def dnb
  @dnb
end

#fee_baseObject

Returns the value of attribute fee_base.



31
32
33
# File 'lib/integration_api/models/transaction.rb', line 31

def fee_base
  @fee_base
end

#fee_exchangeObject

Returns the value of attribute fee_exchange.



33
34
35
# File 'lib/integration_api/models/transaction.rb', line 33

def fee_exchange
  @fee_exchange
end

#fee_secObject

Returns the value of attribute fee_sec.



35
36
37
# File 'lib/integration_api/models/transaction.rb', line 35

def fee_sec
  @fee_sec
end

#fee_tafObject

Returns the value of attribute fee_taf.



37
38
39
# File 'lib/integration_api/models/transaction.rb', line 37

def fee_taf
  @fee_taf
end

#fee_xtra_sharesObject

Returns the value of attribute fee_xtra_shares.



39
40
41
# File 'lib/integration_api/models/transaction.rb', line 39

def fee_xtra_shares
  @fee_xtra_shares
end

#fill_pxObject

Returns the value of attribute fill_px.



41
42
43
# File 'lib/integration_api/models/transaction.rb', line 41

def fill_px
  @fill_px
end

#fill_qtyObject

Returns the value of attribute fill_qty.



43
44
45
# File 'lib/integration_api/models/transaction.rb', line 43

def fill_qty
  @fill_qty
end

#fin_tran_idObject

Returns the value of attribute fin_tran_id.



45
46
47
# File 'lib/integration_api/models/transaction.rb', line 45

def fin_tran_id
  @fin_tran_id
end

#fin_tran_type_idObject

Returns the value of attribute fin_tran_type_id.



47
48
49
# File 'lib/integration_api/models/transaction.rb', line 47

def fin_tran_type_id
  @fin_tran_type_id
end

#instrumentObject

Returns the value of attribute instrument.



49
50
51
# File 'lib/integration_api/models/transaction.rb', line 49

def instrument
  @instrument
end

#merger_acquisitionObject

Returns the value of attribute merger_acquisition.



51
52
53
# File 'lib/integration_api/models/transaction.rb', line 51

def merger_acquisition
  @merger_acquisition
end

#order_idObject

Returns the value of attribute order_id.



53
54
55
# File 'lib/integration_api/models/transaction.rb', line 53

def order_id
  @order_id
end

#position_deltaObject

Returns the value of attribute position_delta.



55
56
57
# File 'lib/integration_api/models/transaction.rb', line 55

def position_delta
  @position_delta
end

#system_amountObject

Returns the value of attribute system_amount.



57
58
59
# File 'lib/integration_api/models/transaction.rb', line 57

def system_amount
  @system_amount
end

#tran_whenObject

Returns the value of attribute tran_when.



59
60
61
# File 'lib/integration_api/models/transaction.rb', line 59

def tran_when
  @tran_when
end

Class Method Details

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# 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

.swagger_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/integration_api/models/transaction.rb', line 229

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
       == o. &&
      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) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# 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) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/integration_api/models/transaction.rb', line 356

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) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# 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) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


258
259
260
# File 'lib/integration_api/models/transaction.rb', line 258

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



264
265
266
# File 'lib/integration_api/models/transaction.rb', line 264

def hash
  [, , , 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_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



216
217
218
219
# File 'lib/integration_api/models/transaction.rb', line 216

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



337
338
339
# File 'lib/integration_api/models/transaction.rb', line 337

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



343
344
345
346
347
348
349
350
# File 'lib/integration_api/models/transaction.rb', line 343

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



331
332
333
# File 'lib/integration_api/models/transaction.rb', line 331

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



223
224
225
# File 'lib/integration_api/models/transaction.rb', line 223

def valid?
  true
end