snaptrade 2.0.194 → 2.0.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,253 @@
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
+ # An active Trade Detection subscription for a brokerage account.
15
+ class TradeDetectionSubscription
16
+ # Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
17
+ attr_accessor :account_id
18
+
19
+ # Monthly subscription cost as a decimal string.
20
+ attr_accessor :cost
21
+
22
+ # How often the subscribed account is checked for new trades.
23
+ attr_accessor :check_interval_seconds
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'account_id' => :'account_id',
29
+ :'cost' => :'cost',
30
+ :'check_interval_seconds' => :'check_interval_seconds'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'account_id' => :'String',
43
+ :'cost' => :'String',
44
+ :'check_interval_seconds' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradeDetectionSubscription` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradeDetectionSubscription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'account_id')
70
+ self.account_id = attributes[:'account_id']
71
+ end
72
+
73
+ if attributes.key?(:'cost')
74
+ self.cost = attributes[:'cost']
75
+ end
76
+
77
+ if attributes.key?(:'check_interval_seconds')
78
+ self.check_interval_seconds = attributes[:'check_interval_seconds']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ if @account_id.nil?
87
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
88
+ end
89
+
90
+ if @cost.nil?
91
+ invalid_properties.push('invalid value for "cost", cost cannot be nil.')
92
+ end
93
+
94
+ if @check_interval_seconds.nil?
95
+ invalid_properties.push('invalid value for "check_interval_seconds", check_interval_seconds cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return false if @account_id.nil?
105
+ return false if @cost.nil?
106
+ return false if @check_interval_seconds.nil?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ account_id == o.account_id &&
116
+ cost == o.cost &&
117
+ check_interval_seconds == o.check_interval_seconds
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Integer] Hash code
128
+ def hash
129
+ [account_id, cost, check_interval_seconds].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def self.build_from_hash(attributes)
136
+ new.build_from_hash(attributes)
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ attributes = attributes.transform_keys(&:to_sym)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
147
+ self.send("#{key}=", nil)
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :Time
169
+ Time.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :Boolean
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ # models (e.g. Pet) or oneOf
200
+ klass = SnapTrade.const_get(type)
201
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.194'
11
+ VERSION = '2.0.196'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -205,6 +205,8 @@ require 'snaptrade/models/take_profit'
205
205
  require 'snaptrade/models/tax_lot'
206
206
  require 'snaptrade/models/time_in_force_strict'
207
207
  require 'snaptrade/models/timeframe'
208
+ require 'snaptrade/models/trade_detection_cancel_subscription_response'
209
+ require 'snaptrade/models/trade_detection_subscription'
208
210
  require 'snaptrade/models/trading_instrument'
209
211
  require 'snaptrade/models/trading_instrument_type'
210
212
  require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
@@ -227,7 +229,6 @@ require 'snaptrade/api/account_information_api'
227
229
  require 'snaptrade/api/api_status_api'
228
230
  require 'snaptrade/api/authentication_api'
229
231
  require 'snaptrade/api/connections_api'
230
- require 'snaptrade/api/experimental_endpoints_api'
231
232
  require 'snaptrade/api/options_api'
232
233
  require 'snaptrade/api/reference_data_api'
233
234
  require 'snaptrade/api/trading_api'
@@ -301,7 +302,6 @@ module SnapTrade
301
302
  attr_reader :api_status
302
303
  attr_reader :authentication
303
304
  attr_reader :connections
304
- attr_reader :experimental_endpoints
305
305
  attr_reader :options
306
306
  attr_reader :reference_data
307
307
  attr_reader :trading
@@ -313,7 +313,6 @@ module SnapTrade
313
313
  @api_status = SnapTrade::APIStatusApi.new(@api_client)
314
314
  @authentication = SnapTrade::AuthenticationApi.new(@api_client)
315
315
  @connections = SnapTrade::ConnectionsApi.new(@api_client)
316
- @experimental_endpoints = SnapTrade::ExperimentalEndpointsApi.new(@api_client)
317
316
  @options = SnapTrade::OptionsApi.new(@api_client)
318
317
  @reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
319
318
  @trading = SnapTrade::TradingApi.new(@api_client)
@@ -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::TradeDetectionCancelSubscriptionResponse
15
+ describe SnapTrade::TradeDetectionCancelSubscriptionResponse do
16
+ let(:instance) { SnapTrade::TradeDetectionCancelSubscriptionResponse.new }
17
+
18
+ describe 'test an instance of TradeDetectionCancelSubscriptionResponse' do
19
+ it 'should create an instance of TradeDetectionCancelSubscriptionResponse' do
20
+ expect(instance).to be_instance_of(SnapTrade::TradeDetectionCancelSubscriptionResponse)
21
+ end
22
+ end
23
+ describe 'test attribute "success"' 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
@@ -0,0 +1,41 @@
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::TradeDetectionSubscription
15
+ describe SnapTrade::TradeDetectionSubscription do
16
+ let(:instance) { SnapTrade::TradeDetectionSubscription.new }
17
+
18
+ describe 'test an instance of TradeDetectionSubscription' do
19
+ it 'should create an instance of TradeDetectionSubscription' do
20
+ expect(instance).to be_instance_of(SnapTrade::TradeDetectionSubscription)
21
+ end
22
+ end
23
+ describe 'test attribute "account_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 "cost"' 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 "check_interval_seconds"' 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
+ end