Class: SnapTrade::DepositAccount
- Inherits:
-
Object
- Object
- SnapTrade::DepositAccount
- Defined in:
- lib/snaptrade/models/deposit_account.rb
Overview
A deposit account (checking, savings) under a connection.
Instance Attribute Summary collapse
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#connection_id ⇒ Object
Unique identifier for the connection (brokerage_authorization_id).
-
#display_name ⇒ Object
A display name for the account.
-
#id ⇒ Object
Unique identifier for the connected brokerage account.
-
#institution_account_id ⇒ Object
A stable and unique account identifier provided by the institution.
-
#institution_id ⇒ Object
Unique identifier for the institution (brokerage) that holds the account.
-
#kind ⇒ Object
Discriminator for the account kind.
-
#number ⇒ Object
The account number assigned by the brokerage.
-
#opening_date ⇒ Object
Timestamp in ISO 8601 format indicating when the account was opened at the brokerage.
-
#raw_type ⇒ Object
The account type as provided by the brokerage.
-
#sync_status ⇒ Object
Returns the value of attribute sync_status.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ DepositAccount
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ DepositAccount
Initializes the object
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 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/snaptrade/models/deposit_account.rb', line 99 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::DepositAccount` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::DepositAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'kind') self.kind = attributes[:'kind'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'connection_id') self.connection_id = attributes[:'connection_id'] end if attributes.key?(:'display_name') self.display_name = attributes[:'display_name'] end if attributes.key?(:'number') self.number = attributes[:'number'] end if attributes.key?(:'institution_account_id') self.institution_account_id = attributes[:'institution_account_id'] end if attributes.key?(:'institution_id') self.institution_id = attributes[:'institution_id'] end if attributes.key?(:'opening_date') self.opening_date = attributes[:'opening_date'] end if attributes.key?(:'sync_status') self.sync_status = attributes[:'sync_status'] end if attributes.key?(:'raw_type') self.raw_type = attributes[:'raw_type'] end if attributes.key?(:'balance') self.balance = attributes[:'balance'] end end |
Instance Attribute Details
#balance ⇒ Object
Returns the value of attribute balance.
45 46 47 |
# File 'lib/snaptrade/models/deposit_account.rb', line 45 def balance @balance end |
#connection_id ⇒ Object
Unique identifier for the connection (brokerage_authorization_id). This is the UUID used to reference the connection in SnapTrade.
23 24 25 |
# File 'lib/snaptrade/models/deposit_account.rb', line 23 def connection_id @connection_id end |
#display_name ⇒ Object
A display name for the account. Either assigned by the user or by the brokerage itself.
26 27 28 |
# File 'lib/snaptrade/models/deposit_account.rb', line 26 def display_name @display_name end |
#id ⇒ Object
Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
20 21 22 |
# File 'lib/snaptrade/models/deposit_account.rb', line 20 def id @id end |
#institution_account_id ⇒ Object
A stable and unique account identifier provided by the institution. Will be set to null if not provided. When present, can be used to check if a user has connected the same brokerage account across multiple connections.
32 33 34 |
# File 'lib/snaptrade/models/deposit_account.rb', line 32 def institution_account_id @institution_account_id end |
#institution_id ⇒ Object
Unique identifier for the institution (brokerage) that holds the account.
35 36 37 |
# File 'lib/snaptrade/models/deposit_account.rb', line 35 def institution_id @institution_id end |
#kind ⇒ Object
Discriminator for the account kind.
17 18 19 |
# File 'lib/snaptrade/models/deposit_account.rb', line 17 def kind @kind end |
#number ⇒ Object
The account number assigned by the brokerage. For some brokerages, this field may be masked for security reasons.
29 30 31 |
# File 'lib/snaptrade/models/deposit_account.rb', line 29 def number @number end |
#opening_date ⇒ Object
Timestamp in ISO 8601 format indicating when the account was opened at the brokerage. Only populated for brokerages that expose this data; null for all other brokerages.
38 39 40 |
# File 'lib/snaptrade/models/deposit_account.rb', line 38 def opening_date @opening_date end |
#raw_type ⇒ Object
The account type as provided by the brokerage.
43 44 45 |
# File 'lib/snaptrade/models/deposit_account.rb', line 43 def raw_type @raw_type end |
#sync_status ⇒ Object
Returns the value of attribute sync_status.
40 41 42 |
# File 'lib/snaptrade/models/deposit_account.rb', line 40 def sync_status @sync_status end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
65 66 67 |
# File 'lib/snaptrade/models/deposit_account.rb', line 65 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/snaptrade/models/deposit_account.rb', line 48 def self.attribute_map { :'kind' => :'kind', :'id' => :'id', :'connection_id' => :'connection_id', :'display_name' => :'display_name', :'number' => :'number', :'institution_account_id' => :'institution_account_id', :'institution_id' => :'institution_id', :'opening_date' => :'opening_date', :'sync_status' => :'sync_status', :'raw_type' => :'raw_type', :'balance' => :'balance' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
228 229 230 |
# File 'lib/snaptrade/models/deposit_account.rb', line 228 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
87 88 89 90 91 92 93 94 95 |
# File 'lib/snaptrade/models/deposit_account.rb', line 87 def self.openapi_nullable Set.new([ :'display_name', :'institution_account_id', :'opening_date', :'raw_type', :'balance' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/snaptrade/models/deposit_account.rb', line 70 def self.openapi_types { :'kind' => :'DepositAccountKind', :'id' => :'String', :'connection_id' => :'String', :'display_name' => :'String', :'number' => :'String', :'institution_account_id' => :'String', :'institution_id' => :'String', :'opening_date' => :'Time', :'sync_status' => :'ConnectionAccountSyncStatus', :'raw_type' => :'String', :'balance' => :'DepositAccountBalance' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/snaptrade/models/deposit_account.rb', line 197 def ==(o) return true if self.equal?(o) self.class == o.class && kind == o.kind && id == o.id && connection_id == o.connection_id && display_name == o.display_name && number == o.number && institution_account_id == o.institution_account_id && institution_id == o.institution_id && opening_date == o.opening_date && sync_status == o.sync_status && raw_type == o.raw_type && balance == o.balance end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/snaptrade/models/deposit_account.rb', line 259 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(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 # models (e.g. Pet) or oneOf klass = SnapTrade.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/snaptrade/models/deposit_account.rb', line 330 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
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/snaptrade/models/deposit_account.rb', line 235 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif 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 end self end |
#eql?(o) ⇒ Boolean
215 216 217 |
# File 'lib/snaptrade/models/deposit_account.rb', line 215 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
221 222 223 |
# File 'lib/snaptrade/models/deposit_account.rb', line 221 def hash [kind, id, connection_id, display_name, number, institution_account_id, institution_id, opening_date, sync_status, raw_type, balance].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/snaptrade/models/deposit_account.rb', line 159 def list_invalid_properties invalid_properties = Array.new if @kind.nil? invalid_properties.push('invalid value for "kind", kind cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @connection_id.nil? invalid_properties.push('invalid value for "connection_id", connection_id cannot be nil.') end if @number.nil? invalid_properties.push('invalid value for "number", number cannot be nil.') end if @sync_status.nil? invalid_properties.push('invalid value for "sync_status", sync_status cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
306 307 308 |
# File 'lib/snaptrade/models/deposit_account.rb', line 306 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/snaptrade/models/deposit_account.rb', line 312 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
300 301 302 |
# File 'lib/snaptrade/models/deposit_account.rb', line 300 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
186 187 188 189 190 191 192 193 |
# File 'lib/snaptrade/models/deposit_account.rb', line 186 def valid? return false if @kind.nil? return false if @id.nil? return false if @connection_id.nil? return false if @number.nil? return false if @sync_status.nil? true end |