snaptrade 2.0.22 → 2.0.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca9f4fb79ccef521a81f2574d9cec36c7f620677bff1f425a8e659e029e223f5
4
- data.tar.gz: 784ea7b28f4ba1616de6300cc5af74aeb68e437b4c5012a048bacfd1b51abbe6
3
+ metadata.gz: 78be9220e71d2500da395e0c580190dc48202e134fb2340ba1ff69f4b38fc774
4
+ data.tar.gz: ccbbd494512272fecb0c894f72c4a0b4101a15172f4fb10919167c5ee169055d
5
5
  SHA512:
6
- metadata.gz: d547cb4e6bcd229bd76bc4d652479c379c79d1c1145d21f376706b42c3385382e488fa06ce1660f9403554daaa943551ddaeaf9b10c2dbcdd84357d12c8e9945
7
- data.tar.gz: c5033f916bef6cf4d96ef23289cc32ce39d4ab562f124c9b42f63d122986769b25b716041b6c2961ca409a91c3501e35ea899acacd6f1e159729d88b03b64dbd
6
+ metadata.gz: a797f328841f7fa481c1a05c562a63d27f443738aa74a685bb4a6c64f7c3a6fa495abadc2b501dae54cd3d98a21fa788d36cabaebdde8f8344779797d095fb63
7
+ data.tar.gz: 06e0e87b861f77e1e2419258a9b22eb8c4847dd7d2a7e40033e4924eda42a8cd75abe09d6398fea05300f71233a578e73c9058d67874086393d1528948ded437
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.22-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.22)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.23-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.23)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -36,6 +36,7 @@ Connect brokerage accounts to your app for live positions and trading
36
36
  * [`snaptrade.authentication.reset_snap_trade_user_secret`](#snaptradeauthenticationreset_snap_trade_user_secret)
37
37
  * [`snaptrade.connections.detail_brokerage_authorization`](#snaptradeconnectionsdetail_brokerage_authorization)
38
38
  * [`snaptrade.connections.list_brokerage_authorizations`](#snaptradeconnectionslist_brokerage_authorizations)
39
+ * [`snaptrade.connections.refresh_brokerage_authorization`](#snaptradeconnectionsrefresh_brokerage_authorization)
39
40
  * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
40
41
  * [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
41
42
  * [`snaptrade.options.get_option_strategy`](#snaptradeoptionsget_option_strategy)
@@ -69,7 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
69
70
  Add to Gemfile:
70
71
 
71
72
  ```ruby
72
- gem 'snaptrade', '~> 2.0.22'
73
+ gem 'snaptrade', '~> 2.0.23'
73
74
  ```
74
75
 
75
76
  ## Getting Started<a id="getting-started"></a>
@@ -710,6 +711,41 @@ p result
710
711
  ---
711
712
 
712
713
 
714
+ ### `snaptrade.connections.refresh_brokerage_authorization`<a id="snaptradeconnectionsrefresh_brokerage_authorization"></a>
715
+
716
+ Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
717
+
718
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
719
+
720
+ ```ruby
721
+ result = snaptrade.connections.refresh_brokerage_authorization(
722
+ authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
723
+ user_id: "snaptrade-user-123",
724
+ user_secret: "USERSECRET123",
725
+ )
726
+ p result
727
+ ```
728
+
729
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
730
+
731
+ ##### authorization_id: `String`<a id="authorization_id-string"></a>
732
+ The ID of a brokerage authorization object.
733
+
734
+ ##### user_id: `String`<a id="user_id-string"></a>
735
+ ##### user_secret: `String`<a id="user_secret-string"></a>
736
+ #### 🔄 Return<a id="🔄-return"></a>
737
+
738
+ [BrokerageAuthorizationRefreshConfirmation](./lib/snaptrade/models/brokerage_authorization_refresh_confirmation.rb)
739
+
740
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
741
+
742
+ `/authorizations/{authorizationId}/refresh` `POST`
743
+
744
+ [🔙 **Back to Table of Contents**](#table-of-contents)
745
+
746
+ ---
747
+
748
+
713
749
  ### `snaptrade.connections.remove_brokerage_authorization`<a id="snaptradeconnectionsremove_brokerage_authorization"></a>
714
750
 
715
751
  Deletes a specified brokerage authorization given by the ID.
@@ -215,6 +215,109 @@ module SnapTrade
215
215
  end
216
216
 
217
217
 
218
+ # Refresh holdings for a connection
219
+ #
220
+ # Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
221
+ #
222
+ # @param authorization_id [String] The ID of a brokerage authorization object.
223
+ # @param user_id [String]
224
+ # @param user_secret [String]
225
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
226
+ def refresh_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {})
227
+ data, _status_code, _headers = refresh_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, extra)
228
+ data
229
+ end
230
+
231
+ # Refresh holdings for a connection
232
+ #
233
+ # Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
234
+ #
235
+ # @param authorization_id [String] The ID of a brokerage authorization object.
236
+ # @param user_id [String]
237
+ # @param user_secret [String]
238
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
239
+ def refresh_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
240
+ refresh_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, extra)
241
+ end
242
+
243
+ # Refresh holdings for a connection
244
+ # Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
245
+ # @param authorization_id [String] The ID of a brokerage authorization object.
246
+ # @param user_id [String]
247
+ # @param user_secret [String]
248
+ # @param [Hash] opts the optional parameters
249
+ # @return [BrokerageAuthorizationRefreshConfirmation]
250
+ private def refresh_brokerage_authorization_impl(authorization_id, user_id, user_secret, opts = {})
251
+ data, _status_code, _headers = refresh_brokerage_authorization_with_http_info(authorization_id, user_id, user_secret, opts)
252
+ data
253
+ end
254
+
255
+ # Refresh holdings for a connection
256
+ # Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
257
+ # @param authorization_id [String] The ID of a brokerage authorization object.
258
+ # @param user_id [String]
259
+ # @param user_secret [String]
260
+ # @param [Hash] opts the optional parameters
261
+ # @return [Array<(BrokerageAuthorizationRefreshConfirmation, Integer, Hash)>] BrokerageAuthorizationRefreshConfirmation data, response status code and response headers
262
+ private def refresh_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, opts = {})
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug 'Calling API: ConnectionsApi.refresh_brokerage_authorization ...'
265
+ end
266
+ # verify the required parameter 'authorization_id' is set
267
+ if @api_client.config.client_side_validation && authorization_id.nil?
268
+ fail ArgumentError, "Missing the required parameter 'authorization_id' when calling ConnectionsApi.refresh_brokerage_authorization"
269
+ end
270
+ # verify the required parameter 'user_id' is set
271
+ if @api_client.config.client_side_validation && user_id.nil?
272
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConnectionsApi.refresh_brokerage_authorization"
273
+ end
274
+ # verify the required parameter 'user_secret' is set
275
+ if @api_client.config.client_side_validation && user_secret.nil?
276
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ConnectionsApi.refresh_brokerage_authorization"
277
+ end
278
+ # resource path
279
+ local_var_path = '/authorizations/{authorizationId}/refresh'.sub('{' + 'authorizationId' + '}', CGI.escape(authorization_id.to_s))
280
+
281
+ # query parameters
282
+ query_params = opts[:query_params] || {}
283
+ query_params[:'userId'] = user_id
284
+ query_params[:'userSecret'] = user_secret
285
+
286
+ # header parameters
287
+ header_params = opts[:header_params] || {}
288
+ # HTTP header 'Accept' (if needed)
289
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
290
+
291
+ # form parameters
292
+ form_params = opts[:form_params] || {}
293
+
294
+ # http body (model)
295
+ post_body = opts[:debug_body]
296
+
297
+ # return_type
298
+ return_type = opts[:debug_return_type] || 'BrokerageAuthorizationRefreshConfirmation'
299
+
300
+ # auth_names
301
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
302
+
303
+ new_options = opts.merge(
304
+ :operation => :"ConnectionsApi.refresh_brokerage_authorization",
305
+ :header_params => header_params,
306
+ :query_params => query_params,
307
+ :form_params => form_params,
308
+ :body => post_body,
309
+ :auth_names => auth_names,
310
+ :return_type => return_type
311
+ )
312
+
313
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
314
+ if @api_client.config.debugging
315
+ @api_client.config.logger.debug "API called: ConnectionsApi#refresh_brokerage_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
316
+ end
317
+ return data, status_code, headers, response
318
+ end
319
+
320
+
218
321
  # Delete brokerage authorization
219
322
  #
220
323
  # Deletes a specified brokerage authorization given by the ID.
@@ -0,0 +1,217 @@
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 BrokerageAuthorizationRefreshConfirmation
15
+ # Refresh confirmation details
16
+ attr_accessor :detail
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'detail' => :'detail'
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
+ :'detail' => :'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::BrokerageAuthorizationRefreshConfirmation` 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::BrokerageAuthorizationRefreshConfirmation`. 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?(:'detail')
59
+ self.detail = attributes[:'detail']
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
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ detail == o.detail
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Integer] Hash code
92
+ def hash
93
+ [detail].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def self.build_from_hash(attributes)
100
+ new.build_from_hash(attributes)
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ attributes = attributes.transform_keys(&:to_sym)
109
+ self.class.openapi_types.each_pair do |key, type|
110
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
111
+ self.send("#{key}=", nil)
112
+ elsif type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = SnapTrade.const_get(type)
165
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,228 @@
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
+ # Cannot perform action because connection is disabled
15
+ class Model402BrokerageAuthDisabledResponse
16
+ attr_accessor :detail
17
+
18
+ attr_accessor :code
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'detail' => :'detail',
24
+ :'code' => :'code'
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
+ :'detail' => :'Object',
37
+ :'code' => :'Object'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ :'detail',
45
+ :'code'
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::Model402BrokerageAuthDisabledResponse` 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::Model402BrokerageAuthDisabledResponse`. 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?(:'detail')
65
+ self.detail = attributes[:'detail']
66
+ end
67
+
68
+ if attributes.key?(:'code')
69
+ self.code = attributes[:'code']
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
+ detail == o.detail &&
92
+ code == o.code
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
+ [detail, code].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
@@ -0,0 +1,228 @@
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
+ # Example for failed request response
15
+ class Model403FeatureNotEnabledResponse
16
+ attr_accessor :detail
17
+
18
+ attr_accessor :default_code
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'detail' => :'detail',
24
+ :'default_code' => :'default_code'
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
+ :'detail' => :'Object',
37
+ :'default_code' => :'Object'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ :'detail',
45
+ :'default_code'
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::Model403FeatureNotEnabledResponse` 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::Model403FeatureNotEnabledResponse`. 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?(:'detail')
65
+ self.detail = attributes[:'detail']
66
+ end
67
+
68
+ if attributes.key?(:'default_code')
69
+ self.default_code = attributes[:'default_code']
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
+ detail == o.detail &&
92
+ default_code == o.default_code
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
+ [detail, default_code].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
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.22'
11
+ VERSION = '2.0.23'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -32,6 +32,7 @@ require 'snaptrade/models/authentication_login_snap_trade_user200_response'
32
32
  require 'snaptrade/models/balance'
33
33
  require 'snaptrade/models/brokerage'
34
34
  require 'snaptrade/models/brokerage_authorization'
35
+ require 'snaptrade/models/brokerage_authorization_refresh_confirmation'
35
36
  require 'snaptrade/models/brokerage_authorization_type'
36
37
  require 'snaptrade/models/brokerage_authorization_type_read_only'
37
38
  require 'snaptrade/models/brokerage_authorization_type_read_only_brokerage'
@@ -65,7 +66,9 @@ require 'snaptrade/models/manual_trade_form_notional_value'
65
66
  require 'snaptrade/models/manual_trade_symbol'
66
67
  require 'snaptrade/models/model400_failed_request_response'
67
68
  require 'snaptrade/models/model401_failed_request_response'
69
+ require 'snaptrade/models/model402_brokerage_auth_disabled_response'
68
70
  require 'snaptrade/models/model403_failed_request_response'
71
+ require 'snaptrade/models/model403_feature_not_enabled_response'
69
72
  require 'snaptrade/models/model404_failed_request_response'
70
73
  require 'snaptrade/models/model500_unexpected_exception_response'
71
74
  require 'snaptrade/models/model_asset_class'
@@ -54,6 +54,20 @@ describe 'ConnectionsApi' do
54
54
  end
55
55
  end
56
56
 
57
+ # unit tests for refresh_brokerage_authorization
58
+ # Refresh holdings for a connection
59
+ # Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
60
+ # @param authorization_id The ID of a brokerage authorization object.
61
+ # @param user_id
62
+ # @param user_secret
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [BrokerageAuthorizationRefreshConfirmation]
65
+ describe 'refresh_brokerage_authorization test' 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
+
57
71
  # unit tests for remove_brokerage_authorization
58
72
  # Delete brokerage authorization
59
73
  # Deletes a specified brokerage authorization given by the ID.
@@ -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::BrokerageAuthorizationRefreshConfirmation
15
+ describe SnapTrade::BrokerageAuthorizationRefreshConfirmation do
16
+ let(:instance) { SnapTrade::BrokerageAuthorizationRefreshConfirmation.new }
17
+
18
+ describe 'test an instance of BrokerageAuthorizationRefreshConfirmation' do
19
+ it 'should create an instance of BrokerageAuthorizationRefreshConfirmation' do
20
+ expect(instance).to be_instance_of(SnapTrade::BrokerageAuthorizationRefreshConfirmation)
21
+ end
22
+ end
23
+ describe 'test attribute "detail"' 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,35 @@
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::Model402BrokerageAuthDisabledResponse
15
+ describe SnapTrade::Model402BrokerageAuthDisabledResponse do
16
+ let(:instance) { SnapTrade::Model402BrokerageAuthDisabledResponse.new }
17
+
18
+ describe 'test an instance of Model402BrokerageAuthDisabledResponse' do
19
+ it 'should create an instance of Model402BrokerageAuthDisabledResponse' do
20
+ expect(instance).to be_instance_of(SnapTrade::Model402BrokerageAuthDisabledResponse)
21
+ end
22
+ end
23
+ describe 'test attribute "detail"' 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 "code"' 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
@@ -0,0 +1,35 @@
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::Model403FeatureNotEnabledResponse
15
+ describe SnapTrade::Model403FeatureNotEnabledResponse do
16
+ let(:instance) { SnapTrade::Model403FeatureNotEnabledResponse.new }
17
+
18
+ describe 'test an instance of Model403FeatureNotEnabledResponse' do
19
+ it 'should create an instance of Model403FeatureNotEnabledResponse' do
20
+ expect(instance).to be_instance_of(SnapTrade::Model403FeatureNotEnabledResponse)
21
+ end
22
+ end
23
+ describe 'test attribute "detail"' 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 "default_code"' 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
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.22
4
+ version: 2.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-11 00:00:00.000000000 Z
11
+ date: 2024-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -111,6 +111,7 @@ files:
111
111
  - lib/snaptrade/models/balance.rb
112
112
  - lib/snaptrade/models/brokerage.rb
113
113
  - lib/snaptrade/models/brokerage_authorization.rb
114
+ - lib/snaptrade/models/brokerage_authorization_refresh_confirmation.rb
114
115
  - lib/snaptrade/models/brokerage_authorization_type.rb
115
116
  - lib/snaptrade/models/brokerage_authorization_type_read_only.rb
116
117
  - lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb
@@ -144,7 +145,9 @@ files:
144
145
  - lib/snaptrade/models/manual_trade_symbol.rb
145
146
  - lib/snaptrade/models/model400_failed_request_response.rb
146
147
  - lib/snaptrade/models/model401_failed_request_response.rb
148
+ - lib/snaptrade/models/model402_brokerage_auth_disabled_response.rb
147
149
  - lib/snaptrade/models/model403_failed_request_response.rb
150
+ - lib/snaptrade/models/model403_feature_not_enabled_response.rb
148
151
  - lib/snaptrade/models/model404_failed_request_response.rb
149
152
  - lib/snaptrade/models/model500_unexpected_exception_response.rb
150
153
  - lib/snaptrade/models/model_asset_class.rb
@@ -256,6 +259,7 @@ files:
256
259
  - spec/models/auth_type_spec.rb
257
260
  - spec/models/authentication_login_snap_trade_user200_response_spec.rb
258
261
  - spec/models/balance_spec.rb
262
+ - spec/models/brokerage_authorization_refresh_confirmation_spec.rb
259
263
  - spec/models/brokerage_authorization_spec.rb
260
264
  - spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb
261
265
  - spec/models/brokerage_authorization_type_read_only_spec.rb
@@ -291,7 +295,9 @@ files:
291
295
  - spec/models/manual_trade_symbol_spec.rb
292
296
  - spec/models/model400_failed_request_response_spec.rb
293
297
  - spec/models/model401_failed_request_response_spec.rb
298
+ - spec/models/model402_brokerage_auth_disabled_response_spec.rb
294
299
  - spec/models/model403_failed_request_response_spec.rb
300
+ - spec/models/model403_feature_not_enabled_response_spec.rb
295
301
  - spec/models/model404_failed_request_response_spec.rb
296
302
  - spec/models/model500_unexpected_exception_response_spec.rb
297
303
  - spec/models/model_asset_class_details_spec.rb
@@ -421,6 +427,7 @@ test_files:
421
427
  - spec/models/brokerage_authorization_spec.rb
422
428
  - spec/models/balance_spec.rb
423
429
  - spec/models/exchange_spec.rb
430
+ - spec/models/model403_feature_not_enabled_response_spec.rb
424
431
  - spec/models/brokerage_symbol_spec.rb
425
432
  - spec/models/exchange_rate_pairs_spec.rb
426
433
  - spec/models/user_settings_spec.rb
@@ -519,11 +526,13 @@ test_files:
519
526
  - spec/models/target_asset_spec.rb
520
527
  - spec/models/user_i_dand_secret_spec.rb
521
528
  - spec/models/strategy_order_place_orders_inner_legs_inner_spec.rb
529
+ - spec/models/brokerage_authorization_refresh_confirmation_spec.rb
522
530
  - spec/models/us_exchange_spec.rb
523
531
  - spec/models/trade_spec.rb
524
532
  - spec/models/model_portfolio_asset_class_spec.rb
525
533
  - spec/models/option_chain_inner_spec.rb
526
534
  - spec/models/option_leg_spec.rb
535
+ - spec/models/model402_brokerage_auth_disabled_response_spec.rb
527
536
  - spec/models/model401_failed_request_response_spec.rb
528
537
  - spec/models/brokerage_symbol_symbol_spec.rb
529
538
  - spec/models/partner_data_spec.rb