snaptrade 3.0.25 → 3.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: 20172866c5d0a5daa8062a75e53758ad384dfe93f0abf666618ae1549166b62f
4
- data.tar.gz: 359614f032575b7c6c9c9d74b871b73ea1d94990b50d28964403dcac368a4377
3
+ metadata.gz: e6d90e855f96cbd008caa69f70d3080bed33318902839e5cc89897ae74bf3fe1
4
+ data.tar.gz: c4fcc81059b739ad7b7fc3693541cf055f0e50a5e642b58bc8536c23ea198cd4
5
5
  SHA512:
6
- metadata.gz: 16f48f27245d49b46ed2065835614606d4bff5969b70657bc8f9fe861a5910d546c1fcc8076708524cda889ccf75e6df7654c8d1bbe27b78952d4ad662eab57e
7
- data.tar.gz: '0399ce4c03065daceda99088740abd89a51175e6ff2e9e8c750dcb28586d4b9886e371d8f4af70d52eac3b9906a1b11e4d2ae1e07631a42ad095226f62289120'
6
+ metadata.gz: 2a7d3d5d00874bdd136950039c86f10b9cafdd8816093ffe40eabdde50e25b3d846c0b8b01931057e4fc1a7352401b69addb917b93a9fc9eb1dd1de2184bba92
7
+ data.tar.gz: e0490b47de01ce9730a5f8db15ff11f0dac2ca9ace18c27ca356df48aa2a96b4b72507dc42e2bb8a0dc7e872bca4a7f6456b2615c5a91ce87f6f73299fdad36a
data/README.md CHANGED
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
63
63
  See https://docs.snaptrade.com/docs/ratelimiting.
64
64
 
65
65
 
66
- [![npm](https://img.shields.io/badge/gem-v3.0.25-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.25)
66
+ [![npm](https://img.shields.io/badge/gem-v3.0.26-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.26)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -116,6 +116,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
116
116
  * [`snaptrade.reference_data.list_all_brokerage_authorization_type`](#snaptradereference_datalist_all_brokerage_authorization_type)
117
117
  * [`snaptrade.reference_data.list_all_brokerage_instruments`](#snaptradereference_datalist_all_brokerage_instruments)
118
118
  * [`snaptrade.reference_data.list_all_brokerages`](#snaptradereference_datalist_all_brokerages)
119
+ * [`snaptrade.reference_data.list_institutions`](#snaptradereference_datalist_institutions)
119
120
  * [`snaptrade.reference_data.symbol_search_user_account`](#snaptradereference_datasymbol_search_user_account)
120
121
  * [`snaptrade.trading.cancel_order`](#snaptradetradingcancel_order)
121
122
  * [`snaptrade.trading.get_cryptocurrency_pair_quote`](#snaptradetradingget_cryptocurrency_pair_quote)
@@ -139,7 +140,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
139
140
  Add to Gemfile:
140
141
 
141
142
  ```ruby
142
- gem 'snaptrade', '~> 3.0.25'
143
+ gem 'snaptrade', '~> 3.0.26'
143
144
  ```
144
145
 
145
146
  ## Getting Started<a id="getting-started"></a>
@@ -563,7 +564,7 @@ false to retrieve non executed orders as well
563
564
 
564
565
  ### `snaptrade.account_information.get_user_account_return_rates`<a id="snaptradeaccount_informationget_user_account_return_rates"></a>
565
566
 
566
- Returns a list of rate of return percents for a given account.
567
+ DEPRECATED. Returns a list of rate of return percents for a given account.
567
568
 
568
569
 
569
570
  #### 🛠️ Usage<a id="🛠️-usage"></a>
@@ -1219,7 +1220,7 @@ p result
1219
1220
 
1220
1221
  ### `snaptrade.connections.return_rates`<a id="snaptradeconnectionsreturn_rates"></a>
1221
1222
 
1222
- Returns a list of rate of return percents for a given connection.
1223
+ DEPRECATED. Returns a list of rate of return percents for a given connection.
1223
1224
 
1224
1225
 
1225
1226
  #### 🛠️ Usage<a id="🛠️-usage"></a>
@@ -1724,6 +1725,33 @@ p result
1724
1725
  ---
1725
1726
 
1726
1727
 
1728
+ ### `snaptrade.reference_data.list_institutions`<a id="snaptradereference_datalist_institutions"></a>
1729
+
1730
+ Returns the public catalog of institutions SnapTrade supports and what each one supports. The response is the same for every caller and needs no authentication. To list the brokerages a specific Client ID can connect to right now, use `GET /brokerages` instead.
1731
+
1732
+ A `null` field means the information is not documented yet, never that the institution lacks it. New fields and new enum values may be added over time, so ignore any you don't recognize.
1733
+
1734
+
1735
+ #### 🛠️ Usage<a id="🛠️-usage"></a>
1736
+
1737
+ ```ruby
1738
+ result = snaptrade.reference_data.list_institutions
1739
+ p result
1740
+ ```
1741
+
1742
+ #### 🔄 Return<a id="🔄-return"></a>
1743
+
1744
+ [Institution](./lib/snaptrade/models/institution.rb)
1745
+
1746
+ #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1747
+
1748
+ `/institutions` `GET`
1749
+
1750
+ [🔙 **Back to Table of Contents**](#table-of-contents)
1751
+
1752
+ ---
1753
+
1754
+
1727
1755
  ### `snaptrade.reference_data.symbol_search_user_account`<a id="snaptradereference_datasymbol_search_user_account"></a>
1728
1756
 
1729
1757
  Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
@@ -1030,7 +1030,7 @@ module SnapTrade
1030
1030
 
1031
1031
  # List account rate of returns
1032
1032
  #
1033
- # Returns a list of rate of return percents for a given account.
1033
+ # DEPRECATED. Returns a list of rate of return percents for a given account.
1034
1034
  #
1035
1035
  # @param user_id [String]
1036
1036
  # @param user_secret [String]
@@ -1045,7 +1045,7 @@ module SnapTrade
1045
1045
 
1046
1046
  # List account rate of returns
1047
1047
  #
1048
- # Returns a list of rate of return percents for a given account.
1048
+ # DEPRECATED. Returns a list of rate of return percents for a given account.
1049
1049
  #
1050
1050
  # @param user_id [String]
1051
1051
  # @param user_secret [String]
@@ -1058,7 +1058,7 @@ module SnapTrade
1058
1058
  end
1059
1059
 
1060
1060
  # List account rate of returns
1061
- # Returns a list of rate of return percents for a given account.
1061
+ # DEPRECATED. Returns a list of rate of return percents for a given account.
1062
1062
  # @param user_id [String]
1063
1063
  # @param user_secret [String]
1064
1064
  # @param account_id [String]
@@ -1071,7 +1071,7 @@ module SnapTrade
1071
1071
  end
1072
1072
 
1073
1073
  # List account rate of returns
1074
- # Returns a list of rate of return percents for a given account.
1074
+ # DEPRECATED. Returns a list of rate of return percents for a given account.
1075
1075
  # @param user_id [String]
1076
1076
  # @param user_secret [String]
1077
1077
  # @param account_id [String]
@@ -782,7 +782,7 @@ module SnapTrade
782
782
 
783
783
  # List connection rate of returns
784
784
  #
785
- # Returns a list of rate of return percents for a given connection.
785
+ # DEPRECATED. Returns a list of rate of return percents for a given connection.
786
786
  #
787
787
  # @param user_id [String]
788
788
  # @param user_secret [String]
@@ -797,7 +797,7 @@ module SnapTrade
797
797
 
798
798
  # List connection rate of returns
799
799
  #
800
- # Returns a list of rate of return percents for a given connection.
800
+ # DEPRECATED. Returns a list of rate of return percents for a given connection.
801
801
  #
802
802
  # @param user_id [String]
803
803
  # @param user_secret [String]
@@ -810,7 +810,7 @@ module SnapTrade
810
810
  end
811
811
 
812
812
  # List connection rate of returns
813
- # Returns a list of rate of return percents for a given connection.
813
+ # DEPRECATED. Returns a list of rate of return percents for a given connection.
814
814
  # @param user_id [String]
815
815
  # @param user_secret [String]
816
816
  # @param authorization_id [String]
@@ -823,7 +823,7 @@ module SnapTrade
823
823
  end
824
824
 
825
825
  # List connection rate of returns
826
- # Returns a list of rate of return percents for a given connection.
826
+ # DEPRECATED. Returns a list of rate of return percents for a given connection.
827
827
  # @param user_id [String]
828
828
  # @param user_secret [String]
829
829
  # @param authorization_id [String]
@@ -596,6 +596,87 @@ module SnapTrade
596
596
  end
597
597
 
598
598
 
599
+ # List institutions
600
+ #
601
+ # Returns the public catalog of institutions SnapTrade supports and what each one supports. The response is the same for every caller and needs no authentication. To list the brokerages a specific Client ID can connect to right now, use `GET /brokerages` instead.
602
+ #
603
+ # A `null` field means the information is not documented yet, never that the institution lacks it. New fields and new enum values may be added over time, so ignore any you don't recognize.
604
+ #
605
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
606
+ def list_institutions(extra: {})
607
+ data, _status_code, _headers = list_institutions_with_http_info_impl(extra)
608
+ data
609
+ end
610
+
611
+ # List institutions
612
+ #
613
+ # Returns the public catalog of institutions SnapTrade supports and what each one supports. The response is the same for every caller and needs no authentication. To list the brokerages a specific Client ID can connect to right now, use `GET /brokerages` instead.
614
+ #
615
+ # A `null` field means the information is not documented yet, never that the institution lacks it. New fields and new enum values may be added over time, so ignore any you don't recognize.
616
+ #
617
+ # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
618
+ def list_institutions_with_http_info(extra: {})
619
+ list_institutions_with_http_info_impl(extra)
620
+ end
621
+
622
+ # List institutions
623
+ # Returns the public catalog of institutions SnapTrade supports and what each one supports. The response is the same for every caller and needs no authentication. To list the brokerages a specific Client ID can connect to right now, use `GET /brokerages` instead. A `null` field means the information is not documented yet, never that the institution lacks it. New fields and new enum values may be added over time, so ignore any you don't recognize.
624
+ # @param [Hash] opts the optional parameters
625
+ # @return [Array<Institution>]
626
+ private def list_institutions_impl(opts = {})
627
+ data, _status_code, _headers = list_institutions_with_http_info(opts)
628
+ data
629
+ end
630
+
631
+ # List institutions
632
+ # Returns the public catalog of institutions SnapTrade supports and what each one supports. The response is the same for every caller and needs no authentication. To list the brokerages a specific Client ID can connect to right now, use &#x60;GET /brokerages&#x60; instead. A &#x60;null&#x60; field means the information is not documented yet, never that the institution lacks it. New fields and new enum values may be added over time, so ignore any you don&#39;t recognize.
633
+ # @param [Hash] opts the optional parameters
634
+ # @return [Array<(Array<Institution>, Integer, Hash)>] Array<Institution> data, response status code and response headers
635
+ private def list_institutions_with_http_info_impl(opts = {})
636
+ if @api_client.config.debugging
637
+ @api_client.config.logger.debug 'Calling API: ReferenceDataApi.list_institutions ...'
638
+ end
639
+ # resource path
640
+ local_var_path = '/institutions'
641
+
642
+ # query parameters
643
+ query_params = opts[:query_params] || {}
644
+
645
+ # header parameters
646
+ header_params = opts[:header_params] || {}
647
+ # HTTP header 'Accept' (if needed)
648
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
649
+
650
+ # form parameters
651
+ form_params = opts[:form_params] || {}
652
+
653
+ # http body (model)
654
+ post_body = opts[:debug_body]
655
+
656
+ # return_type
657
+ return_type = opts[:debug_return_type] || 'Array<Institution>'
658
+
659
+ # auth_names
660
+ auth_names = opts[:debug_auth_names] || []
661
+
662
+ new_options = opts.merge(
663
+ :operation => :"ReferenceDataApi.list_institutions",
664
+ :header_params => header_params,
665
+ :query_params => query_params,
666
+ :form_params => form_params,
667
+ :body => post_body,
668
+ :auth_names => auth_names,
669
+ :return_type => return_type
670
+ )
671
+
672
+ data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
673
+ if @api_client.config.debugging
674
+ @api_client.config.logger.debug "API called: ReferenceDataApi#list_institutions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
675
+ end
676
+ return data, status_code, headers, response
677
+ end
678
+
679
+
599
680
  # Search account symbols
600
681
  #
601
682
  # Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
@@ -35,7 +35,7 @@ module SnapTrade
35
35
  # Attribute type mapping.
36
36
  def self.openapi_types
37
37
  {
38
- :'institution' => :'Institution',
38
+ :'institution' => :'BrokerageAuthorizationInstitution',
39
39
  :'snaptrade' => :'Snaptrade'
40
40
  }
41
41
  end
@@ -0,0 +1,37 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
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 BrokerageAuthorizationInstitution
15
+ REALTIME = "realtime".freeze
16
+ DELAYED = "delayed".freeze
17
+
18
+ def self.all_vars
19
+ @all_vars ||= [REALTIME, DELAYED].freeze
20
+ end
21
+
22
+ # Builds the enum from string
23
+ # @param [String] The enum value in the form of the string
24
+ # @return [String] The enum value
25
+ def self.build_from_hash(value)
26
+ new.build_from_hash(value)
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def build_from_hash(value)
33
+ return value if BrokerageAuthorizationInstitution.all_vars.include?(value)
34
+ raise "Invalid ENUM value #{value} for class #BrokerageAuthorizationInstitution"
35
+ end
36
+ end
37
+ end
@@ -11,27 +11,351 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
+ # An institution in SnapTrade's public catalog and what it supports. A `null` field means the information is not documented yet.
14
15
  class Institution
15
- REALTIME = "realtime".freeze
16
- DELAYED = "delayed".freeze
16
+ # A short, unique identifier for the institution. It is usually the name in capital letters and will never change. It matches the `slug` of the same brokerage in `GET /brokerages`.
17
+ attr_accessor :slug
17
18
 
18
- def self.all_vars
19
- @all_vars ||= [REALTIME, DELAYED].freeze
19
+ # Full name of the institution.
20
+ attr_accessor :name
21
+
22
+ # A display-friendly name of the institution.
23
+ attr_accessor :display_name
24
+
25
+ # A brief description of the institution.
26
+ attr_accessor :description
27
+
28
+ # URL of the institution's website.
29
+ attr_accessor :website
30
+
31
+ # URL of the institution's rectangular logo.
32
+ attr_accessor :logo_url
33
+
34
+ # URL of the institution's square logo.
35
+ attr_accessor :square_logo_url
36
+
37
+ # How mature the integration is. - `GENERALLY_AVAILABLE`: fully supported and validated for production use. - `BETA`: production-ready, with ongoing validation and improvements.
38
+ attr_accessor :release_stage
39
+
40
+ # Regions where end users can connect to this institution. - `US`: United States - `CA`: Canada - `EUROPE`: Europe, including the United Kingdom - `AU`: Australia - `IN`: India
41
+ attr_accessor :regions
42
+
43
+ attr_accessor :connection
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'slug' => :'slug',
71
+ :'name' => :'name',
72
+ :'display_name' => :'display_name',
73
+ :'description' => :'description',
74
+ :'website' => :'website',
75
+ :'logo_url' => :'logo_url',
76
+ :'square_logo_url' => :'square_logo_url',
77
+ :'release_stage' => :'release_stage',
78
+ :'regions' => :'regions',
79
+ :'connection' => :'connection'
80
+ }
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ attribute_map.values
20
86
  end
21
87
 
22
- # Builds the enum from string
23
- # @param [String] The enum value in the form of the string
24
- # @return [String] The enum value
25
- def self.build_from_hash(value)
26
- new.build_from_hash(value)
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :'slug' => :'String',
92
+ :'name' => :'String',
93
+ :'display_name' => :'String',
94
+ :'description' => :'String',
95
+ :'website' => :'String',
96
+ :'logo_url' => :'String',
97
+ :'square_logo_url' => :'String',
98
+ :'release_stage' => :'ReleaseStage',
99
+ :'regions' => :'Array<String>',
100
+ :'connection' => :'InstitutionConnection'
101
+ }
27
102
  end
28
103
 
29
- # Builds the enum from string
30
- # @param [String] The enum value in the form of the string
31
- # @return [String] The enum value
32
- def build_from_hash(value)
33
- return value if Institution.all_vars.include?(value)
34
- raise "Invalid ENUM value #{value} for class #Institution"
104
+ # List of attributes with nullable: true
105
+ def self.openapi_nullable
106
+ Set.new([
107
+ :'description',
108
+ :'website',
109
+ :'square_logo_url',
110
+ :'regions',
111
+ :'connection'
112
+ ])
35
113
  end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Institution` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!self.class.attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Institution`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'slug')
131
+ self.slug = attributes[:'slug']
132
+ end
133
+
134
+ if attributes.key?(:'name')
135
+ self.name = attributes[:'name']
136
+ end
137
+
138
+ if attributes.key?(:'display_name')
139
+ self.display_name = attributes[:'display_name']
140
+ end
141
+
142
+ if attributes.key?(:'description')
143
+ self.description = attributes[:'description']
144
+ end
145
+
146
+ if attributes.key?(:'website')
147
+ self.website = attributes[:'website']
148
+ end
149
+
150
+ if attributes.key?(:'logo_url')
151
+ self.logo_url = attributes[:'logo_url']
152
+ end
153
+
154
+ if attributes.key?(:'square_logo_url')
155
+ self.square_logo_url = attributes[:'square_logo_url']
156
+ end
157
+
158
+ if attributes.key?(:'release_stage')
159
+ self.release_stage = attributes[:'release_stage']
160
+ end
161
+
162
+ if attributes.key?(:'regions')
163
+ if (value = attributes[:'regions']).is_a?(Array)
164
+ self.regions = value
165
+ end
166
+ end
167
+
168
+ if attributes.key?(:'connection')
169
+ self.connection = attributes[:'connection']
170
+ end
171
+ end
172
+
173
+ # Show invalid properties with the reasons. Usually used together with valid?
174
+ # @return Array for valid properties with the reasons
175
+ def list_invalid_properties
176
+ invalid_properties = Array.new
177
+ if @slug.nil?
178
+ invalid_properties.push('invalid value for "slug", slug cannot be nil.')
179
+ end
180
+
181
+ if @name.nil?
182
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
183
+ end
184
+
185
+ if @display_name.nil?
186
+ invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
187
+ end
188
+
189
+ if @logo_url.nil?
190
+ invalid_properties.push('invalid value for "logo_url", logo_url cannot be nil.')
191
+ end
192
+
193
+ if @release_stage.nil?
194
+ invalid_properties.push('invalid value for "release_stage", release_stage cannot be nil.')
195
+ end
196
+
197
+ invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ return false if @slug.nil?
204
+ return false if @name.nil?
205
+ return false if @display_name.nil?
206
+ return false if @logo_url.nil?
207
+ return false if @release_stage.nil?
208
+ true
209
+ end
210
+
211
+ # Checks equality by comparing each attribute.
212
+ # @param [Object] Object to be compared
213
+ def ==(o)
214
+ return true if self.equal?(o)
215
+ self.class == o.class &&
216
+ slug == o.slug &&
217
+ name == o.name &&
218
+ display_name == o.display_name &&
219
+ description == o.description &&
220
+ website == o.website &&
221
+ logo_url == o.logo_url &&
222
+ square_logo_url == o.square_logo_url &&
223
+ release_stage == o.release_stage &&
224
+ regions == o.regions &&
225
+ connection == o.connection
226
+ end
227
+
228
+ # @see the `==` method
229
+ # @param [Object] Object to be compared
230
+ def eql?(o)
231
+ self == o
232
+ end
233
+
234
+ # Calculates hash code according to all attributes.
235
+ # @return [Integer] Hash code
236
+ def hash
237
+ [slug, name, display_name, description, website, logo_url, square_logo_url, release_stage, regions, connection].hash
238
+ end
239
+
240
+ # Builds the object from hash
241
+ # @param [Hash] attributes Model attributes in the form of hash
242
+ # @return [Object] Returns the model itself
243
+ def self.build_from_hash(attributes)
244
+ new.build_from_hash(attributes)
245
+ end
246
+
247
+ # Builds the object from hash
248
+ # @param [Hash] attributes Model attributes in the form of hash
249
+ # @return [Object] Returns the model itself
250
+ def build_from_hash(attributes)
251
+ return nil unless attributes.is_a?(Hash)
252
+ attributes = attributes.transform_keys(&:to_sym)
253
+ self.class.openapi_types.each_pair do |key, type|
254
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
255
+ self.send("#{key}=", nil)
256
+ elsif type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
260
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
261
+ end
262
+ elsif !attributes[self.class.attribute_map[key]].nil?
263
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
264
+ end
265
+ end
266
+
267
+ self
268
+ end
269
+
270
+ # Deserializes the data based on type
271
+ # @param string type Data type
272
+ # @param string value Value to be deserialized
273
+ # @return [Object] Deserialized data
274
+ def _deserialize(type, value)
275
+ case type.to_sym
276
+ when :Time
277
+ Time.parse(value)
278
+ when :Date
279
+ Date.parse(value)
280
+ when :String
281
+ value.to_s
282
+ when :Integer
283
+ value.to_i
284
+ when :Float
285
+ value.to_f
286
+ when :Boolean
287
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
288
+ true
289
+ else
290
+ false
291
+ end
292
+ when :Object
293
+ # generic object (usually a Hash), return directly
294
+ value
295
+ when /\AArray<(?<inner_type>.+)>\z/
296
+ inner_type = Regexp.last_match[:inner_type]
297
+ value.map { |v| _deserialize(inner_type, v) }
298
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
299
+ k_type = Regexp.last_match[:k_type]
300
+ v_type = Regexp.last_match[:v_type]
301
+ {}.tap do |hash|
302
+ value.each do |k, v|
303
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
304
+ end
305
+ end
306
+ else # model
307
+ # models (e.g. Pet) or oneOf
308
+ klass = SnapTrade.const_get(type)
309
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
310
+ end
311
+ end
312
+
313
+ # Returns the string representation of the object
314
+ # @return [String] String presentation of the object
315
+ def to_s
316
+ to_hash.to_s
317
+ end
318
+
319
+ # to_body is an alias to to_hash (backward compatibility)
320
+ # @return [Hash] Returns the object in the form of hash
321
+ def to_body
322
+ to_hash
323
+ end
324
+
325
+ # Returns the object in the form of hash
326
+ # @return [Hash] Returns the object in the form of hash
327
+ def to_hash
328
+ hash = {}
329
+ self.class.attribute_map.each_pair do |attr, param|
330
+ value = self.send(attr)
331
+ if value.nil?
332
+ is_nullable = self.class.openapi_nullable.include?(attr)
333
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
334
+ end
335
+
336
+ hash[param] = _to_hash(value)
337
+ end
338
+ hash
339
+ end
340
+
341
+ # Outputs non-array value in the form of hash
342
+ # For object, use to_hash. Otherwise, just return the value
343
+ # @param [Object] value Any valid value
344
+ # @return [Hash] Returns the value in the form of hash
345
+ def _to_hash(value)
346
+ if value.is_a?(Array)
347
+ value.compact.map { |v| _to_hash(v) }
348
+ elsif value.is_a?(Hash)
349
+ {}.tap do |hash|
350
+ value.each { |k, v| hash[k] = _to_hash(v) }
351
+ end
352
+ elsif value.respond_to? :to_hash
353
+ value.to_hash
354
+ else
355
+ value
356
+ end
357
+ end
358
+
36
359
  end
360
+
37
361
  end