snaptrade 2.0.24 → 2.0.26

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: 1972714969f69805cc22e43f640774a439dfa47616884f4b499e954629a2e794
4
- data.tar.gz: 2a1c839688235913f4a11ae234c4a0f1cb8f67dfebdc45871dc965fbb7644d58
3
+ metadata.gz: 6f02b2217951a3d74e760540092af444a44f291d8318004701f0c6599b8035c9
4
+ data.tar.gz: d3d184ef83654c23e494d33f5a9e4117a8894acc3d169221917beee56e418305
5
5
  SHA512:
6
- metadata.gz: 3ea0918d1207fd6addc2b0591cc3e969104b882ef029533ca540a8c955f6f60d382125d5e114c21583b079dfa0af8802878a5196b5c71110e820c5c55361d3c7
7
- data.tar.gz: c160f91c727da185a9c78b6bb1eaf639c601184c0f72fa9d3ab68f7fb015d0a714be98a98f4d0a8e8da4f5f1804aaa7fbbb276461eb9ca9a64bfb16cf64497ea
6
+ metadata.gz: 79bf35d54c567ac3d10cc5976fb1e59d446ea9e7c589f3a613abdb486605544feca1d22ab769cd9253eac9cde711f20d3943ba007ad5b0582e8515f49499fe67
7
+ data.tar.gz: d2d863e7c308480c36c0dfe5b1801c85e39a6a967ed1f0221fd2e485fdc52a94bb1dbc8705e03fa921ebe417035ff8d77a9288cc5a636908687e83342db28045
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.24)
4
+ snaptrade (2.0.25)
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.24-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.24)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.26-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.26)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -35,6 +35,7 @@ Connect brokerage accounts to your app for live positions and trading
35
35
  * [`snaptrade.authentication.register_snap_trade_user`](#snaptradeauthenticationregister_snap_trade_user)
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
+ * [`snaptrade.connections.disable_brokerage_authorization`](#snaptradeconnectionsdisable_brokerage_authorization)
38
39
  * [`snaptrade.connections.list_brokerage_authorizations`](#snaptradeconnectionslist_brokerage_authorizations)
39
40
  * [`snaptrade.connections.refresh_brokerage_authorization`](#snaptradeconnectionsrefresh_brokerage_authorization)
40
41
  * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
@@ -70,7 +71,7 @@ Connect brokerage accounts to your app for live positions and trading
70
71
  Add to Gemfile:
71
72
 
72
73
  ```ruby
73
- gem 'snaptrade', '~> 2.0.24'
74
+ gem 'snaptrade', '~> 2.0.26'
74
75
  ```
75
76
 
76
77
  ## Getting Started<a id="getting-started"></a>
@@ -680,6 +681,41 @@ The ID of a brokerage authorization object.
680
681
  ---
681
682
 
682
683
 
684
+ ### `snaptrade.connections.disable_brokerage_authorization`<a id="snaptradeconnectionsdisable_brokerage_authorization"></a>
685
+
686
+ Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
687
+
688
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
689
+
690
+ ```ruby
691
+ result = snaptrade.connections.disable_brokerage_authorization(
692
+ authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
693
+ user_id: "snaptrade-user-123",
694
+ user_secret: "USERSECRET123",
695
+ )
696
+ p result
697
+ ```
698
+
699
+ #### ⚙️ Parameters<a id="⚙️-parameters"></a>
700
+
701
+ ##### authorization_id: `String`<a id="authorization_id-string"></a>
702
+ The ID of a brokerage authorization object.
703
+
704
+ ##### user_id: `String`<a id="user_id-string"></a>
705
+ ##### user_secret: `String`<a id="user_secret-string"></a>
706
+ #### 🔄 Return<a id="🔄-return"></a>
707
+
708
+ [BrokerageAuthorizationDisabledConfirmation](./lib/snaptrade/models/brokerage_authorization_disabled_confirmation.rb)
709
+
710
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
711
+
712
+ `/authorizations/{authorizationId}/disable` `POST`
713
+
714
+ [🔙 **Back to Table of Contents**](#table-of-contents)
715
+
716
+ ---
717
+
718
+
683
719
  ### `snaptrade.connections.list_brokerage_authorizations`<a id="snaptradeconnectionslist_brokerage_authorizations"></a>
684
720
 
685
721
  Returns a list of Brokerage Authorization objects for the user
@@ -120,6 +120,109 @@ module SnapTrade
120
120
  end
121
121
 
122
122
 
123
+ # Manually disable a connection for testing
124
+ #
125
+ # Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
126
+ #
127
+ # @param authorization_id [String] The ID of a brokerage authorization object.
128
+ # @param user_id [String]
129
+ # @param user_secret [String]
130
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
131
+ def disable_brokerage_authorization(authorization_id:, user_id:, user_secret:, extra: {})
132
+ data, _status_code, _headers = disable_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, extra)
133
+ data
134
+ end
135
+
136
+ # Manually disable a connection for testing
137
+ #
138
+ # Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
139
+ #
140
+ # @param authorization_id [String] The ID of a brokerage authorization object.
141
+ # @param user_id [String]
142
+ # @param user_secret [String]
143
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
144
+ def disable_brokerage_authorization_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
145
+ disable_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, extra)
146
+ end
147
+
148
+ # Manually disable a connection for testing
149
+ # Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
150
+ # @param authorization_id [String] The ID of a brokerage authorization object.
151
+ # @param user_id [String]
152
+ # @param user_secret [String]
153
+ # @param [Hash] opts the optional parameters
154
+ # @return [BrokerageAuthorizationDisabledConfirmation]
155
+ private def disable_brokerage_authorization_impl(authorization_id, user_id, user_secret, opts = {})
156
+ data, _status_code, _headers = disable_brokerage_authorization_with_http_info(authorization_id, user_id, user_secret, opts)
157
+ data
158
+ end
159
+
160
+ # Manually disable a connection for testing
161
+ # Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
162
+ # @param authorization_id [String] The ID of a brokerage authorization object.
163
+ # @param user_id [String]
164
+ # @param user_secret [String]
165
+ # @param [Hash] opts the optional parameters
166
+ # @return [Array<(BrokerageAuthorizationDisabledConfirmation, Integer, Hash)>] BrokerageAuthorizationDisabledConfirmation data, response status code and response headers
167
+ private def disable_brokerage_authorization_with_http_info_impl(authorization_id, user_id, user_secret, opts = {})
168
+ if @api_client.config.debugging
169
+ @api_client.config.logger.debug 'Calling API: ConnectionsApi.disable_brokerage_authorization ...'
170
+ end
171
+ # verify the required parameter 'authorization_id' is set
172
+ if @api_client.config.client_side_validation && authorization_id.nil?
173
+ fail ArgumentError, "Missing the required parameter 'authorization_id' when calling ConnectionsApi.disable_brokerage_authorization"
174
+ end
175
+ # verify the required parameter 'user_id' is set
176
+ if @api_client.config.client_side_validation && user_id.nil?
177
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConnectionsApi.disable_brokerage_authorization"
178
+ end
179
+ # verify the required parameter 'user_secret' is set
180
+ if @api_client.config.client_side_validation && user_secret.nil?
181
+ fail ArgumentError, "Missing the required parameter 'user_secret' when calling ConnectionsApi.disable_brokerage_authorization"
182
+ end
183
+ # resource path
184
+ local_var_path = '/authorizations/{authorizationId}/disable'.sub('{' + 'authorizationId' + '}', CGI.escape(authorization_id.to_s))
185
+
186
+ # query parameters
187
+ query_params = opts[:query_params] || {}
188
+ query_params[:'userId'] = user_id
189
+ query_params[:'userSecret'] = user_secret
190
+
191
+ # header parameters
192
+ header_params = opts[:header_params] || {}
193
+ # HTTP header 'Accept' (if needed)
194
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
195
+
196
+ # form parameters
197
+ form_params = opts[:form_params] || {}
198
+
199
+ # http body (model)
200
+ post_body = opts[:debug_body]
201
+
202
+ # return_type
203
+ return_type = opts[:debug_return_type] || 'BrokerageAuthorizationDisabledConfirmation'
204
+
205
+ # auth_names
206
+ auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
207
+
208
+ new_options = opts.merge(
209
+ :operation => :"ConnectionsApi.disable_brokerage_authorization",
210
+ :header_params => header_params,
211
+ :query_params => query_params,
212
+ :form_params => form_params,
213
+ :body => post_body,
214
+ :auth_names => auth_names,
215
+ :return_type => return_type
216
+ )
217
+
218
+ data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
219
+ if @api_client.config.debugging
220
+ @api_client.config.logger.debug "API called: ConnectionsApi#disable_brokerage_authorization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
221
+ end
222
+ return data, status_code, headers, response
223
+ end
224
+
225
+
123
226
  # List all brokerage authorizations for the User
124
227
  #
125
228
  # Returns a list of Brokerage Authorization objects for the user
@@ -14,8 +14,10 @@ module SnapTrade
14
14
  class Brokerage
15
15
  attr_accessor :id
16
16
 
17
+ # Full name of the brokerage.
17
18
  attr_accessor :name
18
19
 
20
+ # A display-friendly name of the brokerage.
19
21
  attr_accessor :display_name
20
22
 
21
23
  attr_accessor :description
@@ -26,6 +28,7 @@ module SnapTrade
26
28
 
27
29
  attr_accessor :open_url
28
30
 
31
+ # A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change.
29
32
  attr_accessor :slug
30
33
 
31
34
  attr_accessor :url
@@ -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 BrokerageAuthorizationDisabledConfirmation
15
+ # Connection disabled confirmation
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::BrokerageAuthorizationDisabledConfirmation` 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::BrokerageAuthorizationDisabledConfirmation`. 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
@@ -14,10 +14,10 @@ module SnapTrade
14
14
  class BrokerageAuthorizationTypeReadOnlyBrokerage
15
15
  attr_accessor :id
16
16
 
17
- # Name of Brokerage
17
+ # Full name of the brokerage.
18
18
  attr_accessor :name
19
19
 
20
- # Slug of Brokerage. It is usually the name of the brokerage in capital letters
20
+ # A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change.
21
21
  attr_accessor :slug
22
22
 
23
23
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -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
+ # This connection is already disabled.
15
+ class Model402BrokerageAuthAlreadyDisabledException
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::Model402BrokerageAuthAlreadyDisabledException` 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::Model402BrokerageAuthAlreadyDisabledException`. 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
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.24'
11
+ VERSION = '2.0.26'
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_disabled_confirmation'
35
36
  require 'snaptrade/models/brokerage_authorization_refresh_confirmation'
36
37
  require 'snaptrade/models/brokerage_authorization_type'
37
38
  require 'snaptrade/models/brokerage_authorization_type_read_only'
@@ -66,6 +67,7 @@ require 'snaptrade/models/manual_trade_form_notional_value'
66
67
  require 'snaptrade/models/manual_trade_symbol'
67
68
  require 'snaptrade/models/model400_failed_request_response'
68
69
  require 'snaptrade/models/model401_failed_request_response'
70
+ require 'snaptrade/models/model402_brokerage_auth_already_disabled_exception'
69
71
  require 'snaptrade/models/model402_brokerage_auth_disabled_response'
70
72
  require 'snaptrade/models/model403_failed_request_response'
71
73
  require 'snaptrade/models/model403_feature_not_enabled_response'
@@ -41,6 +41,20 @@ describe 'ConnectionsApi' do
41
41
  end
42
42
  end
43
43
 
44
+ # unit tests for disable_brokerage_authorization
45
+ # Manually disable a connection for testing
46
+ # Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
47
+ # @param authorization_id The ID of a brokerage authorization object.
48
+ # @param user_id
49
+ # @param user_secret
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [BrokerageAuthorizationDisabledConfirmation]
52
+ describe 'disable_brokerage_authorization test' do
53
+ it 'should work' do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
44
58
  # unit tests for list_brokerage_authorizations
45
59
  # List all brokerage authorizations for the User
46
60
  # Returns a list of Brokerage Authorization objects for the user
@@ -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::BrokerageAuthorizationDisabledConfirmation
15
+ describe SnapTrade::BrokerageAuthorizationDisabledConfirmation do
16
+ let(:instance) { SnapTrade::BrokerageAuthorizationDisabledConfirmation.new }
17
+
18
+ describe 'test an instance of BrokerageAuthorizationDisabledConfirmation' do
19
+ it 'should create an instance of BrokerageAuthorizationDisabledConfirmation' do
20
+ expect(instance).to be_instance_of(SnapTrade::BrokerageAuthorizationDisabledConfirmation)
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::Model402BrokerageAuthAlreadyDisabledException
15
+ describe SnapTrade::Model402BrokerageAuthAlreadyDisabledException do
16
+ let(:instance) { SnapTrade::Model402BrokerageAuthAlreadyDisabledException.new }
17
+
18
+ describe 'test an instance of Model402BrokerageAuthAlreadyDisabledException' do
19
+ it 'should create an instance of Model402BrokerageAuthAlreadyDisabledException' do
20
+ expect(instance).to be_instance_of(SnapTrade::Model402BrokerageAuthAlreadyDisabledException)
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
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.24
4
+ version: 2.0.26
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-20 00:00:00.000000000 Z
11
+ date: 2024-06-27 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_disabled_confirmation.rb
114
115
  - lib/snaptrade/models/brokerage_authorization_refresh_confirmation.rb
115
116
  - lib/snaptrade/models/brokerage_authorization_type.rb
116
117
  - lib/snaptrade/models/brokerage_authorization_type_read_only.rb
@@ -145,6 +146,7 @@ files:
145
146
  - lib/snaptrade/models/manual_trade_symbol.rb
146
147
  - lib/snaptrade/models/model400_failed_request_response.rb
147
148
  - lib/snaptrade/models/model401_failed_request_response.rb
149
+ - lib/snaptrade/models/model402_brokerage_auth_already_disabled_exception.rb
148
150
  - lib/snaptrade/models/model402_brokerage_auth_disabled_response.rb
149
151
  - lib/snaptrade/models/model403_failed_request_response.rb
150
152
  - lib/snaptrade/models/model403_feature_not_enabled_response.rb
@@ -260,6 +262,7 @@ files:
260
262
  - spec/models/auth_type_spec.rb
261
263
  - spec/models/authentication_login_snap_trade_user200_response_spec.rb
262
264
  - spec/models/balance_spec.rb
265
+ - spec/models/brokerage_authorization_disabled_confirmation_spec.rb
263
266
  - spec/models/brokerage_authorization_refresh_confirmation_spec.rb
264
267
  - spec/models/brokerage_authorization_spec.rb
265
268
  - spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb
@@ -296,6 +299,7 @@ files:
296
299
  - spec/models/manual_trade_symbol_spec.rb
297
300
  - spec/models/model400_failed_request_response_spec.rb
298
301
  - spec/models/model401_failed_request_response_spec.rb
302
+ - spec/models/model402_brokerage_auth_already_disabled_exception_spec.rb
299
303
  - spec/models/model402_brokerage_auth_disabled_response_spec.rb
300
304
  - spec/models/model403_failed_request_response_spec.rb
301
305
  - spec/models/model403_feature_not_enabled_response_spec.rb
@@ -434,6 +438,7 @@ test_files:
434
438
  - spec/models/exchange_rate_pairs_spec.rb
435
439
  - spec/models/user_settings_spec.rb
436
440
  - spec/models/portfolio_group_info_spec.rb
441
+ - spec/models/brokerage_authorization_disabled_confirmation_spec.rb
437
442
  - spec/models/account_order_record_spec.rb
438
443
  - spec/models/manual_trade_spec.rb
439
444
  - spec/models/model400_failed_request_response_spec.rb
@@ -447,6 +452,7 @@ test_files:
447
452
  - spec/models/sub_period_return_rate_spec.rb
448
453
  - spec/models/monthly_dividends_spec.rb
449
454
  - spec/models/model_portfolio_security_spec.rb
455
+ - spec/models/model402_brokerage_auth_already_disabled_exception_spec.rb
450
456
  - spec/models/account_balance_total_spec.rb
451
457
  - spec/models/strategy_order_place_spec.rb
452
458
  - spec/models/model_asset_class_target_spec.rb