snaptrade 2.0.33 → 2.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +26 -21
- data/lib/snaptrade/api/account_information_api.rb +70 -52
- data/lib/snaptrade/api/options_api.rb +16 -12
- data/lib/snaptrade/models/account.rb +11 -2
- data/lib/snaptrade/models/account_balance_total.rb +1 -8
- data/lib/snaptrade/models/account_holdings_account.rb +1 -1
- data/lib/snaptrade/models/account_sync_status.rb +1 -1
- data/lib/snaptrade/models/balance.rb +1 -1
- data/lib/snaptrade/models/{snap_trade_holdings_account_account_id_balance.rb → balance_currency.rb} +33 -12
- data/lib/snaptrade/models/holdings_status.rb +4 -4
- data/lib/snaptrade/models/transactions_status.rb +4 -5
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -3
- data/spec/api/account_information_api_spec.rb +12 -12
- data/spec/api/options_api_spec.rb +3 -3
- data/spec/models/balance_currency_spec.rb +41 -0
- metadata +5 -11
- data/lib/snaptrade/models/amount.rb +0 -228
- data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +0 -313
- data/spec/models/amount_spec.rb +0 -35
- data/spec/models/snap_trade_holdings_account_account_id_balance_spec.rb +0 -29
- data/spec/models/snap_trade_holdings_account_account_id_spec.rb +0 -83
@@ -1,228 +0,0 @@
|
|
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
|
-
# Total value of the account, as reported by the brokerage
|
15
|
-
class Amount
|
16
|
-
# Total value denominated in the currency of the `currency` field.
|
17
|
-
attr_accessor :amount
|
18
|
-
|
19
|
-
# The ISO-4217 currency code for the amount.
|
20
|
-
attr_accessor :currency
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{
|
25
|
-
:'amount' => :'amount',
|
26
|
-
:'currency' => :'currency'
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Returns all the JSON keys this model knows about
|
31
|
-
def self.acceptable_attributes
|
32
|
-
attribute_map.values
|
33
|
-
end
|
34
|
-
|
35
|
-
# Attribute type mapping.
|
36
|
-
def self.openapi_types
|
37
|
-
{
|
38
|
-
:'amount' => :'Float',
|
39
|
-
:'currency' => :'String'
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# List of attributes with nullable: true
|
44
|
-
def self.openapi_nullable
|
45
|
-
Set.new([
|
46
|
-
])
|
47
|
-
end
|
48
|
-
|
49
|
-
# Initializes the object
|
50
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
-
def initialize(attributes = {})
|
52
|
-
if (!attributes.is_a?(Hash))
|
53
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Amount` initialize method"
|
54
|
-
end
|
55
|
-
|
56
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
-
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
|
60
|
-
end
|
61
|
-
h[k.to_sym] = v
|
62
|
-
}
|
63
|
-
|
64
|
-
if attributes.key?(:'amount')
|
65
|
-
self.amount = attributes[:'amount']
|
66
|
-
end
|
67
|
-
|
68
|
-
if attributes.key?(:'currency')
|
69
|
-
self.currency = attributes[:'currency']
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
-
# @return Array for valid properties with the reasons
|
75
|
-
def list_invalid_properties
|
76
|
-
invalid_properties = Array.new
|
77
|
-
invalid_properties
|
78
|
-
end
|
79
|
-
|
80
|
-
# Check to see if the all the properties in the model are valid
|
81
|
-
# @return true if the model is valid
|
82
|
-
def valid?
|
83
|
-
true
|
84
|
-
end
|
85
|
-
|
86
|
-
# Checks equality by comparing each attribute.
|
87
|
-
# @param [Object] Object to be compared
|
88
|
-
def ==(o)
|
89
|
-
return true if self.equal?(o)
|
90
|
-
self.class == o.class &&
|
91
|
-
amount == o.amount &&
|
92
|
-
currency == o.currency
|
93
|
-
end
|
94
|
-
|
95
|
-
# @see the `==` method
|
96
|
-
# @param [Object] Object to be compared
|
97
|
-
def eql?(o)
|
98
|
-
self == o
|
99
|
-
end
|
100
|
-
|
101
|
-
# Calculates hash code according to all attributes.
|
102
|
-
# @return [Integer] Hash code
|
103
|
-
def hash
|
104
|
-
[amount, currency].hash
|
105
|
-
end
|
106
|
-
|
107
|
-
# Builds the object from hash
|
108
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
-
# @return [Object] Returns the model itself
|
110
|
-
def self.build_from_hash(attributes)
|
111
|
-
new.build_from_hash(attributes)
|
112
|
-
end
|
113
|
-
|
114
|
-
# Builds the object from hash
|
115
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
-
# @return [Object] Returns the model itself
|
117
|
-
def build_from_hash(attributes)
|
118
|
-
return nil unless attributes.is_a?(Hash)
|
119
|
-
attributes = attributes.transform_keys(&:to_sym)
|
120
|
-
self.class.openapi_types.each_pair do |key, type|
|
121
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
122
|
-
self.send("#{key}=", nil)
|
123
|
-
elsif type =~ /\AArray<(.*)>/i
|
124
|
-
# check to ensure the input is an array given that the attribute
|
125
|
-
# is documented as an array but the input is not
|
126
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
127
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
128
|
-
end
|
129
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
130
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
self
|
135
|
-
end
|
136
|
-
|
137
|
-
# Deserializes the data based on type
|
138
|
-
# @param string type Data type
|
139
|
-
# @param string value Value to be deserialized
|
140
|
-
# @return [Object] Deserialized data
|
141
|
-
def _deserialize(type, value)
|
142
|
-
case type.to_sym
|
143
|
-
when :Time
|
144
|
-
Time.parse(value)
|
145
|
-
when :Date
|
146
|
-
Date.parse(value)
|
147
|
-
when :String
|
148
|
-
value.to_s
|
149
|
-
when :Integer
|
150
|
-
value.to_i
|
151
|
-
when :Float
|
152
|
-
value.to_f
|
153
|
-
when :Boolean
|
154
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
|
-
true
|
156
|
-
else
|
157
|
-
false
|
158
|
-
end
|
159
|
-
when :Object
|
160
|
-
# generic object (usually a Hash), return directly
|
161
|
-
value
|
162
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
163
|
-
inner_type = Regexp.last_match[:inner_type]
|
164
|
-
value.map { |v| _deserialize(inner_type, v) }
|
165
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
166
|
-
k_type = Regexp.last_match[:k_type]
|
167
|
-
v_type = Regexp.last_match[:v_type]
|
168
|
-
{}.tap do |hash|
|
169
|
-
value.each do |k, v|
|
170
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
else # model
|
174
|
-
# models (e.g. Pet) or oneOf
|
175
|
-
klass = SnapTrade.const_get(type)
|
176
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
# Returns the string representation of the object
|
181
|
-
# @return [String] String presentation of the object
|
182
|
-
def to_s
|
183
|
-
to_hash.to_s
|
184
|
-
end
|
185
|
-
|
186
|
-
# to_body is an alias to to_hash (backward compatibility)
|
187
|
-
# @return [Hash] Returns the object in the form of hash
|
188
|
-
def to_body
|
189
|
-
to_hash
|
190
|
-
end
|
191
|
-
|
192
|
-
# Returns the object in the form of hash
|
193
|
-
# @return [Hash] Returns the object in the form of hash
|
194
|
-
def to_hash
|
195
|
-
hash = {}
|
196
|
-
self.class.attribute_map.each_pair do |attr, param|
|
197
|
-
value = self.send(attr)
|
198
|
-
if value.nil?
|
199
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
200
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
201
|
-
end
|
202
|
-
|
203
|
-
hash[param] = _to_hash(value)
|
204
|
-
end
|
205
|
-
hash
|
206
|
-
end
|
207
|
-
|
208
|
-
# Outputs non-array value in the form of hash
|
209
|
-
# For object, use to_hash. Otherwise, just return the value
|
210
|
-
# @param [Object] value Any valid value
|
211
|
-
# @return [Hash] Returns the value in the form of hash
|
212
|
-
def _to_hash(value)
|
213
|
-
if value.is_a?(Array)
|
214
|
-
value.compact.map { |v| _to_hash(v) }
|
215
|
-
elsif value.is_a?(Hash)
|
216
|
-
{}.tap do |hash|
|
217
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
218
|
-
end
|
219
|
-
elsif value.respond_to? :to_hash
|
220
|
-
value.to_hash
|
221
|
-
else
|
222
|
-
value
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
@@ -1,313 +0,0 @@
|
|
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
|
-
# A single brokerage account at a financial institution.
|
15
|
-
class SnapTradeHoldingsAccountAccountId
|
16
|
-
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
17
|
-
attr_accessor :id
|
18
|
-
|
19
|
-
# Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade.
|
20
|
-
attr_accessor :brokerage_authorization
|
21
|
-
|
22
|
-
# Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.
|
23
|
-
attr_accessor :portfolio_group
|
24
|
-
|
25
|
-
# A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity.
|
26
|
-
attr_accessor :name
|
27
|
-
|
28
|
-
# The account number assigned by the financial institution.
|
29
|
-
attr_accessor :number
|
30
|
-
|
31
|
-
# The name of the financial institution that holds the account.
|
32
|
-
attr_accessor :institution_name
|
33
|
-
|
34
|
-
attr_accessor :balance
|
35
|
-
|
36
|
-
# Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk.
|
37
|
-
attr_accessor :meta
|
38
|
-
|
39
|
-
# This field is deprecated.
|
40
|
-
attr_accessor :cash_restrictions
|
41
|
-
|
42
|
-
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution.
|
43
|
-
attr_accessor :created_date
|
44
|
-
|
45
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
-
def self.attribute_map
|
47
|
-
{
|
48
|
-
:'id' => :'id',
|
49
|
-
:'brokerage_authorization' => :'brokerage_authorization',
|
50
|
-
:'portfolio_group' => :'portfolio_group',
|
51
|
-
:'name' => :'name',
|
52
|
-
:'number' => :'number',
|
53
|
-
:'institution_name' => :'institution_name',
|
54
|
-
:'balance' => :'balance',
|
55
|
-
:'meta' => :'meta',
|
56
|
-
:'cash_restrictions' => :'cash_restrictions',
|
57
|
-
:'created_date' => :'created_date'
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
# Returns all the JSON keys this model knows about
|
62
|
-
def self.acceptable_attributes
|
63
|
-
attribute_map.values
|
64
|
-
end
|
65
|
-
|
66
|
-
# Attribute type mapping.
|
67
|
-
def self.openapi_types
|
68
|
-
{
|
69
|
-
:'id' => :'String',
|
70
|
-
:'brokerage_authorization' => :'String',
|
71
|
-
:'portfolio_group' => :'String',
|
72
|
-
:'name' => :'String',
|
73
|
-
:'number' => :'String',
|
74
|
-
:'institution_name' => :'String',
|
75
|
-
:'balance' => :'SnapTradeHoldingsAccountAccountIdBalance',
|
76
|
-
:'meta' => :'Hash<String, Object>',
|
77
|
-
:'cash_restrictions' => :'Array<String>',
|
78
|
-
:'created_date' => :'Time'
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
# List of attributes with nullable: true
|
83
|
-
def self.openapi_nullable
|
84
|
-
Set.new([
|
85
|
-
:'name',
|
86
|
-
:'balance',
|
87
|
-
])
|
88
|
-
end
|
89
|
-
|
90
|
-
# Initializes the object
|
91
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
-
def initialize(attributes = {})
|
93
|
-
if (!attributes.is_a?(Hash))
|
94
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::SnapTradeHoldingsAccountAccountId` initialize method"
|
95
|
-
end
|
96
|
-
|
97
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
98
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
99
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
100
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::SnapTradeHoldingsAccountAccountId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
101
|
-
end
|
102
|
-
h[k.to_sym] = v
|
103
|
-
}
|
104
|
-
|
105
|
-
if attributes.key?(:'id')
|
106
|
-
self.id = attributes[:'id']
|
107
|
-
end
|
108
|
-
|
109
|
-
if attributes.key?(:'brokerage_authorization')
|
110
|
-
self.brokerage_authorization = attributes[:'brokerage_authorization']
|
111
|
-
end
|
112
|
-
|
113
|
-
if attributes.key?(:'portfolio_group')
|
114
|
-
self.portfolio_group = attributes[:'portfolio_group']
|
115
|
-
end
|
116
|
-
|
117
|
-
if attributes.key?(:'name')
|
118
|
-
self.name = attributes[:'name']
|
119
|
-
end
|
120
|
-
|
121
|
-
if attributes.key?(:'number')
|
122
|
-
self.number = attributes[:'number']
|
123
|
-
end
|
124
|
-
|
125
|
-
if attributes.key?(:'institution_name')
|
126
|
-
self.institution_name = attributes[:'institution_name']
|
127
|
-
end
|
128
|
-
|
129
|
-
if attributes.key?(:'balance')
|
130
|
-
self.balance = attributes[:'balance']
|
131
|
-
end
|
132
|
-
|
133
|
-
if attributes.key?(:'meta')
|
134
|
-
if (value = attributes[:'meta']).is_a?(Hash)
|
135
|
-
self.meta = value
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
if attributes.key?(:'cash_restrictions')
|
140
|
-
if (value = attributes[:'cash_restrictions']).is_a?(Array)
|
141
|
-
self.cash_restrictions = value
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
if attributes.key?(:'created_date')
|
146
|
-
self.created_date = attributes[:'created_date']
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
151
|
-
# @return Array for valid properties with the reasons
|
152
|
-
def list_invalid_properties
|
153
|
-
invalid_properties = Array.new
|
154
|
-
invalid_properties
|
155
|
-
end
|
156
|
-
|
157
|
-
# Check to see if the all the properties in the model are valid
|
158
|
-
# @return true if the model is valid
|
159
|
-
def valid?
|
160
|
-
true
|
161
|
-
end
|
162
|
-
|
163
|
-
# Checks equality by comparing each attribute.
|
164
|
-
# @param [Object] Object to be compared
|
165
|
-
def ==(o)
|
166
|
-
return true if self.equal?(o)
|
167
|
-
self.class == o.class &&
|
168
|
-
id == o.id &&
|
169
|
-
brokerage_authorization == o.brokerage_authorization &&
|
170
|
-
portfolio_group == o.portfolio_group &&
|
171
|
-
name == o.name &&
|
172
|
-
number == o.number &&
|
173
|
-
institution_name == o.institution_name &&
|
174
|
-
balance == o.balance &&
|
175
|
-
meta == o.meta &&
|
176
|
-
cash_restrictions == o.cash_restrictions &&
|
177
|
-
created_date == o.created_date
|
178
|
-
end
|
179
|
-
|
180
|
-
# @see the `==` method
|
181
|
-
# @param [Object] Object to be compared
|
182
|
-
def eql?(o)
|
183
|
-
self == o
|
184
|
-
end
|
185
|
-
|
186
|
-
# Calculates hash code according to all attributes.
|
187
|
-
# @return [Integer] Hash code
|
188
|
-
def hash
|
189
|
-
[id, brokerage_authorization, portfolio_group, name, number, institution_name, balance, meta, cash_restrictions, created_date].hash
|
190
|
-
end
|
191
|
-
|
192
|
-
# Builds the object from hash
|
193
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
-
# @return [Object] Returns the model itself
|
195
|
-
def self.build_from_hash(attributes)
|
196
|
-
new.build_from_hash(attributes)
|
197
|
-
end
|
198
|
-
|
199
|
-
# Builds the object from hash
|
200
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
201
|
-
# @return [Object] Returns the model itself
|
202
|
-
def build_from_hash(attributes)
|
203
|
-
return nil unless attributes.is_a?(Hash)
|
204
|
-
attributes = attributes.transform_keys(&:to_sym)
|
205
|
-
self.class.openapi_types.each_pair do |key, type|
|
206
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
207
|
-
self.send("#{key}=", nil)
|
208
|
-
elsif type =~ /\AArray<(.*)>/i
|
209
|
-
# check to ensure the input is an array given that the attribute
|
210
|
-
# is documented as an array but the input is not
|
211
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
212
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
213
|
-
end
|
214
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
215
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
self
|
220
|
-
end
|
221
|
-
|
222
|
-
# Deserializes the data based on type
|
223
|
-
# @param string type Data type
|
224
|
-
# @param string value Value to be deserialized
|
225
|
-
# @return [Object] Deserialized data
|
226
|
-
def _deserialize(type, value)
|
227
|
-
case type.to_sym
|
228
|
-
when :Time
|
229
|
-
Time.parse(value)
|
230
|
-
when :Date
|
231
|
-
Date.parse(value)
|
232
|
-
when :String
|
233
|
-
value.to_s
|
234
|
-
when :Integer
|
235
|
-
value.to_i
|
236
|
-
when :Float
|
237
|
-
value.to_f
|
238
|
-
when :Boolean
|
239
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
240
|
-
true
|
241
|
-
else
|
242
|
-
false
|
243
|
-
end
|
244
|
-
when :Object
|
245
|
-
# generic object (usually a Hash), return directly
|
246
|
-
value
|
247
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
248
|
-
inner_type = Regexp.last_match[:inner_type]
|
249
|
-
value.map { |v| _deserialize(inner_type, v) }
|
250
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
251
|
-
k_type = Regexp.last_match[:k_type]
|
252
|
-
v_type = Regexp.last_match[:v_type]
|
253
|
-
{}.tap do |hash|
|
254
|
-
value.each do |k, v|
|
255
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
256
|
-
end
|
257
|
-
end
|
258
|
-
else # model
|
259
|
-
# models (e.g. Pet) or oneOf
|
260
|
-
klass = SnapTrade.const_get(type)
|
261
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
# Returns the string representation of the object
|
266
|
-
# @return [String] String presentation of the object
|
267
|
-
def to_s
|
268
|
-
to_hash.to_s
|
269
|
-
end
|
270
|
-
|
271
|
-
# to_body is an alias to to_hash (backward compatibility)
|
272
|
-
# @return [Hash] Returns the object in the form of hash
|
273
|
-
def to_body
|
274
|
-
to_hash
|
275
|
-
end
|
276
|
-
|
277
|
-
# Returns the object in the form of hash
|
278
|
-
# @return [Hash] Returns the object in the form of hash
|
279
|
-
def to_hash
|
280
|
-
hash = {}
|
281
|
-
self.class.attribute_map.each_pair do |attr, param|
|
282
|
-
value = self.send(attr)
|
283
|
-
if value.nil?
|
284
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
285
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
286
|
-
end
|
287
|
-
|
288
|
-
hash[param] = _to_hash(value)
|
289
|
-
end
|
290
|
-
hash
|
291
|
-
end
|
292
|
-
|
293
|
-
# Outputs non-array value in the form of hash
|
294
|
-
# For object, use to_hash. Otherwise, just return the value
|
295
|
-
# @param [Object] value Any valid value
|
296
|
-
# @return [Hash] Returns the value in the form of hash
|
297
|
-
def _to_hash(value)
|
298
|
-
if value.is_a?(Array)
|
299
|
-
value.compact.map { |v| _to_hash(v) }
|
300
|
-
elsif value.is_a?(Hash)
|
301
|
-
{}.tap do |hash|
|
302
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
303
|
-
end
|
304
|
-
elsif value.respond_to? :to_hash
|
305
|
-
value.to_hash
|
306
|
-
else
|
307
|
-
value
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
end
|
312
|
-
|
313
|
-
end
|
data/spec/models/amount_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
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::Amount
|
15
|
-
describe SnapTrade::Amount do
|
16
|
-
let(:instance) { SnapTrade::Amount.new }
|
17
|
-
|
18
|
-
describe 'test an instance of Amount' do
|
19
|
-
it 'should create an instance of Amount' do
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::Amount)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe 'test attribute "amount"' 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
|
-
describe 'test attribute "currency"' do
|
30
|
-
it 'should work' do
|
31
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,29 +0,0 @@
|
|
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
|
@@ -1,83 +0,0 @@
|
|
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::SnapTradeHoldingsAccountAccountId
|
15
|
-
describe SnapTrade::SnapTradeHoldingsAccountAccountId do
|
16
|
-
let(:instance) { SnapTrade::SnapTradeHoldingsAccountAccountId.new }
|
17
|
-
|
18
|
-
describe 'test an instance of SnapTradeHoldingsAccountAccountId' do
|
19
|
-
it 'should create an instance of SnapTradeHoldingsAccountAccountId' do
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::SnapTradeHoldingsAccountAccountId)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe 'test attribute "id"' 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
|
-
describe 'test attribute "brokerage_authorization"' do
|
30
|
-
it 'should work' do
|
31
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'test attribute "portfolio_group"' do
|
36
|
-
it 'should work' do
|
37
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'test attribute "name"' do
|
42
|
-
it 'should work' do
|
43
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'test attribute "number"' do
|
48
|
-
it 'should work' do
|
49
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'test attribute "institution_name"' do
|
54
|
-
it 'should work' do
|
55
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
-
end
|
57
|
-
end
|
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
|
-
|
65
|
-
describe 'test attribute "meta"' do
|
66
|
-
it 'should work' do
|
67
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'test attribute "cash_restrictions"' do
|
72
|
-
it 'should work' do
|
73
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'test attribute "created_date"' do
|
78
|
-
it 'should work' do
|
79
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|