snaptrade 2.0.31 → 2.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +31 -29
- data/README.md +4 -2
- data/lib/snaptrade/api/account_information_api.rb +6 -2
- data/lib/snaptrade/models/account.rb +2 -1
- data/lib/snaptrade/models/account_holdings_account.rb +2 -2
- data/lib/snaptrade/models/account_order_record.rb +25 -19
- data/lib/snaptrade/models/{brokerage_symbol_option_symbol.rb → account_order_record_option_symbol.rb} +15 -26
- data/lib/snaptrade/models/{brokerage_symbol_symbol.rb → account_order_record_universal_symbol.rb} +12 -5
- data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +1 -1
- data/lib/snaptrade/models/exchange.rb +9 -1
- data/lib/snaptrade/models/figi_instrument.rb +3 -1
- data/lib/snaptrade/models/monthly_dividends.rb +1 -1
- data/lib/snaptrade/models/net_contributions.rb +1 -1
- data/lib/snaptrade/models/option_brokerage_symbol.rb +3 -1
- data/lib/snaptrade/models/options_position.rb +1 -1
- data/lib/snaptrade/models/options_position_currency.rb +1 -0
- data/lib/snaptrade/models/options_symbol.rb +12 -24
- data/lib/snaptrade/models/order_type_strict.rb +2 -2
- data/lib/snaptrade/models/past_value.rb +1 -1
- data/lib/snaptrade/models/position_symbol.rb +6 -1
- data/lib/snaptrade/models/security_type.rb +5 -1
- data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +1 -1
- data/lib/snaptrade/models/strategy_order_record.rb +1 -1
- data/lib/snaptrade/models/sub_period_return_rate.rb +2 -2
- data/lib/snaptrade/models/symbol_figi_instrument.rb +2 -0
- data/lib/snaptrade/models/type.rb +3 -3
- data/lib/snaptrade/models/underlying_symbol.rb +20 -5
- data/lib/snaptrade/models/{model_portfolio.rb → underlying_symbol_exchange.rb} +73 -12
- data/lib/snaptrade/models/{brokerage_symbol.rb → underlying_symbol_type.rb} +28 -38
- data/lib/snaptrade/models/universal_symbol.rb +9 -3
- data/lib/snaptrade/models/{portfolio_group.rb → universal_symbol_currency.rb} +24 -4
- data/lib/snaptrade/models/{model_asset_class.rb → universal_symbol_exchange.rb} +78 -7
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +6 -38
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/models/{strategy_impact_legs_inner_spec.rb → account_order_record_option_symbol_spec.rb} +13 -13
- data/spec/models/{brokerage_symbol_symbol_spec.rb → account_order_record_universal_symbol_spec.rb} +6 -6
- data/spec/models/options_symbol_spec.rb +0 -12
- data/spec/models/{brokerage_symbol_option_symbol_spec.rb → underlying_symbol_exchange_spec.rb} +14 -14
- data/spec/models/underlying_symbol_spec.rb +6 -0
- data/spec/models/{cash_restriction_spec.rb → underlying_symbol_type_spec.rb} +9 -15
- data/spec/models/{model_portfolio_spec.rb → universal_symbol_currency_spec.rb} +8 -8
- data/spec/models/{trade_spec.rb → universal_symbol_exchange_spec.rb} +13 -13
- metadata +117 -213
- data/lib/snaptrade/models/brokerage_authorization_type.rb +0 -216
- data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +0 -37
- data/lib/snaptrade/models/brokerage_authorization_type_type.rb +0 -37
- data/lib/snaptrade/models/calculated_trade.rb +0 -228
- data/lib/snaptrade/models/cash_restriction.rb +0 -253
- data/lib/snaptrade/models/excluded_asset.rb +0 -217
- data/lib/snaptrade/models/jwt.rb +0 -217
- data/lib/snaptrade/models/model_asset_class_details.rb +0 -227
- data/lib/snaptrade/models/model_asset_class_target.rb +0 -216
- data/lib/snaptrade/models/model_portfolio_asset_class.rb +0 -249
- data/lib/snaptrade/models/model_portfolio_details.rb +0 -238
- data/lib/snaptrade/models/model_portfolio_security.rb +0 -249
- data/lib/snaptrade/models/model_type.rb +0 -38
- data/lib/snaptrade/models/portfolio_group_info.rb +0 -325
- data/lib/snaptrade/models/portfolio_group_position.rb +0 -237
- data/lib/snaptrade/models/portfolio_group_settings.rb +0 -276
- data/lib/snaptrade/models/redirect_tokenand_pin.rb +0 -226
- data/lib/snaptrade/models/snap_trade_api_disclaimer_accept_status.rb +0 -226
- data/lib/snaptrade/models/state.rb +0 -40
- data/lib/snaptrade/models/strategy_impact.rb +0 -309
- data/lib/snaptrade/models/strategy_impact_legs_inner.rb +0 -270
- data/lib/snaptrade/models/strategy_order_place.rb +0 -228
- data/lib/snaptrade/models/strategy_order_place_orders_inner.rb +0 -596
- data/lib/snaptrade/models/strategy_order_place_orders_inner_legs_inner.rb +0 -270
- data/lib/snaptrade/models/target_asset.rb +0 -289
- data/lib/snaptrade/models/trade.rb +0 -280
- data/lib/snaptrade/models/trade_action.rb +0 -37
- data/lib/snaptrade/models/trade_execution_status.rb +0 -297
- data/lib/snaptrade/models/trade_execution_status_action.rb +0 -37
- data/lib/snaptrade/models/trade_impact.rb +0 -256
- data/lib/snaptrade/models/user_error_log.rb +0 -262
- data/lib/snaptrade/models/user_settings.rb +0 -298
- data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +0 -23
- data/spec/models/brokerage_authorization_type_spec.rb +0 -29
- data/spec/models/brokerage_authorization_type_type_spec.rb +0 -23
- data/spec/models/brokerage_symbol_spec.rb +0 -59
- data/spec/models/calculated_trade_spec.rb +0 -35
- data/spec/models/excluded_asset_spec.rb +0 -29
- data/spec/models/jwt_spec.rb +0 -29
- data/spec/models/model_asset_class_details_spec.rb +0 -35
- data/spec/models/model_asset_class_spec.rb +0 -35
- data/spec/models/model_asset_class_target_spec.rb +0 -29
- data/spec/models/model_portfolio_asset_class_spec.rb +0 -35
- data/spec/models/model_portfolio_details_spec.rb +0 -41
- data/spec/models/model_portfolio_security_spec.rb +0 -35
- data/spec/models/model_type_spec.rb +0 -23
- data/spec/models/portfolio_group_info_spec.rb +0 -89
- data/spec/models/portfolio_group_position_spec.rb +0 -41
- data/spec/models/portfolio_group_settings_spec.rb +0 -53
- data/spec/models/portfolio_group_spec.rb +0 -35
- data/spec/models/redirect_tokenand_pin_spec.rb +0 -35
- data/spec/models/snap_trade_api_disclaimer_accept_status_spec.rb +0 -35
- data/spec/models/state_spec.rb +0 -23
- data/spec/models/strategy_impact_spec.rb +0 -89
- data/spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb +0 -65
- data/spec/models/strategy_order_place_orders_inner_spec.rb +0 -281
- data/spec/models/strategy_order_place_spec.rb +0 -35
- data/spec/models/target_asset_spec.rb +0 -59
- data/spec/models/trade_action_spec.rb +0 -23
- data/spec/models/trade_execution_status_action_spec.rb +0 -23
- data/spec/models/trade_execution_status_spec.rb +0 -77
- data/spec/models/trade_impact_spec.rb +0 -53
- data/spec/models/user_error_log_spec.rb +0 -59
- data/spec/models/user_settings_spec.rb +0 -83
@@ -1,276 +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
|
-
class PortfolioGroupSettings
|
15
|
-
attr_accessor :buy_only
|
16
|
-
|
17
|
-
attr_accessor :cash_optimizer
|
18
|
-
|
19
|
-
attr_accessor :notify_frequency
|
20
|
-
|
21
|
-
attr_accessor :drift_threshold
|
22
|
-
|
23
|
-
attr_accessor :preferred_currency
|
24
|
-
|
25
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
-
def self.attribute_map
|
27
|
-
{
|
28
|
-
:'buy_only' => :'buyOnly',
|
29
|
-
:'cash_optimizer' => :'cash_optimizer',
|
30
|
-
:'notify_frequency' => :'notifyFrequency',
|
31
|
-
:'drift_threshold' => :'driftThreshold',
|
32
|
-
:'preferred_currency' => :'preferred_currency'
|
33
|
-
}
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns all the JSON keys this model knows about
|
37
|
-
def self.acceptable_attributes
|
38
|
-
attribute_map.values
|
39
|
-
end
|
40
|
-
|
41
|
-
# Attribute type mapping.
|
42
|
-
def self.openapi_types
|
43
|
-
{
|
44
|
-
:'buy_only' => :'Boolean',
|
45
|
-
:'cash_optimizer' => :'Boolean',
|
46
|
-
:'notify_frequency' => :'String',
|
47
|
-
:'drift_threshold' => :'Float',
|
48
|
-
:'preferred_currency' => :'Currency'
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
# List of attributes with nullable: true
|
53
|
-
def self.openapi_nullable
|
54
|
-
Set.new([
|
55
|
-
])
|
56
|
-
end
|
57
|
-
|
58
|
-
# Initializes the object
|
59
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
60
|
-
def initialize(attributes = {})
|
61
|
-
if (!attributes.is_a?(Hash))
|
62
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::PortfolioGroupSettings` initialize method"
|
63
|
-
end
|
64
|
-
|
65
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
66
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
67
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
68
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::PortfolioGroupSettings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
69
|
-
end
|
70
|
-
h[k.to_sym] = v
|
71
|
-
}
|
72
|
-
|
73
|
-
if attributes.key?(:'buy_only')
|
74
|
-
self.buy_only = attributes[:'buy_only']
|
75
|
-
end
|
76
|
-
|
77
|
-
if attributes.key?(:'cash_optimizer')
|
78
|
-
self.cash_optimizer = attributes[:'cash_optimizer']
|
79
|
-
end
|
80
|
-
|
81
|
-
if attributes.key?(:'notify_frequency')
|
82
|
-
self.notify_frequency = attributes[:'notify_frequency']
|
83
|
-
end
|
84
|
-
|
85
|
-
if attributes.key?(:'drift_threshold')
|
86
|
-
self.drift_threshold = attributes[:'drift_threshold']
|
87
|
-
end
|
88
|
-
|
89
|
-
if attributes.key?(:'preferred_currency')
|
90
|
-
self.preferred_currency = attributes[:'preferred_currency']
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
-
# @return Array for valid properties with the reasons
|
96
|
-
def list_invalid_properties
|
97
|
-
invalid_properties = Array.new
|
98
|
-
if !@drift_threshold.nil? && @drift_threshold > 100
|
99
|
-
invalid_properties.push('invalid value for "drift_threshold", must be smaller than or equal to 100.')
|
100
|
-
end
|
101
|
-
|
102
|
-
if !@drift_threshold.nil? && @drift_threshold < 0
|
103
|
-
invalid_properties.push('invalid value for "drift_threshold", must be greater than or equal to 0.')
|
104
|
-
end
|
105
|
-
|
106
|
-
invalid_properties
|
107
|
-
end
|
108
|
-
|
109
|
-
# Check to see if the all the properties in the model are valid
|
110
|
-
# @return true if the model is valid
|
111
|
-
def valid?
|
112
|
-
return false if !@drift_threshold.nil? && @drift_threshold > 100
|
113
|
-
return false if !@drift_threshold.nil? && @drift_threshold < 0
|
114
|
-
true
|
115
|
-
end
|
116
|
-
|
117
|
-
# Custom attribute writer method with validation
|
118
|
-
# @param [Object] drift_threshold Value to be assigned
|
119
|
-
def drift_threshold=(drift_threshold)
|
120
|
-
if !drift_threshold.nil? && drift_threshold > 100
|
121
|
-
fail ArgumentError, 'invalid value for "drift_threshold", must be smaller than or equal to 100.'
|
122
|
-
end
|
123
|
-
|
124
|
-
if !drift_threshold.nil? && drift_threshold < 0
|
125
|
-
fail ArgumentError, 'invalid value for "drift_threshold", must be greater than or equal to 0.'
|
126
|
-
end
|
127
|
-
|
128
|
-
@drift_threshold = drift_threshold
|
129
|
-
end
|
130
|
-
|
131
|
-
# Checks equality by comparing each attribute.
|
132
|
-
# @param [Object] Object to be compared
|
133
|
-
def ==(o)
|
134
|
-
return true if self.equal?(o)
|
135
|
-
self.class == o.class &&
|
136
|
-
buy_only == o.buy_only &&
|
137
|
-
cash_optimizer == o.cash_optimizer &&
|
138
|
-
notify_frequency == o.notify_frequency &&
|
139
|
-
drift_threshold == o.drift_threshold &&
|
140
|
-
preferred_currency == o.preferred_currency
|
141
|
-
end
|
142
|
-
|
143
|
-
# @see the `==` method
|
144
|
-
# @param [Object] Object to be compared
|
145
|
-
def eql?(o)
|
146
|
-
self == o
|
147
|
-
end
|
148
|
-
|
149
|
-
# Calculates hash code according to all attributes.
|
150
|
-
# @return [Integer] Hash code
|
151
|
-
def hash
|
152
|
-
[buy_only, cash_optimizer, notify_frequency, drift_threshold, preferred_currency].hash
|
153
|
-
end
|
154
|
-
|
155
|
-
# Builds the object from hash
|
156
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
-
# @return [Object] Returns the model itself
|
158
|
-
def self.build_from_hash(attributes)
|
159
|
-
new.build_from_hash(attributes)
|
160
|
-
end
|
161
|
-
|
162
|
-
# Builds the object from hash
|
163
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
164
|
-
# @return [Object] Returns the model itself
|
165
|
-
def build_from_hash(attributes)
|
166
|
-
return nil unless attributes.is_a?(Hash)
|
167
|
-
attributes = attributes.transform_keys(&:to_sym)
|
168
|
-
self.class.openapi_types.each_pair do |key, type|
|
169
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
170
|
-
self.send("#{key}=", nil)
|
171
|
-
elsif type =~ /\AArray<(.*)>/i
|
172
|
-
# check to ensure the input is an array given that the attribute
|
173
|
-
# is documented as an array but the input is not
|
174
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
176
|
-
end
|
177
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
self
|
183
|
-
end
|
184
|
-
|
185
|
-
# Deserializes the data based on type
|
186
|
-
# @param string type Data type
|
187
|
-
# @param string value Value to be deserialized
|
188
|
-
# @return [Object] Deserialized data
|
189
|
-
def _deserialize(type, value)
|
190
|
-
case type.to_sym
|
191
|
-
when :Time
|
192
|
-
Time.parse(value)
|
193
|
-
when :Date
|
194
|
-
Date.parse(value)
|
195
|
-
when :String
|
196
|
-
value.to_s
|
197
|
-
when :Integer
|
198
|
-
value.to_i
|
199
|
-
when :Float
|
200
|
-
value.to_f
|
201
|
-
when :Boolean
|
202
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
-
true
|
204
|
-
else
|
205
|
-
false
|
206
|
-
end
|
207
|
-
when :Object
|
208
|
-
# generic object (usually a Hash), return directly
|
209
|
-
value
|
210
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
-
inner_type = Regexp.last_match[:inner_type]
|
212
|
-
value.map { |v| _deserialize(inner_type, v) }
|
213
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
-
k_type = Regexp.last_match[:k_type]
|
215
|
-
v_type = Regexp.last_match[:v_type]
|
216
|
-
{}.tap do |hash|
|
217
|
-
value.each do |k, v|
|
218
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
else # model
|
222
|
-
# models (e.g. Pet) or oneOf
|
223
|
-
klass = SnapTrade.const_get(type)
|
224
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
# Returns the string representation of the object
|
229
|
-
# @return [String] String presentation of the object
|
230
|
-
def to_s
|
231
|
-
to_hash.to_s
|
232
|
-
end
|
233
|
-
|
234
|
-
# to_body is an alias to to_hash (backward compatibility)
|
235
|
-
# @return [Hash] Returns the object in the form of hash
|
236
|
-
def to_body
|
237
|
-
to_hash
|
238
|
-
end
|
239
|
-
|
240
|
-
# Returns the object in the form of hash
|
241
|
-
# @return [Hash] Returns the object in the form of hash
|
242
|
-
def to_hash
|
243
|
-
hash = {}
|
244
|
-
self.class.attribute_map.each_pair do |attr, param|
|
245
|
-
value = self.send(attr)
|
246
|
-
if value.nil?
|
247
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
248
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
249
|
-
end
|
250
|
-
|
251
|
-
hash[param] = _to_hash(value)
|
252
|
-
end
|
253
|
-
hash
|
254
|
-
end
|
255
|
-
|
256
|
-
# Outputs non-array value in the form of hash
|
257
|
-
# For object, use to_hash. Otherwise, just return the value
|
258
|
-
# @param [Object] value Any valid value
|
259
|
-
# @return [Hash] Returns the value in the form of hash
|
260
|
-
def _to_hash(value)
|
261
|
-
if value.is_a?(Array)
|
262
|
-
value.compact.map { |v| _to_hash(v) }
|
263
|
-
elsif value.is_a?(Hash)
|
264
|
-
{}.tap do |hash|
|
265
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
266
|
-
end
|
267
|
-
elsif value.respond_to? :to_hash
|
268
|
-
value.to_hash
|
269
|
-
else
|
270
|
-
value
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
end
|
275
|
-
|
276
|
-
end
|
@@ -1,226 +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
|
-
# Response when register user is successful
|
15
|
-
class RedirectTokenandPin
|
16
|
-
attr_accessor :token
|
17
|
-
|
18
|
-
attr_accessor :pin
|
19
|
-
|
20
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
-
def self.attribute_map
|
22
|
-
{
|
23
|
-
:'token' => :'token',
|
24
|
-
:'pin' => :'pin'
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
# Returns all the JSON keys this model knows about
|
29
|
-
def self.acceptable_attributes
|
30
|
-
attribute_map.values
|
31
|
-
end
|
32
|
-
|
33
|
-
# Attribute type mapping.
|
34
|
-
def self.openapi_types
|
35
|
-
{
|
36
|
-
:'token' => :'String',
|
37
|
-
:'pin' => :'String'
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
# List of attributes with nullable: true
|
42
|
-
def self.openapi_nullable
|
43
|
-
Set.new([
|
44
|
-
])
|
45
|
-
end
|
46
|
-
|
47
|
-
# Initializes the object
|
48
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
-
def initialize(attributes = {})
|
50
|
-
if (!attributes.is_a?(Hash))
|
51
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::RedirectTokenandPin` initialize method"
|
52
|
-
end
|
53
|
-
|
54
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
55
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
56
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
57
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::RedirectTokenandPin`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
|
-
end
|
59
|
-
h[k.to_sym] = v
|
60
|
-
}
|
61
|
-
|
62
|
-
if attributes.key?(:'token')
|
63
|
-
self.token = attributes[:'token']
|
64
|
-
end
|
65
|
-
|
66
|
-
if attributes.key?(:'pin')
|
67
|
-
self.pin = attributes[:'pin']
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
72
|
-
# @return Array for valid properties with the reasons
|
73
|
-
def list_invalid_properties
|
74
|
-
invalid_properties = Array.new
|
75
|
-
invalid_properties
|
76
|
-
end
|
77
|
-
|
78
|
-
# Check to see if the all the properties in the model are valid
|
79
|
-
# @return true if the model is valid
|
80
|
-
def valid?
|
81
|
-
true
|
82
|
-
end
|
83
|
-
|
84
|
-
# Checks equality by comparing each attribute.
|
85
|
-
# @param [Object] Object to be compared
|
86
|
-
def ==(o)
|
87
|
-
return true if self.equal?(o)
|
88
|
-
self.class == o.class &&
|
89
|
-
token == o.token &&
|
90
|
-
pin == o.pin
|
91
|
-
end
|
92
|
-
|
93
|
-
# @see the `==` method
|
94
|
-
# @param [Object] Object to be compared
|
95
|
-
def eql?(o)
|
96
|
-
self == o
|
97
|
-
end
|
98
|
-
|
99
|
-
# Calculates hash code according to all attributes.
|
100
|
-
# @return [Integer] Hash code
|
101
|
-
def hash
|
102
|
-
[token, pin].hash
|
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 self.build_from_hash(attributes)
|
109
|
-
new.build_from_hash(attributes)
|
110
|
-
end
|
111
|
-
|
112
|
-
# Builds the object from hash
|
113
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
-
# @return [Object] Returns the model itself
|
115
|
-
def build_from_hash(attributes)
|
116
|
-
return nil unless attributes.is_a?(Hash)
|
117
|
-
attributes = attributes.transform_keys(&:to_sym)
|
118
|
-
self.class.openapi_types.each_pair do |key, type|
|
119
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
120
|
-
self.send("#{key}=", nil)
|
121
|
-
elsif type =~ /\AArray<(.*)>/i
|
122
|
-
# check to ensure the input is an array given that the attribute
|
123
|
-
# is documented as an array but the input is not
|
124
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
125
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
126
|
-
end
|
127
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
128
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
self
|
133
|
-
end
|
134
|
-
|
135
|
-
# Deserializes the data based on type
|
136
|
-
# @param string type Data type
|
137
|
-
# @param string value Value to be deserialized
|
138
|
-
# @return [Object] Deserialized data
|
139
|
-
def _deserialize(type, value)
|
140
|
-
case type.to_sym
|
141
|
-
when :Time
|
142
|
-
Time.parse(value)
|
143
|
-
when :Date
|
144
|
-
Date.parse(value)
|
145
|
-
when :String
|
146
|
-
value.to_s
|
147
|
-
when :Integer
|
148
|
-
value.to_i
|
149
|
-
when :Float
|
150
|
-
value.to_f
|
151
|
-
when :Boolean
|
152
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
153
|
-
true
|
154
|
-
else
|
155
|
-
false
|
156
|
-
end
|
157
|
-
when :Object
|
158
|
-
# generic object (usually a Hash), return directly
|
159
|
-
value
|
160
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
161
|
-
inner_type = Regexp.last_match[:inner_type]
|
162
|
-
value.map { |v| _deserialize(inner_type, v) }
|
163
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
164
|
-
k_type = Regexp.last_match[:k_type]
|
165
|
-
v_type = Regexp.last_match[:v_type]
|
166
|
-
{}.tap do |hash|
|
167
|
-
value.each do |k, v|
|
168
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
else # model
|
172
|
-
# models (e.g. Pet) or oneOf
|
173
|
-
klass = SnapTrade.const_get(type)
|
174
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
# Returns the string representation of the object
|
179
|
-
# @return [String] String presentation of the object
|
180
|
-
def to_s
|
181
|
-
to_hash.to_s
|
182
|
-
end
|
183
|
-
|
184
|
-
# to_body is an alias to to_hash (backward compatibility)
|
185
|
-
# @return [Hash] Returns the object in the form of hash
|
186
|
-
def to_body
|
187
|
-
to_hash
|
188
|
-
end
|
189
|
-
|
190
|
-
# Returns the object in the form of hash
|
191
|
-
# @return [Hash] Returns the object in the form of hash
|
192
|
-
def to_hash
|
193
|
-
hash = {}
|
194
|
-
self.class.attribute_map.each_pair do |attr, param|
|
195
|
-
value = self.send(attr)
|
196
|
-
if value.nil?
|
197
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
198
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
199
|
-
end
|
200
|
-
|
201
|
-
hash[param] = _to_hash(value)
|
202
|
-
end
|
203
|
-
hash
|
204
|
-
end
|
205
|
-
|
206
|
-
# Outputs non-array value in the form of hash
|
207
|
-
# For object, use to_hash. Otherwise, just return the value
|
208
|
-
# @param [Object] value Any valid value
|
209
|
-
# @return [Hash] Returns the value in the form of hash
|
210
|
-
def _to_hash(value)
|
211
|
-
if value.is_a?(Array)
|
212
|
-
value.compact.map { |v| _to_hash(v) }
|
213
|
-
elsif value.is_a?(Hash)
|
214
|
-
{}.tap do |hash|
|
215
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
-
end
|
217
|
-
elsif value.respond_to? :to_hash
|
218
|
-
value.to_hash
|
219
|
-
else
|
220
|
-
value
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
end
|
225
|
-
|
226
|
-
end
|