snaptrade 2.0.13 → 2.0.14

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: cc2507038827738383521f845dbd09159a69d60f2766b5484dc154d382e8b3b6
4
- data.tar.gz: 7368b3b57fc67a3324201f3a93631bc01066ea05df3bb93ef32e041f82a12275
3
+ metadata.gz: d69100af3ddccd0b4ebc3e450fb12537b5e65804065a23bf3bea6b56a510e5e4
4
+ data.tar.gz: '098cc493628b24843ba17c4afb17377b28442e7a6f3b912e1af2d2ac91e14736'
5
5
  SHA512:
6
- metadata.gz: 9931aa4eeac1dd06189db61d6e0b386c793da02e15eab73f93741b0c9b840cde5da3eaceb816ab196c715edf62e5757c07ac08047238bd0046e8122e59f6be39
7
- data.tar.gz: b5a236327938c1201c0d3bf56c5d96b84ae3549f729e9faa62b16570bde1d849d2abb8893deef7c8b6b7c0f0c561fbb7a78079d6ce852e0fbeb7bd45b7804169
6
+ metadata.gz: 06b6ff75ff7ab965faecf2913bf75cc4416cdf3699ee1320da20308869d15fb219df378da81a0fb5a1dcc227f05c603acc6d2f158162ecf2d93d01e8ed77bfd4
7
+ data.tar.gz: faa04bfceb6951514d3d3fd3b84ce07265c7c8dbc1f39b792239a92e92a871f48b5d727b5aff483a4e0232be673419197b2201d7d06288f3ebee5b03c19c814b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.13)
4
+ snaptrade (2.0.14)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
@@ -9,42 +9,40 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  ast (2.4.2)
12
- base64 (0.1.1)
13
12
  byebug (11.1.3)
14
13
  coderay (1.1.3)
15
14
  debug (1.8.0)
16
15
  irb (>= 1.5.0)
17
16
  reline (>= 0.3.1)
18
17
  diff-lcs (1.5.0)
19
- faraday (2.7.11)
20
- base64
21
- faraday-net_http (>= 2.0, < 3.1)
22
- ruby2_keywords (>= 0.0.4)
18
+ faraday (2.9.0)
19
+ faraday-net_http (>= 2.0, < 3.2)
23
20
  faraday-multipart (1.0.4)
24
21
  multipart-post (~> 2)
25
- faraday-net_http (3.0.2)
22
+ faraday-net_http (3.1.0)
23
+ net-http
26
24
  io-console (0.6.0)
27
25
  irb (1.6.4)
28
26
  reline (>= 0.3.0)
29
27
  method_source (1.0.0)
30
- multipart-post (2.3.0)
28
+ multipart-post (2.4.0)
29
+ net-http (0.4.1)
30
+ uri
31
31
  parallel (1.23.0)
32
- parser (3.2.2.3)
32
+ parser (3.2.2.1)
33
33
  ast (~> 2.4.1)
34
- racc
35
34
  pry (0.14.2)
36
35
  coderay (~> 1.1)
37
36
  method_source (~> 1.0)
38
37
  pry-byebug (3.10.1)
39
38
  byebug (~> 11.0)
40
39
  pry (>= 0.13, < 0.15)
41
- racc (1.7.1)
42
40
  rainbow (3.1.1)
43
41
  rake (13.0.6)
44
- regexp_parser (2.8.1)
45
- reline (0.3.8)
42
+ regexp_parser (2.8.0)
43
+ reline (0.3.4)
46
44
  io-console (~> 0.5)
47
- rexml (3.2.6)
45
+ rexml (3.2.5)
48
46
  rspec (3.12.0)
49
47
  rspec-core (~> 3.12.0)
50
48
  rspec-expectations (~> 3.12.0)
@@ -54,10 +52,10 @@ GEM
54
52
  rspec-expectations (3.12.3)
55
53
  diff-lcs (>= 1.2.0, < 2.0)
56
54
  rspec-support (~> 3.12.0)
57
- rspec-mocks (3.12.6)
55
+ rspec-mocks (3.12.5)
58
56
  diff-lcs (>= 1.2.0, < 2.0)
59
57
  rspec-support (~> 3.12.0)
60
- rspec-support (3.12.1)
58
+ rspec-support (3.12.0)
61
59
  rubocop (1.12.1)
62
60
  parallel (~> 1.10)
63
61
  parser (>= 3.0.0.0)
@@ -67,14 +65,14 @@ GEM
67
65
  rubocop-ast (>= 1.2.0, < 2.0)
68
66
  ruby-progressbar (~> 1.7)
69
67
  unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.29.0)
68
+ rubocop-ast (1.28.1)
71
69
  parser (>= 3.2.1.0)
72
70
  ruby-progressbar (1.13.0)
73
- ruby2_keywords (0.0.5)
74
71
  unicode-display_width (2.4.2)
72
+ uri (0.13.0)
75
73
 
76
74
  PLATFORMS
77
- arm64-darwin-22
75
+ arm64-darwin-21
78
76
 
79
77
  DEPENDENCIES
80
78
  debug (~> 1.8)
@@ -86,4 +84,4 @@ DEPENDENCIES
86
84
  snaptrade!
87
85
 
88
86
  BUNDLED WITH
89
- 2.4.19
87
+ 2.3.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.13-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.13)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.14-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.14)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -70,7 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
70
70
  Add to Gemfile:
71
71
 
72
72
  ```ruby
73
- gem 'snaptrade', '~> 2.0.13'
73
+ gem 'snaptrade', '~> 2.0.14'
74
74
  ```
75
75
 
76
76
  ## Getting Started<a id="getting-started"></a>
@@ -30,6 +30,8 @@ module SnapTrade
30
30
 
31
31
  attr_accessor :figi_code
32
32
 
33
+ attr_accessor :figi_instrument
34
+
33
35
  # Attribute mapping from ruby-style variable name to JSON key.
34
36
  def self.attribute_map
35
37
  {
@@ -41,7 +43,8 @@ module SnapTrade
41
43
  :'exchange' => :'exchange',
42
44
  :'type' => :'type',
43
45
  :'currencies' => :'currencies',
44
- :'figi_code' => :'figi_code'
46
+ :'figi_code' => :'figi_code',
47
+ :'figi_instrument' => :'figi_instrument'
45
48
  }
46
49
  end
47
50
 
@@ -61,7 +64,8 @@ module SnapTrade
61
64
  :'exchange' => :'Exchange',
62
65
  :'type' => :'SecurityType',
63
66
  :'currencies' => :'Array<Currency>',
64
- :'figi_code' => :'String'
67
+ :'figi_code' => :'String',
68
+ :'figi_instrument' => :'SymbolFigiInstrument'
65
69
  }
66
70
  end
67
71
 
@@ -69,7 +73,8 @@ module SnapTrade
69
73
  def self.openapi_nullable
70
74
  Set.new([
71
75
  :'description',
72
- :'figi_code'
76
+ :'figi_code',
77
+ :'figi_instrument'
73
78
  ])
74
79
  end
75
80
 
@@ -132,6 +137,10 @@ module SnapTrade
132
137
  if attributes.key?(:'figi_code')
133
138
  self.figi_code = attributes[:'figi_code']
134
139
  end
140
+
141
+ if attributes.key?(:'figi_instrument')
142
+ self.figi_instrument = attributes[:'figi_instrument']
143
+ end
135
144
  end
136
145
 
137
146
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -190,7 +199,8 @@ module SnapTrade
190
199
  exchange == o.exchange &&
191
200
  type == o.type &&
192
201
  currencies == o.currencies &&
193
- figi_code == o.figi_code
202
+ figi_code == o.figi_code &&
203
+ figi_instrument == o.figi_instrument
194
204
  end
195
205
 
196
206
  # @see the `==` method
@@ -202,7 +212,7 @@ module SnapTrade
202
212
  # Calculates hash code according to all attributes.
203
213
  # @return [Integer] Hash code
204
214
  def hash
205
- [id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code].hash
215
+ [id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code, figi_instrument].hash
206
216
  end
207
217
 
208
218
  # Builds the object from hash
@@ -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
+ # Open FIGI Identifiers
15
+ class FigiInstrument
16
+ attr_accessor :figi_code
17
+
18
+ attr_accessor :figi_share_class
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'figi_code' => :'figi_code',
24
+ :'figi_share_class' => :'figi_share_class'
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
+ :'figi_code' => :'String',
37
+ :'figi_share_class' => :'String'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ :'figi_code',
45
+ :'figi_share_class'
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::FigiInstrument` 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::FigiInstrument`. 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?(:'figi_code')
65
+ self.figi_code = attributes[:'figi_code']
66
+ end
67
+
68
+ if attributes.key?(:'figi_share_class')
69
+ self.figi_share_class = attributes[:'figi_share_class']
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
+ figi_code == o.figi_code &&
92
+ figi_share_class == o.figi_share_class
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
+ [figi_code, figi_share_class].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
@@ -29,6 +29,8 @@ module SnapTrade
29
29
 
30
30
  attr_accessor :figi_code
31
31
 
32
+ attr_accessor :figi_instrument
33
+
32
34
  # Attribute mapping from ruby-style variable name to JSON key.
33
35
  def self.attribute_map
34
36
  {
@@ -39,7 +41,8 @@ module SnapTrade
39
41
  :'currency' => :'currency',
40
42
  :'exchange' => :'exchange',
41
43
  :'type' => :'type',
42
- :'figi_code' => :'figi_code'
44
+ :'figi_code' => :'figi_code',
45
+ :'figi_instrument' => :'figi_instrument'
43
46
  }
44
47
  end
45
48
 
@@ -58,14 +61,16 @@ module SnapTrade
58
61
  :'currency' => :'Currency',
59
62
  :'exchange' => :'Exchange',
60
63
  :'type' => :'SecurityType',
61
- :'figi_code' => :'String'
64
+ :'figi_code' => :'String',
65
+ :'figi_instrument' => :'SymbolFigiInstrument'
62
66
  }
63
67
  end
64
68
 
65
69
  # List of attributes with nullable: true
66
70
  def self.openapi_nullable
67
71
  Set.new([
68
- :'figi_code'
72
+ :'figi_code',
73
+ :'figi_instrument'
69
74
  ])
70
75
  end
71
76
 
@@ -115,6 +120,10 @@ module SnapTrade
115
120
  if attributes.key?(:'figi_code')
116
121
  self.figi_code = attributes[:'figi_code']
117
122
  end
123
+
124
+ if attributes.key?(:'figi_instrument')
125
+ self.figi_instrument = attributes[:'figi_instrument']
126
+ end
118
127
  end
119
128
 
120
129
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -142,7 +151,8 @@ module SnapTrade
142
151
  currency == o.currency &&
143
152
  exchange == o.exchange &&
144
153
  type == o.type &&
145
- figi_code == o.figi_code
154
+ figi_code == o.figi_code &&
155
+ figi_instrument == o.figi_instrument
146
156
  end
147
157
 
148
158
  # @see the `==` method
@@ -154,7 +164,7 @@ module SnapTrade
154
164
  # Calculates hash code according to all attributes.
155
165
  # @return [Integer] Hash code
156
166
  def hash
157
- [id, symbol, raw_symbol, name, currency, exchange, type, figi_code].hash
167
+ [id, symbol, raw_symbol, name, currency, exchange, type, figi_code, figi_instrument].hash
158
168
  end
159
169
 
160
170
  # Builds the object from hash
@@ -0,0 +1,234 @@
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 SymbolFigiInstrument
15
+ attr_accessor :figi_code
16
+
17
+ attr_accessor :figi_share_class
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'figi_code' => :'figi_code',
23
+ :'figi_share_class' => :'figi_share_class'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'figi_code' => :'String',
36
+ :'figi_share_class' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ :'figi_code',
44
+ :'figi_share_class'
45
+ ])
46
+ end
47
+
48
+ # List of class defined in allOf (OpenAPI v3)
49
+ def self.openapi_all_of
50
+ [
51
+ :'FigiInstrument'
52
+ ]
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::SymbolFigiInstrument` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::SymbolFigiInstrument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'figi_code')
71
+ self.figi_code = attributes[:'figi_code']
72
+ end
73
+
74
+ if attributes.key?(:'figi_share_class')
75
+ self.figi_share_class = attributes[:'figi_share_class']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ figi_code == o.figi_code &&
98
+ figi_share_class == o.figi_share_class
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [figi_code, figi_share_class].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = SnapTrade.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -29,6 +29,8 @@ module SnapTrade
29
29
 
30
30
  attr_accessor :figi_code
31
31
 
32
+ attr_accessor :figi_instrument
33
+
32
34
  # Attribute mapping from ruby-style variable name to JSON key.
33
35
  def self.attribute_map
34
36
  {
@@ -39,7 +41,8 @@ module SnapTrade
39
41
  :'exchange' => :'exchange',
40
42
  :'type' => :'type',
41
43
  :'currencies' => :'currencies',
42
- :'figi_code' => :'figi_code'
44
+ :'figi_code' => :'figi_code',
45
+ :'figi_instrument' => :'figi_instrument'
43
46
  }
44
47
  end
45
48
 
@@ -58,7 +61,8 @@ module SnapTrade
58
61
  :'exchange' => :'USExchange',
59
62
  :'type' => :'SecurityType',
60
63
  :'currencies' => :'Array<Currency>',
61
- :'figi_code' => :'String'
64
+ :'figi_code' => :'String',
65
+ :'figi_instrument' => :'SymbolFigiInstrument'
62
66
  }
63
67
  end
64
68
 
@@ -66,7 +70,8 @@ module SnapTrade
66
70
  def self.openapi_nullable
67
71
  Set.new([
68
72
  :'description',
69
- :'figi_code'
73
+ :'figi_code',
74
+ :'figi_instrument'
70
75
  ])
71
76
  end
72
77
 
@@ -118,6 +123,10 @@ module SnapTrade
118
123
  if attributes.key?(:'figi_code')
119
124
  self.figi_code = attributes[:'figi_code']
120
125
  end
126
+
127
+ if attributes.key?(:'figi_instrument')
128
+ self.figi_instrument = attributes[:'figi_instrument']
129
+ end
121
130
  end
122
131
 
123
132
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -145,7 +154,8 @@ module SnapTrade
145
154
  exchange == o.exchange &&
146
155
  type == o.type &&
147
156
  currencies == o.currencies &&
148
- figi_code == o.figi_code
157
+ figi_code == o.figi_code &&
158
+ figi_instrument == o.figi_instrument
149
159
  end
150
160
 
151
161
  # @see the `==` method
@@ -157,7 +167,7 @@ module SnapTrade
157
167
  # Calculates hash code according to all attributes.
158
168
  # @return [Integer] Hash code
159
169
  def hash
160
- [id, symbol, description, currency, exchange, type, currencies, figi_code].hash
170
+ [id, symbol, description, currency, exchange, type, currencies, figi_code, figi_instrument].hash
161
171
  end
162
172
 
163
173
  # Builds the object from hash
@@ -31,6 +31,8 @@ module SnapTrade
31
31
 
32
32
  attr_accessor :figi_code
33
33
 
34
+ attr_accessor :figi_instrument
35
+
34
36
  # Attribute mapping from ruby-style variable name to JSON key.
35
37
  def self.attribute_map
36
38
  {
@@ -42,7 +44,8 @@ module SnapTrade
42
44
  :'exchange' => :'exchange',
43
45
  :'type' => :'type',
44
46
  :'currencies' => :'currencies',
45
- :'figi_code' => :'figi_code'
47
+ :'figi_code' => :'figi_code',
48
+ :'figi_instrument' => :'figi_instrument'
46
49
  }
47
50
  end
48
51
 
@@ -62,7 +65,8 @@ module SnapTrade
62
65
  :'exchange' => :'Exchange',
63
66
  :'type' => :'SecurityType',
64
67
  :'currencies' => :'Array<Currency>',
65
- :'figi_code' => :'String'
68
+ :'figi_code' => :'String',
69
+ :'figi_instrument' => :'SymbolFigiInstrument'
66
70
  }
67
71
  end
68
72
 
@@ -70,7 +74,8 @@ module SnapTrade
70
74
  def self.openapi_nullable
71
75
  Set.new([
72
76
  :'description',
73
- :'figi_code'
77
+ :'figi_code',
78
+ :'figi_instrument'
74
79
  ])
75
80
  end
76
81
 
@@ -126,6 +131,10 @@ module SnapTrade
126
131
  if attributes.key?(:'figi_code')
127
132
  self.figi_code = attributes[:'figi_code']
128
133
  end
134
+
135
+ if attributes.key?(:'figi_instrument')
136
+ self.figi_instrument = attributes[:'figi_instrument']
137
+ end
129
138
  end
130
139
 
131
140
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -184,7 +193,8 @@ module SnapTrade
184
193
  exchange == o.exchange &&
185
194
  type == o.type &&
186
195
  currencies == o.currencies &&
187
- figi_code == o.figi_code
196
+ figi_code == o.figi_code &&
197
+ figi_instrument == o.figi_instrument
188
198
  end
189
199
 
190
200
  # @see the `==` method
@@ -196,7 +206,7 @@ module SnapTrade
196
206
  # Calculates hash code according to all attributes.
197
207
  # @return [Integer] Hash code
198
208
  def hash
199
- [id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code].hash
209
+ [id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code, figi_instrument].hash
200
210
  end
201
211
 
202
212
  # Builds the object from hash
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.13'
11
+ VERSION = '2.0.14'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -54,6 +54,7 @@ require 'snaptrade/models/encrypted_response_encrypted_message_data'
54
54
  require 'snaptrade/models/exchange'
55
55
  require 'snaptrade/models/exchange_rate_pairs'
56
56
  require 'snaptrade/models/excluded_asset'
57
+ require 'snaptrade/models/figi_instrument'
57
58
  require 'snaptrade/models/jwt'
58
59
  require 'snaptrade/models/login_redirect_uri'
59
60
  require 'snaptrade/models/manual_trade'
@@ -125,6 +126,7 @@ require 'snaptrade/models/strategy_quotes_greek'
125
126
  require 'snaptrade/models/strategy_type'
126
127
  require 'snaptrade/models/sub_period_return_rate'
127
128
  require 'snaptrade/models/symbol'
129
+ require 'snaptrade/models/symbol_figi_instrument'
128
130
  require 'snaptrade/models/symbol_query'
129
131
  require 'snaptrade/models/symbols_quotes_inner'
130
132
  require 'snaptrade/models/target_asset'
@@ -74,4 +74,10 @@ describe SnapTrade::BrokerageSymbolSymbol do
74
74
  end
75
75
  end
76
76
 
77
+ describe 'test attribute "figi_instrument"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
77
83
  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::FigiInstrument
15
+ describe SnapTrade::FigiInstrument do
16
+ let(:instance) { SnapTrade::FigiInstrument.new }
17
+
18
+ describe 'test an instance of FigiInstrument' do
19
+ it 'should create an instance of FigiInstrument' do
20
+ expect(instance).to be_instance_of(SnapTrade::FigiInstrument)
21
+ end
22
+ end
23
+ describe 'test attribute "figi_code"' 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 "figi_share_class"' 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::SymbolFigiInstrument
15
+ describe SnapTrade::SymbolFigiInstrument do
16
+ let(:instance) { SnapTrade::SymbolFigiInstrument.new }
17
+
18
+ describe 'test an instance of SymbolFigiInstrument' do
19
+ it 'should create an instance of SymbolFigiInstrument' do
20
+ expect(instance).to be_instance_of(SnapTrade::SymbolFigiInstrument)
21
+ end
22
+ end
23
+ describe 'test attribute "figi_code"' 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 "figi_share_class"' 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
@@ -68,4 +68,10 @@ describe SnapTrade::Symbol do
68
68
  end
69
69
  end
70
70
 
71
+ describe 'test attribute "figi_instrument"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
71
77
  end
@@ -68,4 +68,10 @@ describe SnapTrade::UnderlyingSymbol do
68
68
  end
69
69
  end
70
70
 
71
+ describe 'test attribute "figi_instrument"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
71
77
  end
@@ -74,4 +74,10 @@ describe SnapTrade::UniversalSymbol do
74
74
  end
75
75
  end
76
76
 
77
+ describe 'test attribute "figi_instrument"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
77
83
  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.13
4
+ version: 2.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-12 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -133,6 +133,7 @@ files:
133
133
  - lib/snaptrade/models/exchange.rb
134
134
  - lib/snaptrade/models/exchange_rate_pairs.rb
135
135
  - lib/snaptrade/models/excluded_asset.rb
136
+ - lib/snaptrade/models/figi_instrument.rb
136
137
  - lib/snaptrade/models/jwt.rb
137
138
  - lib/snaptrade/models/login_redirect_uri.rb
138
139
  - lib/snaptrade/models/manual_trade.rb
@@ -204,6 +205,7 @@ files:
204
205
  - lib/snaptrade/models/strategy_type.rb
205
206
  - lib/snaptrade/models/sub_period_return_rate.rb
206
207
  - lib/snaptrade/models/symbol.rb
208
+ - lib/snaptrade/models/symbol_figi_instrument.rb
207
209
  - lib/snaptrade/models/symbol_query.rb
208
210
  - lib/snaptrade/models/symbols_quotes_inner.rb
209
211
  - lib/snaptrade/models/target_asset.rb
@@ -276,6 +278,7 @@ files:
276
278
  - spec/models/exchange_rate_pairs_spec.rb
277
279
  - spec/models/exchange_spec.rb
278
280
  - spec/models/excluded_asset_spec.rb
281
+ - spec/models/figi_instrument_spec.rb
279
282
  - spec/models/jwt_spec.rb
280
283
  - spec/models/login_redirect_uri_spec.rb
281
284
  - spec/models/manual_trade_and_impact_spec.rb
@@ -346,6 +349,7 @@ files:
346
349
  - spec/models/strategy_quotes_spec.rb
347
350
  - spec/models/strategy_type_spec.rb
348
351
  - spec/models/sub_period_return_rate_spec.rb
352
+ - spec/models/symbol_figi_instrument_spec.rb
349
353
  - spec/models/symbol_query_spec.rb
350
354
  - spec/models/symbol_spec.rb
351
355
  - spec/models/symbols_quotes_inner_spec.rb
@@ -390,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
394
  - !ruby/object:Gem::Version
391
395
  version: '0'
392
396
  requirements: []
393
- rubygems_version: 3.4.10
397
+ rubygems_version: 3.3.7
394
398
  signing_key:
395
399
  specification_version: 4
396
400
  summary: SnapTrade Ruby Gem
@@ -490,6 +494,7 @@ test_files:
490
494
  - spec/models/status_spec.rb
491
495
  - spec/models/portfolio_group_position_spec.rb
492
496
  - spec/models/strategy_type_spec.rb
497
+ - spec/models/figi_instrument_spec.rb
493
498
  - spec/models/option_leg_action_spec.rb
494
499
  - spec/models/trade_impact_spec.rb
495
500
  - spec/models/symbol_query_spec.rb
@@ -525,6 +530,7 @@ test_files:
525
530
  - spec/models/model404_failed_request_response_spec.rb
526
531
  - spec/models/universal_activity_spec.rb
527
532
  - spec/models/manual_trade_form_spec.rb
533
+ - spec/models/symbol_figi_instrument_spec.rb
528
534
  - spec/models/performance_custom_spec.rb
529
535
  - spec/models/snap_trade_holdings_account_spec.rb
530
536
  - spec/models/portfolio_group_spec.rb