Class: Plaid::TransferType

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/transfer_type.rb

Overview

Activity that modifies a position, but not through buy/sell activity e.g. options exercise, portfolio transfer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(assignment: SKIP, adjustment: SKIP, exercise: SKIP, expire: SKIP, merger: SKIP, spin_off: SKIP, split: SKIP, transfer: SKIP, additional_properties: nil) ⇒ TransferType

Returns a new instance of TransferType.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/plaid/models/transfer_type.rb', line 79

def initialize(assignment: SKIP, adjustment: SKIP, exercise: SKIP,
               expire: SKIP, merger: SKIP, spin_off: SKIP, split: SKIP,
               transfer: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @assignment = assignment unless assignment == SKIP
  @adjustment = adjustment unless adjustment == SKIP
  @exercise = exercise unless exercise == SKIP
  @expire = expire unless expire == SKIP
  @merger = merger unless merger == SKIP
  @spin_off = spin_off unless spin_off == SKIP
  @split = split unless split == SKIP
  @transfer = transfer unless transfer == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#adjustmentString

Increase or decrease in quantity of item

Returns:

  • (String)


19
20
21
# File 'lib/plaid/models/transfer_type.rb', line 19

def adjustment
  @adjustment
end

#assignmentString

Assignment of short option holding

Returns:

  • (String)


15
16
17
# File 'lib/plaid/models/transfer_type.rb', line 15

def assignment
  @assignment
end

#exerciseString

Exercise of an option or warrant contract

Returns:

  • (String)


23
24
25
# File 'lib/plaid/models/transfer_type.rb', line 23

def exercise
  @exercise
end

#expireString

Expiration of an option or warrant contract

Returns:

  • (String)


27
28
29
# File 'lib/plaid/models/transfer_type.rb', line 27

def expire
  @expire
end

#mergerString

Stock exchanged at a pre-defined ratio as part of a merger between companies

Returns:

  • (String)


32
33
34
# File 'lib/plaid/models/transfer_type.rb', line 32

def merger
  @merger
end

#spin_offString

Inflow of stock from spin-off transaction of an existing holding

Returns:

  • (String)


36
37
38
# File 'lib/plaid/models/transfer_type.rb', line 36

def spin_off
  @spin_off
end

#splitString

Inflow of stock from a forward split of an existing holding

Returns:

  • (String)


40
41
42
# File 'lib/plaid/models/transfer_type.rb', line 40

def split
  @split
end

#transferString

Movement of assets into or out of an account

Returns:

  • (String)


44
45
46
# File 'lib/plaid/models/transfer_type.rb', line 44

def transfer
  @transfer
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/plaid/models/transfer_type.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  assignment = hash.key?('assignment') ? hash['assignment'] : SKIP
  adjustment = hash.key?('adjustment') ? hash['adjustment'] : SKIP
  exercise = hash.key?('exercise') ? hash['exercise'] : SKIP
  expire = hash.key?('expire') ? hash['expire'] : SKIP
  merger = hash.key?('merger') ? hash['merger'] : SKIP
  spin_off = hash.key?('spin off') ? hash['spin off'] : SKIP
  split = hash.key?('split') ? hash['split'] : SKIP
  transfer = hash.key?('transfer') ? hash['transfer'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TransferType.new(assignment: assignment,
                   adjustment: adjustment,
                   exercise: exercise,
                   expire: expire,
                   merger: merger,
                   spin_off: spin_off,
                   split: split,
                   transfer: transfer,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/plaid/models/transfer_type.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['assignment'] = 'assignment'
  @_hash['adjustment'] = 'adjustment'
  @_hash['exercise'] = 'exercise'
  @_hash['expire'] = 'expire'
  @_hash['merger'] = 'merger'
  @_hash['spin_off'] = 'spin off'
  @_hash['split'] = 'split'
  @_hash['transfer'] = 'transfer'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/plaid/models/transfer_type.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/plaid/models/transfer_type.rb', line 61

def self.optionals
  %w[
    assignment
    adjustment
    exercise
    expire
    merger
    spin_off
    split
    transfer
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
# File 'lib/plaid/models/transfer_type.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} assignment: #{@assignment.inspect}, adjustment: #{@adjustment.inspect},"\
  " exercise: #{@exercise.inspect}, expire: #{@expire.inspect}, merger: #{@merger.inspect},"\
  " spin_off: #{@spin_off.inspect}, split: #{@split.inspect}, transfer: #{@transfer.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
# File 'lib/plaid/models/transfer_type.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} assignment: #{@assignment}, adjustment: #{@adjustment}, exercise:"\
  " #{@exercise}, expire: #{@expire}, merger: #{@merger}, spin_off: #{@spin_off}, split:"\
  " #{@split}, transfer: #{@transfer}, additional_properties: #{@additional_properties}>"
end