snaptrade 1.17.5 → 1.17.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1819cd355ee52f0df86d45d381e9eb2c4fac4db67e1f387077217b6292a7ce4
4
- data.tar.gz: 6098b1f89a59f9665eefbbc26cb13f697eb84b918ccdd82d49a11a5efd9270fa
3
+ metadata.gz: 2ccb4f353fc653e152f5eb6afeefe3656924848582cb959f02377cee0787e5a9
4
+ data.tar.gz: ccc5319257834058e7106231218b202c300167874e05dcc7ebd4e31bd7071685
5
5
  SHA512:
6
- metadata.gz: 66cca49a69c1157dfa9f6f0578cb1a6900e2f1e0b28e7918756c10fdfc4ec231d0ce637c31acf1d4e35e4cf40ed57444c95f4534cbee8a06250a9b0f731605ee
7
- data.tar.gz: 77b5bf192f667d6613ecc530a3e06a9422d85a88f14ce728165bd352fc1f456caf3068aa0b5aec772f9d3fe1095b145e881eab0b0564ac7ffd2482b8b9a4488f
6
+ metadata.gz: 68ae35db6b8a6691621ea5cfe413660792d1d81094fc8d40bd5a2dca5e1417ed66c759e5de54f7dad19337926929a88e038070b0be2dbc5e707e157fd6a06747
7
+ data.tar.gz: 0d598c9e1a80b10f4d88e8c1e806794c0075835a88d8f01b8fbcaf12b32e018676ee2b4a30f1223050969f68d6a2279393e68a0ffa95c1af5417b0adae4ce588
data/README.md CHANGED
@@ -9,7 +9,7 @@ For more information, please visit [https://snaptrade.com/](https://snaptrade.co
9
9
  Add to Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'snaptrade', '~> 1.17.5'
12
+ gem 'snaptrade', '~> 1.17.6'
13
13
  ```
14
14
 
15
15
  ## Getting Started
@@ -91,6 +91,8 @@ Class | Method | HTTP request | Description
91
91
  ## Documentation for Models
92
92
 
93
93
  - [SnapTrade::Account](docs/Account.md)
94
+ - [SnapTrade::AccountBalance](docs/AccountBalance.md)
95
+ - [SnapTrade::AccountBalanceTotal](docs/AccountBalanceTotal.md)
94
96
  - [SnapTrade::AccountHoldings](docs/AccountHoldings.md)
95
97
  - [SnapTrade::AccountHoldingsAccount](docs/AccountHoldingsAccount.md)
96
98
  - [SnapTrade::AccountOrderRecord](docs/AccountOrderRecord.md)
@@ -98,6 +100,7 @@ Class | Method | HTTP request | Description
98
100
  - [SnapTrade::AccountSimple](docs/AccountSimple.md)
99
101
  - [SnapTrade::AccountSyncStatus](docs/AccountSyncStatus.md)
100
102
  - [SnapTrade::Action](docs/Action.md)
103
+ - [SnapTrade::Amount](docs/Amount.md)
101
104
  - [SnapTrade::AuthType](docs/AuthType.md)
102
105
  - [SnapTrade::AuthenticationLoginSnapTradeUser200Response](docs/AuthenticationLoginSnapTradeUser200Response.md)
103
106
  - [SnapTrade::Balance](docs/Balance.md)
data/docs/Account.md CHANGED
@@ -14,6 +14,7 @@
14
14
  | **meta** | **Hash<String, Object>** | | [optional] |
15
15
  | **cash_restrictions** | [**Array<CashRestriction>**](CashRestriction.md) | | [optional] |
16
16
  | **sync_status** | [**AccountSyncStatus**](AccountSyncStatus.md) | | [optional] |
17
+ | **balance** | [**AccountBalance**](AccountBalance.md) | | [optional] |
17
18
 
18
19
  ## Example
19
20
 
@@ -30,7 +31,8 @@ instance = SnapTrade::Account.new(
30
31
  created_date: 2021-06-04T16:26:46.523Z,
31
32
  meta: {"type":"Margin","status":"ACTIVE","institution_name":"Alpaca"},
32
33
  cash_restrictions: null,
33
- sync_status: null
34
+ sync_status: null,
35
+ balance: null
34
36
  )
35
37
  ```
36
38
 
@@ -0,0 +1,18 @@
1
+ # SnapTrade::AccountBalance
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **total** | [**AccountBalanceTotal**](AccountBalanceTotal.md) | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'snaptrade'
13
+
14
+ instance = SnapTrade::AccountBalance.new(
15
+ total: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # SnapTrade::AccountBalanceTotal
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **amount** | **Float** | | [optional] |
8
+ | **currency** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'snaptrade'
14
+
15
+ instance = SnapTrade::AccountBalanceTotal.new(
16
+ amount: 15363.23,
17
+ currency: USD
18
+ )
19
+ ```
20
+
data/docs/Amount.md ADDED
@@ -0,0 +1,20 @@
1
+ # SnapTrade::Amount
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **amount** | **Float** | | [optional] |
8
+ | **currency** | **String** | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'snaptrade'
14
+
15
+ instance = SnapTrade::Amount.new(
16
+ amount: 15363.23,
17
+ currency: USD
18
+ )
19
+ ```
20
+
@@ -34,6 +34,8 @@ module SnapTrade
34
34
 
35
35
  attr_accessor :sync_status
36
36
 
37
+ attr_accessor :balance
38
+
37
39
  # Attribute mapping from ruby-style variable name to JSON key.
38
40
  def self.attribute_map
39
41
  {
@@ -46,7 +48,8 @@ module SnapTrade
46
48
  :'created_date' => :'created_date',
47
49
  :'meta' => :'meta',
48
50
  :'cash_restrictions' => :'cash_restrictions',
49
- :'sync_status' => :'sync_status'
51
+ :'sync_status' => :'sync_status',
52
+ :'balance' => :'balance'
50
53
  }
51
54
  end
52
55
 
@@ -67,7 +70,8 @@ module SnapTrade
67
70
  :'created_date' => :'String',
68
71
  :'meta' => :'Hash<String, Object>',
69
72
  :'cash_restrictions' => :'Array<CashRestriction>',
70
- :'sync_status' => :'AccountSyncStatus'
73
+ :'sync_status' => :'AccountSyncStatus',
74
+ :'balance' => :'AccountBalance'
71
75
  }
72
76
  end
73
77
 
@@ -135,6 +139,10 @@ module SnapTrade
135
139
  if attributes.key?(:'sync_status')
136
140
  self.sync_status = attributes[:'sync_status']
137
141
  end
142
+
143
+ if attributes.key?(:'balance')
144
+ self.balance = attributes[:'balance']
145
+ end
138
146
  end
139
147
 
140
148
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -164,7 +172,8 @@ module SnapTrade
164
172
  created_date == o.created_date &&
165
173
  meta == o.meta &&
166
174
  cash_restrictions == o.cash_restrictions &&
167
- sync_status == o.sync_status
175
+ sync_status == o.sync_status &&
176
+ balance == o.balance
168
177
  end
169
178
 
170
179
  # @see the `==` method
@@ -176,7 +185,7 @@ module SnapTrade
176
185
  # Calculates hash code according to all attributes.
177
186
  # @return [Integer] Hash code
178
187
  def hash
179
- [id, brokerage_authorization, portfolio_group, name, number, institution_name, created_date, meta, cash_restrictions, sync_status].hash
188
+ [id, brokerage_authorization, portfolio_group, name, number, institution_name, created_date, meta, cash_restrictions, sync_status, balance].hash
180
189
  end
181
190
 
182
191
  # Builds the object from hash
@@ -0,0 +1,219 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module SnapTrade
15
+ # Balance of the account
16
+ class AccountBalance
17
+ attr_accessor :total
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'total' => :'total'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'total' => :'AccountBalanceTotal'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ :'total'
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountBalance` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'total')
61
+ self.total = attributes[:'total']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ total == o.total
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [total].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = SnapTrade.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -0,0 +1,234 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module SnapTrade
15
+ # Total value of this account (includes cash, equity, fixed income, etc)
16
+ class AccountBalanceTotal
17
+ attr_accessor :amount
18
+
19
+ attr_accessor :currency
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'amount' => :'amount',
25
+ :'currency' => :'currency'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'amount' => :'Float',
38
+ :'currency' => :'String'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # List of class defined in allOf (OpenAPI v3)
49
+ def self.openapi_all_of
50
+ [
51
+ :'Amount'
52
+ ]
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountBalanceTotal` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountBalanceTotal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'amount')
71
+ self.amount = attributes[:'amount']
72
+ end
73
+
74
+ if attributes.key?(:'currency')
75
+ self.currency = attributes[:'currency']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ amount == o.amount &&
98
+ currency == o.currency
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [amount, currency].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = SnapTrade.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,227 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module SnapTrade
15
+ # Total Value of the account
16
+ class Amount
17
+ attr_accessor :amount
18
+
19
+ attr_accessor :currency
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'amount' => :'amount',
25
+ :'currency' => :'currency'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'amount' => :'Float',
38
+ :'currency' => :'String'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Amount` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Amount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'amount')
64
+ self.amount = attributes[:'amount']
65
+ end
66
+
67
+ if attributes.key?(:'currency')
68
+ self.currency = attributes[:'currency']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ amount == o.amount &&
91
+ currency == o.currency
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [amount, currency].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ attributes = attributes.transform_keys(&:to_sym)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = SnapTrade.const_get(type)
175
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end
@@ -9,5 +9,5 @@ Contact: api@snaptrade.com
9
9
  =end
10
10
 
11
11
  module SnapTrade
12
- VERSION = '1.17.5'
12
+ VERSION = '1.17.6'
13
13
  end
data/lib/snaptrade.rb CHANGED
@@ -18,6 +18,8 @@ require 'snaptrade/configuration'
18
18
 
19
19
  # Models
20
20
  require 'snaptrade/models/account'
21
+ require 'snaptrade/models/account_balance'
22
+ require 'snaptrade/models/account_balance_total'
21
23
  require 'snaptrade/models/account_holdings'
22
24
  require 'snaptrade/models/account_holdings_account'
23
25
  require 'snaptrade/models/account_order_record'
@@ -25,6 +27,7 @@ require 'snaptrade/models/account_order_record_status'
25
27
  require 'snaptrade/models/account_simple'
26
28
  require 'snaptrade/models/account_sync_status'
27
29
  require 'snaptrade/models/action'
30
+ require 'snaptrade/models/amount'
28
31
  require 'snaptrade/models/auth_type'
29
32
  require 'snaptrade/models/authentication_login_snap_trade_user200_response'
30
33
  require 'snaptrade/models/balance'
@@ -0,0 +1,30 @@
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
+
9
+ =end
10
+
11
+ require 'spec_helper'
12
+ require 'json'
13
+ require 'date'
14
+
15
+ # Unit tests for SnapTrade::AccountBalance
16
+ describe SnapTrade::AccountBalance do
17
+ let(:instance) { SnapTrade::AccountBalance.new }
18
+
19
+ describe 'test an instance of AccountBalance' do
20
+ it 'should create an instance of AccountBalance' do
21
+ expect(instance).to be_instance_of(SnapTrade::AccountBalance)
22
+ end
23
+ end
24
+ describe 'test attribute "total"' do
25
+ it 'should work' do
26
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,36 @@
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
+
9
+ =end
10
+
11
+ require 'spec_helper'
12
+ require 'json'
13
+ require 'date'
14
+
15
+ # Unit tests for SnapTrade::AccountBalanceTotal
16
+ describe SnapTrade::AccountBalanceTotal do
17
+ let(:instance) { SnapTrade::AccountBalanceTotal.new }
18
+
19
+ describe 'test an instance of AccountBalanceTotal' do
20
+ it 'should create an instance of AccountBalanceTotal' do
21
+ expect(instance).to be_instance_of(SnapTrade::AccountBalanceTotal)
22
+ end
23
+ end
24
+ describe 'test attribute "amount"' do
25
+ it 'should work' do
26
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "currency"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
33
+ end
34
+ end
35
+
36
+ end
@@ -81,4 +81,10 @@ describe SnapTrade::Account do
81
81
  end
82
82
  end
83
83
 
84
+ describe 'test attribute "balance"' do
85
+ it 'should work' do
86
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
87
+ end
88
+ end
89
+
84
90
  end
@@ -0,0 +1,36 @@
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
+
9
+ =end
10
+
11
+ require 'spec_helper'
12
+ require 'json'
13
+ require 'date'
14
+
15
+ # Unit tests for SnapTrade::Amount
16
+ describe SnapTrade::Amount do
17
+ let(:instance) { SnapTrade::Amount.new }
18
+
19
+ describe 'test an instance of Amount' do
20
+ it 'should create an instance of Amount' do
21
+ expect(instance).to be_instance_of(SnapTrade::Amount)
22
+ end
23
+ end
24
+ describe 'test attribute "amount"' do
25
+ it 'should work' do
26
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "currency"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
33
+ end
34
+ end
35
+
36
+ end
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: 1.17.5
4
+ version: 1.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-08 00:00:00.000000000 Z
11
+ date: 2023-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -83,6 +83,8 @@ files:
83
83
  - Rakefile
84
84
  - docs/APIStatusApi.md
85
85
  - docs/Account.md
86
+ - docs/AccountBalance.md
87
+ - docs/AccountBalanceTotal.md
86
88
  - docs/AccountHoldings.md
87
89
  - docs/AccountHoldingsAccount.md
88
90
  - docs/AccountInformationApi.md
@@ -91,6 +93,7 @@ files:
91
93
  - docs/AccountSimple.md
92
94
  - docs/AccountSyncStatus.md
93
95
  - docs/Action.md
96
+ - docs/Amount.md
94
97
  - docs/AuthType.md
95
98
  - docs/AuthenticationApi.md
96
99
  - docs/AuthenticationLoginSnapTradeUser200Response.md
@@ -232,6 +235,8 @@ files:
232
235
  - lib/snaptrade/api_error.rb
233
236
  - lib/snaptrade/configuration.rb
234
237
  - lib/snaptrade/models/account.rb
238
+ - lib/snaptrade/models/account_balance.rb
239
+ - lib/snaptrade/models/account_balance_total.rb
235
240
  - lib/snaptrade/models/account_holdings.rb
236
241
  - lib/snaptrade/models/account_holdings_account.rb
237
242
  - lib/snaptrade/models/account_order_record.rb
@@ -239,6 +244,7 @@ files:
239
244
  - lib/snaptrade/models/account_simple.rb
240
245
  - lib/snaptrade/models/account_sync_status.rb
241
246
  - lib/snaptrade/models/action.rb
247
+ - lib/snaptrade/models/amount.rb
242
248
  - lib/snaptrade/models/auth_type.rb
243
249
  - lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb
244
250
  - lib/snaptrade/models/balance.rb
@@ -371,6 +377,8 @@ files:
371
377
  - spec/api_client_spec.rb
372
378
  - spec/configuration_spec.rb
373
379
  - spec/getting_started_spec.rb
380
+ - spec/models/account_balance_spec.rb
381
+ - spec/models/account_balance_total_spec.rb
374
382
  - spec/models/account_holdings_account_spec.rb
375
383
  - spec/models/account_holdings_spec.rb
376
384
  - spec/models/account_order_record_spec.rb
@@ -379,6 +387,7 @@ files:
379
387
  - spec/models/account_spec.rb
380
388
  - spec/models/account_sync_status_spec.rb
381
389
  - spec/models/action_spec.rb
390
+ - spec/models/amount_spec.rb
382
391
  - spec/models/auth_type_spec.rb
383
392
  - spec/models/authentication_login_snap_trade_user200_response_spec.rb
384
393
  - spec/models/balance_spec.rb
@@ -560,6 +569,7 @@ test_files:
560
569
  - spec/models/trading_place_oco_order_request_spec.rb
561
570
  - spec/models/monthly_dividends_spec.rb
562
571
  - spec/models/model_portfolio_security_spec.rb
572
+ - spec/models/account_balance_total_spec.rb
563
573
  - spec/models/strategy_order_place_spec.rb
564
574
  - spec/models/model_asset_class_target_spec.rb
565
575
  - spec/models/option_strategy_spec.rb
@@ -598,6 +608,7 @@ test_files:
598
608
  - spec/models/redirect_tokenand_pin_spec.rb
599
609
  - spec/models/type_spec.rb
600
610
  - spec/models/model403_failed_request_response_spec.rb
611
+ - spec/models/amount_spec.rb
601
612
  - spec/models/account_holdings_spec.rb
602
613
  - spec/models/snap_trade_holdings_account_account_id_spec.rb
603
614
  - spec/models/trade_execution_status_action_spec.rb
@@ -624,6 +635,7 @@ test_files:
624
635
  - spec/models/snap_trade_register_user_request_body_spec.rb
625
636
  - spec/models/options_symbol_spec.rb
626
637
  - spec/models/options_place_option_strategy_request_spec.rb
638
+ - spec/models/account_balance_spec.rb
627
639
  - spec/models/action_spec.rb
628
640
  - spec/models/options_get_option_strategy_request_spec.rb
629
641
  - spec/models/currency_spec.rb