snaptrade 2.0.21 → 2.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +11 -1
- data/lib/snaptrade/models/snap_trade_holdings_account_account_id_balance.rb +224 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/models/snap_trade_holdings_account_account_id_balance_spec.rb +29 -0
- data/spec/models/snap_trade_holdings_account_account_id_spec.rb +6 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca9f4fb79ccef521a81f2574d9cec36c7f620677bff1f425a8e659e029e223f5
|
4
|
+
data.tar.gz: 784ea7b28f4ba1616de6300cc5af74aeb68e437b4c5012a048bacfd1b51abbe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d547cb4e6bcd229bd76bc4d652479c379c79d1c1145d21f376706b42c3385382e488fa06ce1660f9403554daaa943551ddaeaf9b10c2dbcdd84357d12c8e9945
|
7
|
+
data.tar.gz: c5033f916bef6cf4d96ef23289cc32ce39d4ab562f124c9b42f63d122986769b25b716041b6c2961ca409a91c3501e35ea899acacd6f1e159729d88b03b64dbd
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[![npm](https://img.shields.io/badge/gem-v2.0.
|
9
|
+
[![npm](https://img.shields.io/badge/gem-v2.0.22-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.22)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -69,7 +69,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
69
69
|
Add to Gemfile:
|
70
70
|
|
71
71
|
```ruby
|
72
|
-
gem 'snaptrade', '~> 2.0.
|
72
|
+
gem 'snaptrade', '~> 2.0.22'
|
73
73
|
```
|
74
74
|
|
75
75
|
## Getting Started<a id="getting-started"></a>
|
@@ -25,6 +25,8 @@ module SnapTrade
|
|
25
25
|
|
26
26
|
attr_accessor :institution_name
|
27
27
|
|
28
|
+
attr_accessor :balance
|
29
|
+
|
28
30
|
attr_accessor :meta
|
29
31
|
|
30
32
|
attr_accessor :cash_restrictions
|
@@ -41,6 +43,7 @@ module SnapTrade
|
|
41
43
|
:'name' => :'name',
|
42
44
|
:'number' => :'number',
|
43
45
|
:'institution_name' => :'institution_name',
|
46
|
+
:'balance' => :'balance',
|
44
47
|
:'meta' => :'meta',
|
45
48
|
:'cash_restrictions' => :'cash_restrictions',
|
46
49
|
:'created_date' => :'created_date'
|
@@ -61,6 +64,7 @@ module SnapTrade
|
|
61
64
|
:'name' => :'String',
|
62
65
|
:'number' => :'String',
|
63
66
|
:'institution_name' => :'String',
|
67
|
+
:'balance' => :'SnapTradeHoldingsAccountAccountIdBalance',
|
64
68
|
:'meta' => :'Hash<String, Object>',
|
65
69
|
:'cash_restrictions' => :'Array<CashRestriction>',
|
66
70
|
:'created_date' => :'String'
|
@@ -71,6 +75,7 @@ module SnapTrade
|
|
71
75
|
def self.openapi_nullable
|
72
76
|
Set.new([
|
73
77
|
:'name',
|
78
|
+
:'balance',
|
74
79
|
])
|
75
80
|
end
|
76
81
|
|
@@ -113,6 +118,10 @@ module SnapTrade
|
|
113
118
|
self.institution_name = attributes[:'institution_name']
|
114
119
|
end
|
115
120
|
|
121
|
+
if attributes.key?(:'balance')
|
122
|
+
self.balance = attributes[:'balance']
|
123
|
+
end
|
124
|
+
|
116
125
|
if attributes.key?(:'meta')
|
117
126
|
if (value = attributes[:'meta']).is_a?(Hash)
|
118
127
|
self.meta = value
|
@@ -154,6 +163,7 @@ module SnapTrade
|
|
154
163
|
name == o.name &&
|
155
164
|
number == o.number &&
|
156
165
|
institution_name == o.institution_name &&
|
166
|
+
balance == o.balance &&
|
157
167
|
meta == o.meta &&
|
158
168
|
cash_restrictions == o.cash_restrictions &&
|
159
169
|
created_date == o.created_date
|
@@ -168,7 +178,7 @@ module SnapTrade
|
|
168
178
|
# Calculates hash code according to all attributes.
|
169
179
|
# @return [Integer] Hash code
|
170
180
|
def hash
|
171
|
-
[id, brokerage_authorization, portfolio_group, name, number, institution_name, meta, cash_restrictions, created_date].hash
|
181
|
+
[id, brokerage_authorization, portfolio_group, name, number, institution_name, balance, meta, cash_restrictions, created_date].hash
|
172
182
|
end
|
173
183
|
|
174
184
|
# Builds the object from hash
|
@@ -0,0 +1,224 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
class SnapTradeHoldingsAccountAccountIdBalance
|
15
|
+
attr_accessor :total
|
16
|
+
|
17
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
18
|
+
def self.attribute_map
|
19
|
+
{
|
20
|
+
:'total' => :'total'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns all the JSON keys this model knows about
|
25
|
+
def self.acceptable_attributes
|
26
|
+
attribute_map.values
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'total' => :'AccountBalanceTotal'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# List of attributes with nullable: true
|
37
|
+
def self.openapi_nullable
|
38
|
+
Set.new([
|
39
|
+
:'total'
|
40
|
+
])
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of class defined in allOf (OpenAPI v3)
|
44
|
+
def self.openapi_all_of
|
45
|
+
[
|
46
|
+
:'AccountBalance'
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::SnapTradeHoldingsAccountAccountIdBalance` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::SnapTradeHoldingsAccountAccountIdBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'total')
|
66
|
+
self.total = attributes[:'total']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
invalid_properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
total == o.total
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[total].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
attributes = attributes.transform_keys(&:to_sym)
|
116
|
+
self.class.openapi_types.each_pair do |key, type|
|
117
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
118
|
+
self.send("#{key}=", nil)
|
119
|
+
elsif type =~ /\AArray<(.*)>/i
|
120
|
+
# check to ensure the input is an array given that the attribute
|
121
|
+
# is documented as an array but the input is not
|
122
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
123
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
124
|
+
end
|
125
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
126
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
# Deserializes the data based on type
|
134
|
+
# @param string type Data type
|
135
|
+
# @param string value Value to be deserialized
|
136
|
+
# @return [Object] Deserialized data
|
137
|
+
def _deserialize(type, value)
|
138
|
+
case type.to_sym
|
139
|
+
when :Time
|
140
|
+
Time.parse(value)
|
141
|
+
when :Date
|
142
|
+
Date.parse(value)
|
143
|
+
when :String
|
144
|
+
value.to_s
|
145
|
+
when :Integer
|
146
|
+
value.to_i
|
147
|
+
when :Float
|
148
|
+
value.to_f
|
149
|
+
when :Boolean
|
150
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
151
|
+
true
|
152
|
+
else
|
153
|
+
false
|
154
|
+
end
|
155
|
+
when :Object
|
156
|
+
# generic object (usually a Hash), return directly
|
157
|
+
value
|
158
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
159
|
+
inner_type = Regexp.last_match[:inner_type]
|
160
|
+
value.map { |v| _deserialize(inner_type, v) }
|
161
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
162
|
+
k_type = Regexp.last_match[:k_type]
|
163
|
+
v_type = Regexp.last_match[:v_type]
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each do |k, v|
|
166
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
else # model
|
170
|
+
# models (e.g. Pet) or oneOf
|
171
|
+
klass = SnapTrade.const_get(type)
|
172
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the string representation of the object
|
177
|
+
# @return [String] String presentation of the object
|
178
|
+
def to_s
|
179
|
+
to_hash.to_s
|
180
|
+
end
|
181
|
+
|
182
|
+
# to_body is an alias to to_hash (backward compatibility)
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_body
|
185
|
+
to_hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the object in the form of hash
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_hash
|
191
|
+
hash = {}
|
192
|
+
self.class.attribute_map.each_pair do |attr, param|
|
193
|
+
value = self.send(attr)
|
194
|
+
if value.nil?
|
195
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
196
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
197
|
+
end
|
198
|
+
|
199
|
+
hash[param] = _to_hash(value)
|
200
|
+
end
|
201
|
+
hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map { |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -111,6 +111,7 @@ require 'snaptrade/models/session_event_type'
|
|
111
111
|
require 'snaptrade/models/snap_trade_api_disclaimer_accept_status'
|
112
112
|
require 'snaptrade/models/snap_trade_holdings_account'
|
113
113
|
require 'snaptrade/models/snap_trade_holdings_account_account_id'
|
114
|
+
require 'snaptrade/models/snap_trade_holdings_account_account_id_balance'
|
114
115
|
require 'snaptrade/models/snap_trade_holdings_total_value'
|
115
116
|
require 'snaptrade/models/snap_trade_login_user_request_body'
|
116
117
|
require 'snaptrade/models/snap_trade_register_user_request_body'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SnapTrade::SnapTradeHoldingsAccountAccountIdBalance
|
15
|
+
describe SnapTrade::SnapTradeHoldingsAccountAccountIdBalance do
|
16
|
+
let(:instance) { SnapTrade::SnapTradeHoldingsAccountAccountIdBalance.new }
|
17
|
+
|
18
|
+
describe 'test an instance of SnapTradeHoldingsAccountAccountIdBalance' do
|
19
|
+
it 'should create an instance of SnapTradeHoldingsAccountAccountIdBalance' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::SnapTradeHoldingsAccountAccountIdBalance)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "total"' do
|
24
|
+
it 'should work' do
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -56,6 +56,12 @@ describe SnapTrade::SnapTradeHoldingsAccountAccountId do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
describe 'test attribute "balance"' do
|
60
|
+
it 'should work' do
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
59
65
|
describe 'test attribute "meta"' do
|
60
66
|
it 'should work' do
|
61
67
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb
|
191
191
|
- lib/snaptrade/models/snap_trade_holdings_account.rb
|
192
192
|
- lib/snaptrade/models/snap_trade_holdings_account_account_id.rb
|
193
|
+
- lib/snaptrade/models/snap_trade_holdings_account_account_id_balance.rb
|
193
194
|
- lib/snaptrade/models/snap_trade_holdings_total_value.rb
|
194
195
|
- lib/snaptrade/models/snap_trade_login_user_request_body.rb
|
195
196
|
- lib/snaptrade/models/snap_trade_register_user_request_body.rb
|
@@ -334,6 +335,7 @@ files:
|
|
334
335
|
- spec/models/session_event_spec.rb
|
335
336
|
- spec/models/session_event_type_spec.rb
|
336
337
|
- spec/models/snap_trade_api_disclaimer_accept_status_spec.rb
|
338
|
+
- spec/models/snap_trade_holdings_account_account_id_balance_spec.rb
|
337
339
|
- spec/models/snap_trade_holdings_account_account_id_spec.rb
|
338
340
|
- spec/models/snap_trade_holdings_account_spec.rb
|
339
341
|
- spec/models/snap_trade_holdings_total_value_spec.rb
|
@@ -543,6 +545,7 @@ test_files:
|
|
543
545
|
- spec/models/brokerage_authorization_type_read_only_spec.rb
|
544
546
|
- spec/models/symbols_quotes_inner_spec.rb
|
545
547
|
- spec/models/dividend_at_date_spec.rb
|
548
|
+
- spec/models/snap_trade_holdings_account_account_id_balance_spec.rb
|
546
549
|
- spec/models/past_value_spec.rb
|
547
550
|
- spec/models/model_portfolio_spec.rb
|
548
551
|
- spec/spec_helper.rb
|