cybrid_api_id_ruby 0.129.748 → 0.129.749

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +5 -9
  4. data/cybrid_api_id_ruby.gemspec +1 -1
  5. data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
  6. data/lib/cybrid_api_id_ruby/api/customer_tokens_idp_api.rb +1 -1
  7. data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
  8. data/lib/cybrid_api_id_ruby/api/users_idp_api.rb +1 -1
  9. data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
  10. data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
  11. data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
  12. data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
  13. data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
  14. data/lib/cybrid_api_id_ruby/models/application_with_secret_all_of_idp_model.rb +1 -1
  15. data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
  16. data/lib/cybrid_api_id_ruby/models/customer_token_idp_model.rb +1 -1
  17. data/lib/cybrid_api_id_ruby/models/error_response_idp_model.rb +1 -1
  18. data/lib/cybrid_api_id_ruby/models/patch_application_idp_model.rb +1 -1
  19. data/lib/cybrid_api_id_ruby/models/patch_user_idp_model.rb +1 -1
  20. data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
  21. data/lib/cybrid_api_id_ruby/models/post_customer_token_idp_model.rb +1 -1
  22. data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
  23. data/lib/cybrid_api_id_ruby/models/post_user_idp_model.rb +1 -1
  24. data/lib/cybrid_api_id_ruby/models/user_idp_model.rb +1 -1
  25. data/lib/cybrid_api_id_ruby/models/user_list_idp_model.rb +1 -1
  26. data/lib/cybrid_api_id_ruby/version.rb +2 -2
  27. data/lib/cybrid_api_id_ruby.rb +1 -5
  28. data/spec/api/bank_applications_idp_api_spec.rb +1 -1
  29. data/spec/api/customer_tokens_idp_api_spec.rb +1 -1
  30. data/spec/api/organization_applications_idp_api_spec.rb +1 -1
  31. data/spec/api/users_idp_api_spec.rb +1 -1
  32. data/spec/api_client_spec.rb +1 -1
  33. data/spec/configuration_spec.rb +1 -1
  34. data/spec/models/application_idp_model_spec.rb +1 -1
  35. data/spec/models/application_list_idp_model_spec.rb +1 -1
  36. data/spec/models/application_with_secret_all_of_idp_model_spec.rb +1 -1
  37. data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
  38. data/spec/models/customer_token_idp_model_spec.rb +1 -1
  39. data/spec/models/error_response_idp_model_spec.rb +1 -1
  40. data/spec/models/patch_application_idp_model_spec.rb +1 -1
  41. data/spec/models/patch_user_idp_model_spec.rb +1 -1
  42. data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
  43. data/spec/models/post_customer_token_idp_model_spec.rb +1 -1
  44. data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
  45. data/spec/models/post_user_idp_model_spec.rb +1 -1
  46. data/spec/models/user_idp_model_spec.rb +1 -1
  47. data/spec/models/user_list_idp_model_spec.rb +1 -1
  48. data/spec/spec_helper.rb +1 -1
  49. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/byebug-13.0.0/gem_make.out +5 -5
  50. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/date-3.5.1/gem_make.out +5 -5
  51. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/io-console-0.8.2/gem_make.out +5 -5
  52. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  53. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/psych-5.4.0/gem_make.out +5 -5
  54. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem_make.out +5 -5
  55. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/stringio-3.2.0/gem_make.out +5 -5
  56. metadata +1 -17
  57. data/docs/GroupAuthorizationIdpModel.md +0 -30
  58. data/docs/GroupAuthorizationListIdpModel.md +0 -24
  59. data/docs/GroupIdpModel.md +0 -28
  60. data/docs/GroupListIdpModel.md +0 -24
  61. data/lib/cybrid_api_id_ruby/models/group_authorization_idp_model.rb +0 -312
  62. data/lib/cybrid_api_id_ruby/models/group_authorization_list_idp_model.rb +0 -328
  63. data/lib/cybrid_api_id_ruby/models/group_idp_model.rb +0 -297
  64. data/lib/cybrid_api_id_ruby/models/group_list_idp_model.rb +0 -328
  65. data/spec/models/group_authorization_idp_model_spec.rb +0 -70
  66. data/spec/models/group_authorization_list_idp_model_spec.rb +0 -52
  67. data/spec/models/group_idp_model_spec.rb +0 -64
  68. data/spec/models/group_list_idp_model_spec.rb +0 -52
@@ -1,312 +0,0 @@
1
- =begin
2
- #Cybrid Identity API
3
-
4
- ## Cybrid API documentation Welcome to Cybrid, an all-in-one crypto platform that enables you to easily **build** and **launch** white-label crypto products or services. In these documents, you'll find details on how our REST API operates and generally how our platform functions. If you're looking for our UI SDK Widgets for Web or Mobile (iOS/Android), generated API clients, or demo applications, head over to our [Github repo](https://github.com/Cybrid-app). 💡 We recommend bookmarking the [Cybrid LinkTree](https://linktr.ee/cybridtechnologies) which contains many helpful links to platform resources. ## Getting Started This is Cybrid's public interactive API documentation, which allows you to fully test our APIs. If you'd like to use a different tool to exercise our APIs, you can download the [Open API 3.0 yaml](https://bank.production.cybrid.app/api/schema/v1/swagger.yaml) for import. If you're new to our APIs and the Cybrid Platform, follow the below guides to get set up and familiar with the platform: 1. [Introduction](https://docs.cybrid.xyz/docs/introduction) 2. [Platform Overview](https://docs.cybrid.xyz/docs/platform-overview) 3. [Testing with Hosted Web Demo App](https://docs.cybrid.xyz/docs/hosted-demo-app) In [Getting Started in the Cybrid Sandbox](https://docs.cybrid.xyz/docs/cybrid-sandbox), we walk you through how to use the [Cybrid Sandbox](https://id.sandbox.cybrid.app/) to create a test bank and generate API keys. In [Getting Ready for Trading](https://docs.cybrid.xyz/docs/trade-process), we walk through creating customers, customer identities, accounts, as well as executing quotes and trades. ## Working with the Cybrid Platform There are three primary ways you can interact with the Cybrid platform: 1. Directly via our RESTful API (this documentation) 2. Using our API clients available in a variety of languages ([Angular](https://github.com/Cybrid-app/cybrid-api-bank-angular), [Java](https://github.com/Cybrid-app/cybrid-api-bank-java), [Kotlin](https://github.com/Cybrid-app/cybrid-api-bank-kotlin), [Python](https://github.com/Cybrid-app/cybrid-api-bank-python), [Ruby](https://github.com/Cybrid-app/cybrid-api-bank-ruby), [Swift](https://github.com/Cybrid-app/cybrid-api-bank-swift) or [Typescript](https://github.com/Cybrid-app/cybrid-api-bank-typescript)) 3. Integrating a platform specific SDK ([Web](https://github.com/Cybrid-app/cybrid-sdk-web), [Android](https://github.com/Cybrid-app/cybrid-sdk-android), [iOS](https://github.com/Cybrid-app/cybrid-sdk-ios)) Our complete set of APIs allows you to manage resources across three distinct areas: your `Organization`, your `Banks` and your `Identities`. For most of your testing and interaction you'll be using the `Bank` API, which is where the majority of APIs reside. *The complete set of APIs can be found on the following pages:* | API | Description | |------------------------------------------------------------------|-------------------------------------------------------------| | [Organization API](https://organization.production.cybrid.app/api/schema/swagger-ui) | APIs to manage organizations | | [Bank API](https://bank.production.cybrid.app/api/schema/swagger-ui) | APIs to manage banks (and all downstream customer activity) | | [Identities API](https://id.production.cybrid.app/api/schema/swagger-ui) | APIs to manage organization and bank identities | For questions please contact [Support](mailto:support@cybrid.xyz) at any time for assistance, or contact the [Product Team](mailto:product@cybrid.xyz) for product suggestions. ## Authenticating with the API The Cybrid Platform uses OAuth 2.0 Bearer Tokens to authenticate requests to the platform. Credentials to create `Organization` and `Bank` tokens can be generated via the [Cybrid Sandbox](https://id.production.cybrid.app). Access tokens can be generated for a `Customer` as well via the [Cybrid IdP](https://id.production.cybrid.app) as well. An `Organization` access token applies broadly to the whole Organization and all of its `Banks`, whereas, a `Bank` access token is specific to an individual Bank. `Customer` tokens, similarly, are scoped to a specific customer in a bank. Both `Organization` and `Bank` tokens can be created using the OAuth Client Credential Grant flow. Each Organization and Bank has its own unique `Client ID` and `Secret` that allows for machine-to-machine authentication. A `Bank` can then generate `Customer` access tokens via API using our [Identities API](https://id.production.cybrid.app/api/schema/swagger-ui). <font color=\"orange\">**⚠️ Never share your Client ID or Secret publicly or in your source code repository.**</font> Your `Client ID` and `Secret` can be exchanged for a time-limited `Bearer Token` by interacting with the Cybrid Identity Provider or through interacting with the **Authorize** button in this document. The following curl command can be used to quickly generate a `Bearer Token` for use in testing the API or demo applications. ``` # Example request when using Bank credentials curl -X POST https://id.production.cybrid.app/oauth/token -d '{ \"grant_type\": \"client_credentials\", \"client_id\": \"<Your Client ID>\", \"client_secret\": \"<Your Secret>\", \"scope\": \"banks:read banks:write bank_applications:read bank_applications:write bank_applications:execute accounts:read accounts:write accounts:execute counterparties:read counterparties:pii:read counterparties:write counterparties:execute customers:read customers:pii:read customers:write customers:execute prices:read quotes:execute quotes:read trades:execute trades:read transfers:execute transfers:read transfers:write external_bank_accounts:read external_bank_accounts:pii:read external_bank_accounts:write external_bank_accounts:execute external_wallets:read external_wallets:write external_wallets:execute workflows:read workflows:execute deposit_addresses:read deposit_addresses:write deposit_addresses:execute deposit_bank_accounts:read deposit_bank_accounts:write deposit_bank_accounts:execute invoices:read invoices:write invoices:execute identity_verifications:read identity_verifications:pii:read identity_verifications:write identity_verifications:execute persona_sessions:execute sardine_sessions:execute plans:execute plans:read executions:execute executions:read files:read files:pii:read files:execute\" }' -H \"Content-Type: application/json\" # When using Organization credentials set `scope` to 'organizations:read organizations:write organization_applications:read organization_applications:write organization_applications:execute banks:read banks:write banks:execute bank_applications:read bank_applications:write bank_applications:execute users:read users:write users:execute counterparties:read counterparties:pii:read customers:read customers:pii:read accounts:read accounts:write prices:read quotes:execute quotes:read trades:execute trades:read transfers:read transfers:write transfers:execute external_bank_accounts:read external_bank_accounts:pii:read external_bank_accounts:write external_wallets:read external_wallets:write workflows:read deposit_addresses:read deposit_addresses:write deposit_bank_accounts:read deposit_bank_accounts:write deposit_bank_accounts:execute invoices:read subscriptions:read subscriptions:write subscriptions:execute subscription_events:read subscription_events:execute identity_verifications:read identity_verifications:pii:read identity_verifications:execute persona_sessions:execute sardine_sessions:execute plans:execute plans:read executions:execute executions:read files:read files:pii:read files:execute' ``` <font color=\"orange\">**⚠️ Note: The above curl will create a bearer token with full scope access. Delete scopes if you'd like to restrict access.**</font> ## Authentication Scopes The Cybrid platform supports the use of scopes to control the level of access a token is limited to. Scopes do not grant access to resources; instead, they provide limits, in support of the least privilege principal. The following scopes are available on the platform and can be requested when generating either an Organization, Bank or Customer token. Generally speaking, the _Read_ scope is required to read and list resources, the _Write_ scope is required to update a resource and the _Execute_ scope is required to create a resource. | Resource | Read scope (Token Type) | Write scope (Token Type) | Execute scope (Token Type) | |-----------------------|------------------------------------------------------------|-----------------------------------------------|--------------------------------------------------| | Account | accounts:read (Organization, Bank, Customer) | | accounts:execute (Bank, Customer) | | Bank | banks:read (Organization, Bank) | banks:write (Organization, Bank) | banks:execute (Organization) | | Customer | customers:read (Organization, Bank, Customer) | customers:write (Bank, Customer) | customers:execute (Bank) | | Counterparty | counterparties:read (Organization, Bank, Customer) | counterparties:write (Bank, Customer) | counterparties:execute (Bank) | | Deposit Address | deposit_addresses:read (Organization, Bank, Customer) | deposit_addresses:write (Bank, Customer) | deposit_addresses:execute (Bank, Customer) | | External Bank Account | external_bank_accounts:read (Organization, Bank, Customer) | external_bank_accounts:write (Bank, Customer) | external_bank_accounts:execute (Bank, Customer) | | External Wallet | external_wallet:read (Organization, Bank, Customer) | | external_wallet:execute (Bank, Customer) | | Organization | organizations:read (Organization) | organizations:write (Organization) | | | User | users:read (Organization) | | users:execute (Organization) | | Price | prices:read (Bank, Customer) | | | | Quote | quotes:read (Organization, Bank, Customer) | | quotes:execute (Organization, Bank, Customer) | | Trade | trades:read (Organization, Bank, Customer) | | trades:execute (Organization, Bank, Customer) | | Transfer | transfers:read (Organization, Bank, Customer) | | transfers:execute (Organization, Bank, Customer) | | Workflow | workflows:read (Organization, Bank, Customer) | | workflows:execute (Bank, Customer) | | Invoice | invoices:read (Organization, Bank, Customer) | invoices:write (Bank, Customer) | invoices:execute (Bank, Customer) | ## Available Endpoints The available APIs for the [Identity](https://id.production.cybrid.app/api/schema/swagger-ui), [Organization](https://organization.production.cybrid.app/api/schema/swagger-ui) and [Bank](https://bank.production.cybrid.app/api/schema/swagger-ui) API services are listed below: | API Service | Model | API Endpoint Path | Description | |--------------|----------------------|--------------------------------|---------------------------------------------------------------------------------------------------| | Identity | Bank | /api/bank_applications | Create and list banks | | Identity | CustomerToken | /api/customer_tokens | Create customer JWT access tokens | | Identity | Organization | /api/organization_applications | Create and list organizations | | Identity | Organization | /api/users | Create and list organization users | | Organization | Organization | /api/organizations | APIs to retrieve and update organization name | | Bank | Account | /api/accounts | Create and list accounts, which hold a specific asset for a customers | | Bank | Asset | /api/assets | Get a list of assets supported by the platform (ex: BTC, ETH) | | Bank | Bank | /api/banks | Create, update and list banks, the parent to customers, accounts, etc | | Bank | Customer | /api/customers | Create and list customers | | Bank | Counterparty | /api/counterparties | Create and list counterparties | | Bank | DepositAddress | /api/deposit_addresses | Create, get and list deposit addresses | | Bank | ExternalBankAccount | /api/external_bank_accounts | Create, get and list external bank accounts, which connect customer bank accounts to the platform | | Bank | ExternalWallet | /api/external_wallets | Create, get, list and delete external wallets, which connect customer wallets to the platform | | Bank | IdentityVerification | /api/identity_verifications | Create and list identity verifications, which are performed on customers for KYC | | Bank | Invoice | /api/invoices | Create, get, cancel and list invoices | | Bank | PaymentInstruction | /api/payment_instructions | Create, get and list payment instructions for invoices | | Bank | Price | /api/prices | Get the current prices for assets on the platform | | Bank | Quote | /api/quotes | Create and list quotes, which are required to execute trades | | Bank | Symbol | /api/symbols | Get a list of symbols supported for trade (ex: BTC-USD) | | Bank | Trade | /api/trades | Create and list trades, which buy or sell cryptocurrency | | Bank | Transfer | /api/transfers | Create, get and list transfers (e.g., funding, book) | | Bank | Workflow | /api/workflows | Create, get and list workflows | ## Understanding Object Models & Endpoints **Organizations** An `Organization` is meant to represent the organization partnering with Cybrid to use our platform. An `Organization` typically does not directly interact with `customers`. Instead, an Organization has one or more `banks`, which encompass the financial service offerings of the platform. **Banks** A `Bank` is owned by an `Organization` and can be thought of as an environment or container for `customers` and product offerings. Banks are created in either `Sandbox` or `Production` mode, where `Sandbox` is the environment that you would test, prototype and build in prior to moving to `Production`. An `Organization` can have multiple `banks`, in either `Sandbox` or `Production` environments. A `Sandbox Bank` will be backed by stubbed data and process flows. For instance, funding source transfer processes as well as trades will be simulated rather than performed, however asset prices are representative of real-world values. You have an unlimited amount of simulated fiat currency for testing purposes. **Customers** `Customers` represent your banking users on the platform. At present, we offer support for `Individuals` as Customers. `Customers` must be verified (i.e., KYC'd) in our system before they can play any part on the platform, which means they must have an associated and a passing `Identity Verification`. See the Identity Verifications section for more details on how a customer can be verified. `Customers` must also have an `Account` to be able to transact, in the desired asset class. See the Accounts APIs for more details on setting up accounts for the customer.
5
-
6
- The version of the OpenAPI document: v0.129.748
7
- Contact: support@cybrid.app
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.0.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module CybridApiId
17
- class GroupAuthorizationIdpModel
18
- # The group authorization's guid.
19
- attr_accessor :guid
20
-
21
- # Guid of the group.
22
- attr_accessor :group_guid
23
-
24
- # Guid of the organization linked to the group.
25
- attr_accessor :resource_guid
26
-
27
- # Type of the linked resource.
28
- attr_accessor :resource_type
29
-
30
- # Scopes the group holds over the organization.
31
- attr_accessor :allowed_scopes
32
-
33
- # ISO8601 datetime the record was created at.
34
- attr_accessor :created_at
35
-
36
- # ISO8601 datetime the record was last updated at.
37
- attr_accessor :updated_at
38
-
39
- # Attribute mapping from ruby-style variable name to JSON key.
40
- def self.attribute_map
41
- {
42
- :'guid' => :'guid',
43
- :'group_guid' => :'group_guid',
44
- :'resource_guid' => :'resource_guid',
45
- :'resource_type' => :'resource_type',
46
- :'allowed_scopes' => :'allowed_scopes',
47
- :'created_at' => :'created_at',
48
- :'updated_at' => :'updated_at'
49
- }
50
- end
51
-
52
- # Returns all the JSON keys this model knows about
53
- def self.acceptable_attributes
54
- attribute_map.values
55
- end
56
-
57
- # Attribute type mapping.
58
- def self.openapi_types
59
- {
60
- :'guid' => :'String',
61
- :'group_guid' => :'String',
62
- :'resource_guid' => :'String',
63
- :'resource_type' => :'String',
64
- :'allowed_scopes' => :'Array<String>',
65
- :'created_at' => :'Time',
66
- :'updated_at' => :'Time'
67
- }
68
- end
69
-
70
- # List of attributes with nullable: true
71
- def self.openapi_nullable
72
- Set.new([
73
- ])
74
- end
75
-
76
- # Initializes the object
77
- # @param [Hash] attributes Model attributes in the form of hash
78
- def initialize(attributes = {})
79
- if (!attributes.is_a?(Hash))
80
- fail ArgumentError, "The input argument (attributes) must be a hash in `CybridApiId::GroupAuthorizationIdpModel` initialize method"
81
- end
82
-
83
- # check to see if the attribute exists and convert string to symbol for hash key
84
- attributes = attributes.each_with_object({}) { |(k, v), h|
85
- if (!self.class.attribute_map.key?(k.to_sym))
86
- fail ArgumentError, "`#{k}` is not a valid attribute in `CybridApiId::GroupAuthorizationIdpModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
- end
88
- h[k.to_sym] = v
89
- }
90
-
91
- if attributes.key?(:'guid')
92
- self.guid = attributes[:'guid']
93
- end
94
-
95
- if attributes.key?(:'group_guid')
96
- self.group_guid = attributes[:'group_guid']
97
- end
98
-
99
- if attributes.key?(:'resource_guid')
100
- self.resource_guid = attributes[:'resource_guid']
101
- end
102
-
103
- if attributes.key?(:'resource_type')
104
- self.resource_type = attributes[:'resource_type']
105
- end
106
-
107
- if attributes.key?(:'allowed_scopes')
108
- if (value = attributes[:'allowed_scopes']).is_a?(Array)
109
- self.allowed_scopes = value
110
- end
111
- end
112
-
113
- if attributes.key?(:'created_at')
114
- self.created_at = attributes[:'created_at']
115
- end
116
-
117
- if attributes.key?(:'updated_at')
118
- self.updated_at = attributes[:'updated_at']
119
- end
120
- end
121
-
122
- # Show invalid properties with the reasons. Usually used together with valid?
123
- # @return Array for valid properties with the reasons
124
- def list_invalid_properties
125
- invalid_properties = Array.new
126
- if @guid.nil?
127
- invalid_properties.push('invalid value for "guid", guid cannot be nil.')
128
- end
129
-
130
- if @group_guid.nil?
131
- invalid_properties.push('invalid value for "group_guid", group_guid cannot be nil.')
132
- end
133
-
134
- if @resource_guid.nil?
135
- invalid_properties.push('invalid value for "resource_guid", resource_guid cannot be nil.')
136
- end
137
-
138
- if @resource_type.nil?
139
- invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.')
140
- end
141
-
142
- if @allowed_scopes.nil?
143
- invalid_properties.push('invalid value for "allowed_scopes", allowed_scopes cannot be nil.')
144
- end
145
-
146
- if @created_at.nil?
147
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
148
- end
149
-
150
- invalid_properties
151
- end
152
-
153
- # Check to see if the all the properties in the model are valid
154
- # @return true if the model is valid
155
- def valid?
156
- return false if @guid.nil?
157
- return false if @group_guid.nil?
158
- return false if @resource_guid.nil?
159
- return false if @resource_type.nil?
160
- return false if @allowed_scopes.nil?
161
- return false if @created_at.nil?
162
- true
163
- end
164
-
165
- # Checks equality by comparing each attribute.
166
- # @param [Object] Object to be compared
167
- def ==(o)
168
- return true if self.equal?(o)
169
- self.class == o.class &&
170
- guid == o.guid &&
171
- group_guid == o.group_guid &&
172
- resource_guid == o.resource_guid &&
173
- resource_type == o.resource_type &&
174
- allowed_scopes == o.allowed_scopes &&
175
- created_at == o.created_at &&
176
- updated_at == o.updated_at
177
- end
178
-
179
- # @see the `==` method
180
- # @param [Object] Object to be compared
181
- def eql?(o)
182
- self == o
183
- end
184
-
185
- # Calculates hash code according to all attributes.
186
- # @return [Integer] Hash code
187
- def hash
188
- [guid, group_guid, resource_guid, resource_type, allowed_scopes, created_at, updated_at].hash
189
- end
190
-
191
- # Builds the object from hash
192
- # @param [Hash] attributes Model attributes in the form of hash
193
- # @return [Object] Returns the model itself
194
- def self.build_from_hash(attributes)
195
- new.build_from_hash(attributes)
196
- end
197
-
198
- # Builds the object from hash
199
- # @param [Hash] attributes Model attributes in the form of hash
200
- # @return [Object] Returns the model itself
201
- def build_from_hash(attributes)
202
- return nil unless attributes.is_a?(Hash)
203
- attributes = attributes.transform_keys(&:to_sym)
204
- self.class.openapi_types.each_pair do |key, type|
205
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
206
- self.send("#{key}=", nil)
207
- elsif type =~ /\AArray<(.*)>/i
208
- # check to ensure the input is an array given that the attribute
209
- # is documented as an array but the input is not
210
- if attributes[self.class.attribute_map[key]].is_a?(Array)
211
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
212
- end
213
- elsif !attributes[self.class.attribute_map[key]].nil?
214
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
215
- end
216
- end
217
-
218
- self
219
- end
220
-
221
- # Deserializes the data based on type
222
- # @param string type Data type
223
- # @param string value Value to be deserialized
224
- # @return [Object] Deserialized data
225
- def _deserialize(type, value)
226
- case type.to_sym
227
- when :Time
228
- Time.parse(value)
229
- when :Date
230
- Date.parse(value)
231
- when :String
232
- value.to_s
233
- when :Integer
234
- value.to_i
235
- when :Float
236
- value.to_f
237
- when :Boolean
238
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
239
- true
240
- else
241
- false
242
- end
243
- when :Object
244
- # generic object (usually a Hash), return directly
245
- value
246
- when /\AArray<(?<inner_type>.+)>\z/
247
- inner_type = Regexp.last_match[:inner_type]
248
- value.map { |v| _deserialize(inner_type, v) }
249
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
250
- k_type = Regexp.last_match[:k_type]
251
- v_type = Regexp.last_match[:v_type]
252
- {}.tap do |hash|
253
- value.each do |k, v|
254
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
255
- end
256
- end
257
- else # model
258
- # models (e.g. Pet) or oneOf
259
- klass = CybridApiId.const_get(type)
260
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
261
- end
262
- end
263
-
264
- # Returns the string representation of the object
265
- # @return [String] String presentation of the object
266
- def to_s
267
- to_hash.to_s
268
- end
269
-
270
- # to_body is an alias to to_hash (backward compatibility)
271
- # @return [Hash] Returns the object in the form of hash
272
- def to_body
273
- to_hash
274
- end
275
-
276
- # Returns the object in the form of hash
277
- # @return [Hash] Returns the object in the form of hash
278
- def to_hash
279
- hash = {}
280
- self.class.attribute_map.each_pair do |attr, param|
281
- value = self.send(attr)
282
- if value.nil?
283
- is_nullable = self.class.openapi_nullable.include?(attr)
284
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
- end
286
-
287
- hash[param] = _to_hash(value)
288
- end
289
- hash
290
- end
291
-
292
- # Outputs non-array value in the form of hash
293
- # For object, use to_hash. Otherwise, just return the value
294
- # @param [Object] value Any valid value
295
- # @return [Hash] Returns the value in the form of hash
296
- def _to_hash(value)
297
- if value.is_a?(Array)
298
- value.compact.map { |v| _to_hash(v) }
299
- elsif value.is_a?(Hash)
300
- {}.tap do |hash|
301
- value.each { |k, v| hash[k] = _to_hash(v) }
302
- end
303
- elsif value.respond_to? :to_hash
304
- value.to_hash
305
- else
306
- value
307
- end
308
- end
309
-
310
- end
311
-
312
- end