snaptrade 2.0.202 → 2.0.203

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 465ff00fc381a2aff4e1968639f51fe68d4ef766c61136a12ae53a9db7872bbe
4
- data.tar.gz: 52c42fbde3f7571d01d3aacca0ef918e0ef4de410cd938a548f65d6a837f6270
3
+ metadata.gz: 9f77d3fdd6c2da3eb12390d8016923ef9f55fc86e49e3aa876c10a8127e0b930
4
+ data.tar.gz: fd27b36f039da349f3b9cbdd6e60031c76f114ae59af66cad3f88c40816fa963
5
5
  SHA512:
6
- metadata.gz: 34132cc6ecdb7769ac692637410dfadd4cb3c0846f49516650c207e7a4676071b804d52a2c9f4d7fefdb8d49042ca14b7966109a4de96c1bb74cd1d387702085
7
- data.tar.gz: 327cce3d337e65342cf0401e96d1d083f2de04d97af9455c245056484f62cda3035fbd770c3034b1104383ba0f28ccd8f810afe99b7c2a3b0218df3b6201a055
6
+ metadata.gz: 4a633901ab0c7f13103b90a132617e839eecb2a0bae89c4263d97c26e899dfa0e1679668e96b1366f7e83900daf542fba02aa154146e113fe3aa87f9d561e009
7
+ data.tar.gz: '08298c673b9054c9161ce43bc048c3b9ac75ff2c6573b04b0c8299eebb4771a0e798090fdbd6fa93765027389915728b07238bd33ceca96c5022d3ed56e9e85a'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.202)
4
+ snaptrade (2.0.203)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v2.0.202-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.202)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.203-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.203)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -94,7 +94,7 @@ Connect brokerage accounts to your app for live positions and trading
94
94
  Add to Gemfile:
95
95
 
96
96
  ```ruby
97
- gem 'snaptrade', '~> 2.0.202'
97
+ gem 'snaptrade', '~> 2.0.203'
98
98
  ```
99
99
 
100
100
  ## Getting Started<a id="getting-started"></a>
@@ -1349,6 +1349,7 @@ This endpoint requires `userId` and `userSecret` in addition to the partner sign
1349
1349
  ```ruby
1350
1350
  result = snaptrade.experimental_endpoints.add_subscription(
1351
1351
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1352
+ check_interval_seconds: 300,
1352
1353
  user_id: "snaptrade-user-123",
1353
1354
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1354
1355
  )
@@ -1361,6 +1362,10 @@ p result
1361
1362
  Unique identifier for the connected brokerage account. This is the UUID used to
1362
1363
  reference the account in SnapTrade.
1363
1364
 
1365
+ ##### check_interval_seconds: `Integer`<a id="check_interval_seconds-integer"></a>
1366
+ How often the subscribed account should be checked for new trades. Must match an
1367
+ active Trade Detection plan.
1368
+
1364
1369
  ##### user_id: `String`<a id="user_id-string"></a>
1365
1370
  ##### user_secret: `String`<a id="user_secret-string"></a>
1366
1371
  #### 🔄 Return<a id="🔄-return"></a>
@@ -23,13 +23,15 @@ module SnapTrade
23
23
  # This endpoint requires `userId` and `userSecret` in addition to the partner signature.
24
24
  #
25
25
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
26
+ # @param check_interval_seconds [Integer] How often the subscribed account should be checked for new trades. Must match an active Trade Detection plan.
26
27
  # @param user_id [String]
27
28
  # @param user_secret [String]
28
29
  # @param body [TradeDetectionAddSubscriptionRequest]
29
30
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
30
- def add_subscription(account_id:, user_id:, user_secret:, extra: {})
31
+ def add_subscription(account_id:, check_interval_seconds:, user_id:, user_secret:, extra: {})
31
32
  _body = {}
32
33
  _body[:account_id] = account_id if account_id != SENTINEL
34
+ _body[:check_interval_seconds] = check_interval_seconds if check_interval_seconds != SENTINEL
33
35
  trade_detection_add_subscription_request = _body
34
36
  data, _status_code, _headers = add_subscription_with_http_info_impl(user_id, user_secret, trade_detection_add_subscription_request, extra)
35
37
  data
@@ -41,13 +43,15 @@ module SnapTrade
41
43
  # This endpoint requires `userId` and `userSecret` in addition to the partner signature.
42
44
  #
43
45
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
46
+ # @param check_interval_seconds [Integer] How often the subscribed account should be checked for new trades. Must match an active Trade Detection plan.
44
47
  # @param user_id [String]
45
48
  # @param user_secret [String]
46
49
  # @param body [TradeDetectionAddSubscriptionRequest]
47
50
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
48
- def add_subscription_with_http_info(account_id:, user_id:, user_secret:, extra: {})
51
+ def add_subscription_with_http_info(account_id:, check_interval_seconds:, user_id:, user_secret:, extra: {})
49
52
  _body = {}
50
53
  _body[:account_id] = account_id if account_id != SENTINEL
54
+ _body[:check_interval_seconds] = check_interval_seconds if check_interval_seconds != SENTINEL
51
55
  trade_detection_add_subscription_request = _body
52
56
  add_subscription_with_http_info_impl(user_id, user_secret, trade_detection_add_subscription_request, extra)
53
57
  end
@@ -141,13 +145,13 @@ module SnapTrade
141
145
  # This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
142
146
  #
143
147
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
144
- # @param body [TradeDetectionAddSubscriptionRequest]
148
+ # @param body [TradeDetectionCancelSubscriptionRequest]
145
149
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
146
150
  def cancel_subscription(account_id:, extra: {})
147
151
  _body = {}
148
152
  _body[:account_id] = account_id if account_id != SENTINEL
149
- trade_detection_add_subscription_request = _body
150
- data, _status_code, _headers = cancel_subscription_with_http_info_impl(trade_detection_add_subscription_request, extra)
153
+ trade_detection_cancel_subscription_request = _body
154
+ data, _status_code, _headers = cancel_subscription_with_http_info_impl(trade_detection_cancel_subscription_request, extra)
151
155
  data
152
156
  end
153
157
 
@@ -157,37 +161,37 @@ module SnapTrade
157
161
  # This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
158
162
  #
159
163
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
160
- # @param body [TradeDetectionAddSubscriptionRequest]
164
+ # @param body [TradeDetectionCancelSubscriptionRequest]
161
165
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
162
166
  def cancel_subscription_with_http_info(account_id:, extra: {})
163
167
  _body = {}
164
168
  _body[:account_id] = account_id if account_id != SENTINEL
165
- trade_detection_add_subscription_request = _body
166
- cancel_subscription_with_http_info_impl(trade_detection_add_subscription_request, extra)
169
+ trade_detection_cancel_subscription_request = _body
170
+ cancel_subscription_with_http_info_impl(trade_detection_cancel_subscription_request, extra)
167
171
  end
168
172
 
169
173
  # Cancel a Trade Detection subscription
170
174
  # Cancels a Trade Detection subscription for a connected brokerage account. This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
171
- # @param trade_detection_add_subscription_request [TradeDetectionAddSubscriptionRequest]
175
+ # @param trade_detection_cancel_subscription_request [TradeDetectionCancelSubscriptionRequest]
172
176
  # @param [Hash] opts the optional parameters
173
177
  # @return [TradeDetectionCancelSubscriptionResponse]
174
- private def cancel_subscription_impl(trade_detection_add_subscription_request, opts = {})
175
- data, _status_code, _headers = cancel_subscription_with_http_info(trade_detection_add_subscription_request, opts)
178
+ private def cancel_subscription_impl(trade_detection_cancel_subscription_request, opts = {})
179
+ data, _status_code, _headers = cancel_subscription_with_http_info(trade_detection_cancel_subscription_request, opts)
176
180
  data
177
181
  end
178
182
 
179
183
  # Cancel a Trade Detection subscription
180
184
  # Cancels a Trade Detection subscription for a connected brokerage account. This endpoint requires partner signature authentication only and does not require &#x60;userId&#x60; or &#x60;userSecret&#x60;.
181
- # @param trade_detection_add_subscription_request [TradeDetectionAddSubscriptionRequest]
185
+ # @param trade_detection_cancel_subscription_request [TradeDetectionCancelSubscriptionRequest]
182
186
  # @param [Hash] opts the optional parameters
183
187
  # @return [Array<(TradeDetectionCancelSubscriptionResponse, Integer, Hash)>] TradeDetectionCancelSubscriptionResponse data, response status code and response headers
184
- private def cancel_subscription_with_http_info_impl(trade_detection_add_subscription_request, opts = {})
188
+ private def cancel_subscription_with_http_info_impl(trade_detection_cancel_subscription_request, opts = {})
185
189
  if @api_client.config.debugging
186
190
  @api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.cancel_subscription ...'
187
191
  end
188
- # verify the required parameter 'trade_detection_add_subscription_request' is set
189
- if @api_client.config.client_side_validation && trade_detection_add_subscription_request.nil?
190
- fail ArgumentError, "Missing the required parameter 'trade_detection_add_subscription_request' when calling ExperimentalEndpointsApi.cancel_subscription"
192
+ # verify the required parameter 'trade_detection_cancel_subscription_request' is set
193
+ if @api_client.config.client_side_validation && trade_detection_cancel_subscription_request.nil?
194
+ fail ArgumentError, "Missing the required parameter 'trade_detection_cancel_subscription_request' when calling ExperimentalEndpointsApi.cancel_subscription"
191
195
  end
192
196
  # resource path
193
197
  local_var_path = '/snapTrade/tradeDetection/subscriptions/cancel'
@@ -209,7 +213,7 @@ module SnapTrade
209
213
  form_params = opts[:form_params] || {}
210
214
 
211
215
  # http body (model)
212
- post_body = opts[:debug_body] || @api_client.object_to_http_body(trade_detection_add_subscription_request)
216
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(trade_detection_cancel_subscription_request)
213
217
 
214
218
  # return_type
215
219
  return_type = opts[:debug_return_type] || 'TradeDetectionCancelSubscriptionResponse'
@@ -16,10 +16,13 @@ module SnapTrade
16
16
  # Positions returned for the request.
17
17
  attr_accessor :results
18
18
 
19
+ attr_accessor :data_freshness
20
+
19
21
  # Attribute mapping from ruby-style variable name to JSON key.
20
22
  def self.attribute_map
21
23
  {
22
- :'results' => :'results'
24
+ :'results' => :'results',
25
+ :'data_freshness' => :'data_freshness'
23
26
  }
24
27
  end
25
28
 
@@ -31,7 +34,8 @@ module SnapTrade
31
34
  # Attribute type mapping.
32
35
  def self.openapi_types
33
36
  {
34
- :'results' => :'Array<AccountPosition>'
37
+ :'results' => :'Array<AccountPosition>',
38
+ :'data_freshness' => :'AllAccountPositionsResponseDataFreshness'
35
39
  }
36
40
  end
37
41
 
@@ -61,6 +65,10 @@ module SnapTrade
61
65
  self.results = value
62
66
  end
63
67
  end
68
+
69
+ if attributes.key?(:'data_freshness')
70
+ self.data_freshness = attributes[:'data_freshness']
71
+ end
64
72
  end
65
73
 
66
74
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -71,6 +79,10 @@ module SnapTrade
71
79
  invalid_properties.push('invalid value for "results", results cannot be nil.')
72
80
  end
73
81
 
82
+ if @data_freshness.nil?
83
+ invalid_properties.push('invalid value for "data_freshness", data_freshness cannot be nil.')
84
+ end
85
+
74
86
  invalid_properties
75
87
  end
76
88
 
@@ -78,6 +90,7 @@ module SnapTrade
78
90
  # @return true if the model is valid
79
91
  def valid?
80
92
  return false if @results.nil?
93
+ return false if @data_freshness.nil?
81
94
  true
82
95
  end
83
96
 
@@ -86,7 +99,8 @@ module SnapTrade
86
99
  def ==(o)
87
100
  return true if self.equal?(o)
88
101
  self.class == o.class &&
89
- results == o.results
102
+ results == o.results &&
103
+ data_freshness == o.data_freshness
90
104
  end
91
105
 
92
106
  # @see the `==` method
@@ -98,7 +112,7 @@ module SnapTrade
98
112
  # Calculates hash code according to all attributes.
99
113
  # @return [Integer] Hash code
100
114
  def hash
101
- [results].hash
115
+ [results, data_freshness].hash
102
116
  end
103
117
 
104
118
  # Builds the object from hash
@@ -0,0 +1,223 @@
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
+ # Metadata describing freshness of the returned positions data.
15
+ class AllAccountPositionsResponseDataFreshness
16
+ # The time the returned positions data was fetched from the brokerage.
17
+ attr_accessor :as_of
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'as_of' => :'as_of'
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
+ :'as_of' => :'Time'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AllAccountPositionsResponseDataFreshness` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AllAccountPositionsResponseDataFreshness`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'as_of')
60
+ self.as_of = attributes[:'as_of']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ if @as_of.nil?
69
+ invalid_properties.push('invalid value for "as_of", as_of cannot be nil.')
70
+ end
71
+
72
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return false if @as_of.nil?
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ as_of == o.as_of
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Integer] Hash code
98
+ def hash
99
+ [as_of].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def self.build_from_hash(attributes)
106
+ new.build_from_hash(attributes)
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = SnapTrade.const_get(type)
171
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -15,10 +15,14 @@ module SnapTrade
15
15
  # Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
16
16
  attr_accessor :account_id
17
17
 
18
+ # How often the subscribed account should be checked for new trades. Must match an active Trade Detection plan.
19
+ attr_accessor :check_interval_seconds
20
+
18
21
  # Attribute mapping from ruby-style variable name to JSON key.
19
22
  def self.attribute_map
20
23
  {
21
- :'account_id' => :'account_id'
24
+ :'account_id' => :'account_id',
25
+ :'check_interval_seconds' => :'check_interval_seconds'
22
26
  }
23
27
  end
24
28
 
@@ -30,7 +34,8 @@ module SnapTrade
30
34
  # Attribute type mapping.
31
35
  def self.openapi_types
32
36
  {
33
- :'account_id' => :'String'
37
+ :'account_id' => :'String',
38
+ :'check_interval_seconds' => :'Integer'
34
39
  }
35
40
  end
36
41
 
@@ -58,6 +63,10 @@ module SnapTrade
58
63
  if attributes.key?(:'account_id')
59
64
  self.account_id = attributes[:'account_id']
60
65
  end
66
+
67
+ if attributes.key?(:'check_interval_seconds')
68
+ self.check_interval_seconds = attributes[:'check_interval_seconds']
69
+ end
61
70
  end
62
71
 
63
72
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -68,6 +77,14 @@ module SnapTrade
68
77
  invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
69
78
  end
70
79
 
80
+ if @check_interval_seconds.nil?
81
+ invalid_properties.push('invalid value for "check_interval_seconds", check_interval_seconds cannot be nil.')
82
+ end
83
+
84
+ if @check_interval_seconds < 1
85
+ invalid_properties.push('invalid value for "check_interval_seconds", must be greater than or equal to 1.')
86
+ end
87
+
71
88
  invalid_properties
72
89
  end
73
90
 
@@ -75,15 +92,32 @@ module SnapTrade
75
92
  # @return true if the model is valid
76
93
  def valid?
77
94
  return false if @account_id.nil?
95
+ return false if @check_interval_seconds.nil?
96
+ return false if @check_interval_seconds < 1
78
97
  true
79
98
  end
80
99
 
100
+ # Custom attribute writer method with validation
101
+ # @param [Object] check_interval_seconds Value to be assigned
102
+ def check_interval_seconds=(check_interval_seconds)
103
+ if check_interval_seconds.nil?
104
+ fail ArgumentError, 'check_interval_seconds cannot be nil'
105
+ end
106
+
107
+ if check_interval_seconds < 1
108
+ fail ArgumentError, 'invalid value for "check_interval_seconds", must be greater than or equal to 1.'
109
+ end
110
+
111
+ @check_interval_seconds = check_interval_seconds
112
+ end
113
+
81
114
  # Checks equality by comparing each attribute.
82
115
  # @param [Object] Object to be compared
83
116
  def ==(o)
84
117
  return true if self.equal?(o)
85
118
  self.class == o.class &&
86
- account_id == o.account_id
119
+ account_id == o.account_id &&
120
+ check_interval_seconds == o.check_interval_seconds
87
121
  end
88
122
 
89
123
  # @see the `==` method
@@ -95,7 +129,7 @@ module SnapTrade
95
129
  # Calculates hash code according to all attributes.
96
130
  # @return [Integer] Hash code
97
131
  def hash
98
- [account_id].hash
132
+ [account_id, check_interval_seconds].hash
99
133
  end
100
134
 
101
135
  # Builds the object from hash
@@ -0,0 +1,222 @@
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 TradeDetectionCancelSubscriptionRequest
15
+ # Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
16
+ attr_accessor :account_id
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'account_id' => :'account_id'
22
+ }
23
+ end
24
+
25
+ # Returns all the JSON keys this model knows about
26
+ def self.acceptable_attributes
27
+ attribute_map.values
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'account_id' => :'String'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradeDetectionCancelSubscriptionRequest` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradeDetectionCancelSubscriptionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'account_id')
59
+ self.account_id = attributes[:'account_id']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ if @account_id.nil?
68
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
69
+ end
70
+
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return false if @account_id.nil?
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ account_id == o.account_id
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [account_id].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ self.class.openapi_types.each_pair do |key, type|
115
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
116
+ self.send("#{key}=", nil)
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :Time
138
+ Time.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :Boolean
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ # models (e.g. Pet) or oneOf
169
+ klass = SnapTrade.const_get(type)
170
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.202'
11
+ VERSION = '2.0.203'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -51,6 +51,7 @@ require 'snaptrade/models/action_strict_with_options'
51
51
  require 'snaptrade/models/adr_instrument'
52
52
  require 'snaptrade/models/adr_instrument_kind'
53
53
  require 'snaptrade/models/all_account_positions_response'
54
+ require 'snaptrade/models/all_account_positions_response_data_freshness'
54
55
  require 'snaptrade/models/auth_type'
55
56
  require 'snaptrade/models/authentication_login_snap_trade_user200_response'
56
57
  require 'snaptrade/models/balance'
@@ -206,6 +207,7 @@ require 'snaptrade/models/tax_lot'
206
207
  require 'snaptrade/models/time_in_force_strict'
207
208
  require 'snaptrade/models/timeframe'
208
209
  require 'snaptrade/models/trade_detection_add_subscription_request'
210
+ require 'snaptrade/models/trade_detection_cancel_subscription_request'
209
211
  require 'snaptrade/models/trade_detection_cancel_subscription_response'
210
212
  require 'snaptrade/models/trade_detection_subscription'
211
213
  require 'snaptrade/models/trading_instrument'
@@ -44,7 +44,7 @@ describe 'ExperimentalEndpointsApi' do
44
44
  # unit tests for cancel_subscription
45
45
  # Cancel a Trade Detection subscription
46
46
  # Cancels a Trade Detection subscription for a connected brokerage account. This endpoint requires partner signature authentication only and does not require &#x60;userId&#x60; or &#x60;userSecret&#x60;.
47
- # @param trade_detection_add_subscription_request
47
+ # @param trade_detection_cancel_subscription_request
48
48
  # @param [Hash] opts the optional parameters
49
49
  # @return [TradeDetectionCancelSubscriptionResponse]
50
50
  describe 'cancel_subscription test' do
@@ -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::AllAccountPositionsResponseDataFreshness
15
+ describe SnapTrade::AllAccountPositionsResponseDataFreshness do
16
+ let(:instance) { SnapTrade::AllAccountPositionsResponseDataFreshness.new }
17
+
18
+ describe 'test an instance of AllAccountPositionsResponseDataFreshness' do
19
+ it 'should create an instance of AllAccountPositionsResponseDataFreshness' do
20
+ expect(instance).to be_instance_of(SnapTrade::AllAccountPositionsResponseDataFreshness)
21
+ end
22
+ end
23
+ describe 'test attribute "as_of"' 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
@@ -26,4 +26,10 @@ describe SnapTrade::AllAccountPositionsResponse do
26
26
  end
27
27
  end
28
28
 
29
+ describe 'test attribute "data_freshness"' 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
+
29
35
  end
@@ -26,4 +26,10 @@ describe SnapTrade::TradeDetectionAddSubscriptionRequest do
26
26
  end
27
27
  end
28
28
 
29
+ describe 'test attribute "check_interval_seconds"' 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
+
29
35
  end
@@ -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::TradeDetectionCancelSubscriptionRequest
15
+ describe SnapTrade::TradeDetectionCancelSubscriptionRequest do
16
+ let(:instance) { SnapTrade::TradeDetectionCancelSubscriptionRequest.new }
17
+
18
+ describe 'test an instance of TradeDetectionCancelSubscriptionRequest' do
19
+ it 'should create an instance of TradeDetectionCancelSubscriptionRequest' do
20
+ expect(instance).to be_instance_of(SnapTrade::TradeDetectionCancelSubscriptionRequest)
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
+ 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: 2.0.202
4
+ version: 2.0.203
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-03 00:00:00.000000000 Z
11
+ date: 2026-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -131,6 +131,7 @@ files:
131
131
  - lib/snaptrade/models/adr_instrument.rb
132
132
  - lib/snaptrade/models/adr_instrument_kind.rb
133
133
  - lib/snaptrade/models/all_account_positions_response.rb
134
+ - lib/snaptrade/models/all_account_positions_response_data_freshness.rb
134
135
  - lib/snaptrade/models/auth_type.rb
135
136
  - lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb
136
137
  - lib/snaptrade/models/balance.rb
@@ -286,6 +287,7 @@ files:
286
287
  - lib/snaptrade/models/time_in_force_strict.rb
287
288
  - lib/snaptrade/models/timeframe.rb
288
289
  - lib/snaptrade/models/trade_detection_add_subscription_request.rb
290
+ - lib/snaptrade/models/trade_detection_cancel_subscription_request.rb
289
291
  - lib/snaptrade/models/trade_detection_cancel_subscription_response.rb
290
292
  - lib/snaptrade/models/trade_detection_subscription.rb
291
293
  - lib/snaptrade/models/trading_instrument.rb
@@ -352,6 +354,7 @@ files:
352
354
  - spec/models/action_strict_with_options_spec.rb
353
355
  - spec/models/adr_instrument_kind_spec.rb
354
356
  - spec/models/adr_instrument_spec.rb
357
+ - spec/models/all_account_positions_response_data_freshness_spec.rb
355
358
  - spec/models/all_account_positions_response_spec.rb
356
359
  - spec/models/auth_type_spec.rb
357
360
  - spec/models/authentication_login_snap_trade_user200_response_spec.rb
@@ -508,6 +511,7 @@ files:
508
511
  - spec/models/time_in_force_strict_spec.rb
509
512
  - spec/models/timeframe_spec.rb
510
513
  - spec/models/trade_detection_add_subscription_request_spec.rb
514
+ - spec/models/trade_detection_cancel_subscription_request_spec.rb
511
515
  - spec/models/trade_detection_cancel_subscription_response_spec.rb
512
516
  - spec/models/trade_detection_subscription_spec.rb
513
517
  - spec/models/trading_instrument_spec.rb
@@ -624,7 +628,9 @@ test_files:
624
628
  - spec/models/account_order_record_child_brokerage_order_ids_spec.rb
625
629
  - spec/models/brokerage_authorization_type_read_only_type_spec.rb
626
630
  - spec/models/model403_feature_not_enabled_response_spec.rb
631
+ - spec/models/all_account_positions_response_data_freshness_spec.rb
627
632
  - spec/models/account_order_record_universal_symbol_spec.rb
633
+ - spec/models/trade_detection_cancel_subscription_request_spec.rb
628
634
  - spec/models/account_order_record_spec.rb
629
635
  - spec/models/crypto_order_form_type_spec.rb
630
636
  - spec/models/encrypted_response_spec.rb