Class: ThePlaidApi::BuyType
- Defined in:
- lib/the_plaid_api/models/buy_type.rb
Overview
Buying an investment
Instance Attribute Summary collapse
-
#assignment ⇒ String
Assignment of short option holding.
-
#buy ⇒ String
Purchase to open or increase a position.
-
#buy_to_cover ⇒ String
Purchase to close a short position.
-
#contribution ⇒ String
Inflow of assets into a tax-advantaged account.
-
#dividend_reinvestment ⇒ String
Purchase using proceeds from a cash dividend.
-
#interest_reinvestment ⇒ String
Purchase using proceeds from a cash interest payment.
-
#long_term_capital_gain_reinvestment ⇒ String
Purchase using long-term capital gain cash proceeds.
-
#short_term_capital_gain_reinvestment ⇒ String
Purchase using short-term capital gain cash proceeds.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(assignment: SKIP, contribution: SKIP, buy: SKIP, buy_to_cover: SKIP, dividend_reinvestment: SKIP, interest_reinvestment: SKIP, long_term_capital_gain_reinvestment: SKIP, short_term_capital_gain_reinvestment: SKIP, additional_properties: nil) ⇒ BuyType
constructor
A new instance of BuyType.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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, contribution: SKIP, buy: SKIP, buy_to_cover: SKIP, dividend_reinvestment: SKIP, interest_reinvestment: SKIP, long_term_capital_gain_reinvestment: SKIP, short_term_capital_gain_reinvestment: SKIP, additional_properties: nil) ⇒ BuyType
Returns a new instance of BuyType.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 79 def initialize(assignment: SKIP, contribution: SKIP, buy: SKIP, buy_to_cover: SKIP, dividend_reinvestment: SKIP, interest_reinvestment: SKIP, long_term_capital_gain_reinvestment: SKIP, short_term_capital_gain_reinvestment: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @assignment = assignment unless assignment == SKIP @contribution = contribution unless contribution == SKIP @buy = buy unless buy == SKIP @buy_to_cover = buy_to_cover unless buy_to_cover == SKIP @dividend_reinvestment = dividend_reinvestment unless dividend_reinvestment == SKIP @interest_reinvestment = interest_reinvestment unless interest_reinvestment == SKIP unless long_term_capital_gain_reinvestment == SKIP @long_term_capital_gain_reinvestment = long_term_capital_gain_reinvestment end unless short_term_capital_gain_reinvestment == SKIP @short_term_capital_gain_reinvestment = short_term_capital_gain_reinvestment end @additional_properties = additional_properties end |
Instance Attribute Details
#assignment ⇒ String
Assignment of short option holding
14 15 16 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 14 def assignment @assignment end |
#buy ⇒ String
Purchase to open or increase a position
22 23 24 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 22 def buy @buy end |
#buy_to_cover ⇒ String
Purchase to close a short position
26 27 28 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 26 def buy_to_cover @buy_to_cover end |
#contribution ⇒ String
Inflow of assets into a tax-advantaged account
18 19 20 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 18 def contribution @contribution end |
#dividend_reinvestment ⇒ String
Purchase using proceeds from a cash dividend
30 31 32 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 30 def dividend_reinvestment @dividend_reinvestment end |
#interest_reinvestment ⇒ String
Purchase using proceeds from a cash interest payment
34 35 36 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 34 def interest_reinvestment @interest_reinvestment end |
#long_term_capital_gain_reinvestment ⇒ String
Purchase using long-term capital gain cash proceeds
38 39 40 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 38 def long_term_capital_gain_reinvestment @long_term_capital_gain_reinvestment end |
#short_term_capital_gain_reinvestment ⇒ String
Purchase using short-term capital gain cash proceeds
42 43 44 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 42 def short_term_capital_gain_reinvestment @short_term_capital_gain_reinvestment end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. assignment = hash.key?('assignment') ? hash['assignment'] : SKIP contribution = hash.key?('contribution') ? hash['contribution'] : SKIP buy = hash.key?('buy') ? hash['buy'] : SKIP buy_to_cover = hash.key?('buy to cover') ? hash['buy to cover'] : SKIP dividend_reinvestment = hash.key?('dividend reinvestment') ? hash['dividend reinvestment'] : SKIP interest_reinvestment = hash.key?('interest reinvestment') ? hash['interest reinvestment'] : SKIP long_term_capital_gain_reinvestment = hash.key?('long-term capital gain reinvestment') ? hash['long-term capital gain reinvestment'] : SKIP short_term_capital_gain_reinvestment = hash.key?('short-term capital gain reinvestment') ? hash['short-term capital gain reinvestment'] : 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. BuyType.new(assignment: assignment, contribution: contribution, buy: buy, buy_to_cover: buy_to_cover, dividend_reinvestment: dividend_reinvestment, interest_reinvestment: interest_reinvestment, long_term_capital_gain_reinvestment: long_term_capital_gain_reinvestment, short_term_capital_gain_reinvestment: short_term_capital_gain_reinvestment, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['assignment'] = 'assignment' @_hash['contribution'] = 'contribution' @_hash['buy'] = 'buy' @_hash['buy_to_cover'] = 'buy to cover' @_hash['dividend_reinvestment'] = 'dividend reinvestment' @_hash['interest_reinvestment'] = 'interest reinvestment' @_hash['long_term_capital_gain_reinvestment'] = 'long-term capital gain reinvestment' @_hash['short_term_capital_gain_reinvestment'] = 'short-term capital gain reinvestment' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 61 def self.optionals %w[ assignment contribution buy buy_to_cover dividend_reinvestment interest_reinvestment long_term_capital_gain_reinvestment short_term_capital_gain_reinvestment ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
154 155 156 157 158 159 160 161 162 163 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 154 def inspect class_name = self.class.name.split('::').last "<#{class_name} assignment: #{@assignment.inspect}, contribution: #{@contribution.inspect},"\ " buy: #{@buy.inspect}, buy_to_cover: #{@buy_to_cover.inspect}, dividend_reinvestment:"\ " #{@dividend_reinvestment.inspect}, interest_reinvestment:"\ " #{@interest_reinvestment.inspect}, long_term_capital_gain_reinvestment:"\ " #{@long_term_capital_gain_reinvestment.inspect}, short_term_capital_gain_reinvestment:"\ " #{@short_term_capital_gain_reinvestment.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
143 144 145 146 147 148 149 150 151 |
# File 'lib/the_plaid_api/models/buy_type.rb', line 143 def to_s class_name = self.class.name.split('::').last "<#{class_name} assignment: #{@assignment}, contribution: #{@contribution}, buy: #{@buy},"\ " buy_to_cover: #{@buy_to_cover}, dividend_reinvestment: #{@dividend_reinvestment},"\ " interest_reinvestment: #{@interest_reinvestment}, long_term_capital_gain_reinvestment:"\ " #{@long_term_capital_gain_reinvestment}, short_term_capital_gain_reinvestment:"\ " #{@short_term_capital_gain_reinvestment}, additional_properties:"\ " #{@additional_properties}>" end |