Class: ThePlaidApi::TransferType

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/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, request: SKIP, send: SKIP, spin_off: SKIP, split: SKIP, trade: SKIP, transfer: SKIP, additional_properties: nil) ⇒ TransferType

Returns a new instance of TransferType.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/the_plaid_api/models/transfer_type.rb', line 97

def initialize(assignment: SKIP, adjustment: SKIP, exercise: SKIP,
               expire: SKIP, merger: SKIP, request: SKIP, send: SKIP,
               spin_off: SKIP, split: SKIP, trade: 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
  @request = request unless request == SKIP
  @send = send unless send == SKIP
  @spin_off = spin_off unless spin_off == SKIP
  @split = split unless split == SKIP
  @trade = trade unless trade == 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/the_plaid_api/models/transfer_type.rb', line 19

def adjustment
  @adjustment
end

#assignmentString

Assignment of short option holding

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/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/the_plaid_api/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/the_plaid_api/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/the_plaid_api/models/transfer_type.rb', line 32

def merger
  @merger
end

#requestString

Request fiat or cryptocurrency to an address or email

Returns:

  • (String)


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

def request
  @request
end

#sendString

Inflow or outflow of fiat or cryptocurrency to an address or email

Returns:

  • (String)


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

def send
  @send
end

#spin_offString

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

Returns:

  • (String)


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

def spin_off
  @spin_off
end

#splitString

Inflow of stock from a forward split of an existing holding

Returns:

  • (String)


48
49
50
# File 'lib/the_plaid_api/models/transfer_type.rb', line 48

def split
  @split
end

#tradeString

Trade of one cryptocurrency for another

Returns:

  • (String)


52
53
54
# File 'lib/the_plaid_api/models/transfer_type.rb', line 52

def trade
  @trade
end

#transferString

Movement of assets into or out of an account

Returns:

  • (String)


56
57
58
# File 'lib/the_plaid_api/models/transfer_type.rb', line 56

def transfer
  @transfer
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a 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
# File 'lib/the_plaid_api/models/transfer_type.rb', line 119

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
  request = hash.key?('request') ? hash['request'] : SKIP
  send = hash.key?('send') ? hash['send'] : SKIP
  spin_off = hash.key?('spin off') ? hash['spin off'] : SKIP
  split = hash.key?('split') ? hash['split'] : SKIP
  trade = hash.key?('trade') ? hash['trade'] : 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,
                   request: request,
                   send: send,
                   spin_off: spin_off,
                   split: split,
                   trade: trade,
                   transfer: transfer,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



93
94
95
# File 'lib/the_plaid_api/models/transfer_type.rb', line 93

def self.nullables
  []
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/transfer_type.rb', line 76

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



167
168
169
170
171
172
173
174
# File 'lib/the_plaid_api/models/transfer_type.rb', line 167

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},"\
  " request: #{@request.inspect}, send: #{@send.inspect}, spin_off: #{@spin_off.inspect},"\
  " split: #{@split.inspect}, trade: #{@trade.inspect}, transfer: #{@transfer.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



158
159
160
161
162
163
164
# File 'lib/the_plaid_api/models/transfer_type.rb', line 158

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