cybrid_api_id_ruby 0.129.1263 → 0.129.1266

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +10 -5
  4. data/cybrid_api_id_ruby.gemspec +1 -1
  5. data/docs/AccessTokenIdpModel.md +32 -0
  6. data/docs/AccessTokenListIdpModel.md +24 -0
  7. data/docs/AuthorizationIdpModel.md +34 -0
  8. data/docs/AuthorizationListIdpModel.md +24 -0
  9. data/docs/PatchAuthorizationIdpModel.md +18 -0
  10. data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
  11. data/lib/cybrid_api_id_ruby/api/customer_tokens_idp_api.rb +1 -1
  12. data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
  13. data/lib/cybrid_api_id_ruby/api/users_idp_api.rb +1 -1
  14. data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
  15. data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
  16. data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
  17. data/lib/cybrid_api_id_ruby/models/access_token_idp_model.rb +321 -0
  18. data/lib/cybrid_api_id_ruby/models/access_token_list_idp_model.rb +331 -0
  19. data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
  20. data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
  21. data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
  22. data/lib/cybrid_api_id_ruby/models/authorization_idp_model.rb +379 -0
  23. data/lib/cybrid_api_id_ruby/models/authorization_list_idp_model.rb +331 -0
  24. data/lib/cybrid_api_id_ruby/models/customer_token_idp_model.rb +1 -1
  25. data/lib/cybrid_api_id_ruby/models/error_response_idp_model.rb +1 -1
  26. data/lib/cybrid_api_id_ruby/models/patch_application_idp_model.rb +1 -1
  27. data/lib/cybrid_api_id_ruby/models/patch_authorization_idp_model.rb +252 -0
  28. data/lib/cybrid_api_id_ruby/models/patch_user_idp_model.rb +1 -1
  29. data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
  30. data/lib/cybrid_api_id_ruby/models/post_customer_token_idp_model.rb +1 -1
  31. data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
  32. data/lib/cybrid_api_id_ruby/models/post_user_idp_model.rb +1 -1
  33. data/lib/cybrid_api_id_ruby/models/user_idp_model.rb +1 -1
  34. data/lib/cybrid_api_id_ruby/models/user_list_idp_model.rb +1 -1
  35. data/lib/cybrid_api_id_ruby/version.rb +2 -2
  36. data/lib/cybrid_api_id_ruby.rb +6 -1
  37. data/spec/api/bank_applications_idp_api_spec.rb +1 -1
  38. data/spec/api/customer_tokens_idp_api_spec.rb +1 -1
  39. data/spec/api/organization_applications_idp_api_spec.rb +1 -1
  40. data/spec/api/users_idp_api_spec.rb +1 -1
  41. data/spec/models/access_token_idp_model_spec.rb +78 -0
  42. data/spec/models/access_token_list_idp_model_spec.rb +54 -0
  43. data/spec/models/application_idp_model_spec.rb +1 -1
  44. data/spec/models/application_list_idp_model_spec.rb +1 -1
  45. data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
  46. data/spec/models/authorization_idp_model_spec.rb +88 -0
  47. data/spec/models/authorization_list_idp_model_spec.rb +54 -0
  48. data/spec/models/customer_token_idp_model_spec.rb +1 -1
  49. data/spec/models/error_response_idp_model_spec.rb +1 -1
  50. data/spec/models/patch_application_idp_model_spec.rb +1 -1
  51. data/spec/models/patch_authorization_idp_model_spec.rb +40 -0
  52. data/spec/models/patch_user_idp_model_spec.rb +1 -1
  53. data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
  54. data/spec/models/post_customer_token_idp_model_spec.rb +1 -1
  55. data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
  56. data/spec/models/post_user_idp_model_spec.rb +1 -1
  57. data/spec/models/user_idp_model_spec.rb +1 -1
  58. data/spec/models/user_list_idp_model_spec.rb +1 -1
  59. data/spec/spec_helper.rb +1 -1
  60. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/byebug-13.0.0/gem_make.out +5 -5
  61. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/date-3.6.0/gem_make.out +5 -5
  62. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/io-console-0.9.4/gem_make.out +5 -5
  63. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  64. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/psych-5.5.0/gem_make.out +5 -5
  65. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem_make.out +5 -5
  66. data/vendor/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/stringio-3.2.0/gem_make.out +5 -5
  67. metadata +21 -1
@@ -0,0 +1,379 @@
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 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 transactions:read transfers:execute transfers:read transfers:write external_bank_accounts:read external_bank_accounts:pii:read transfers: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 banks:read banks:write banks:execute bank_applications:read users:read counterparties:read counterparties:pii:read customers:read customers:pii:read accounts:read accounts:write prices:read quotes:execute quotes:read trades:execute trades:read transactions:read transfers:read transfers:write transfers:execute external_bank_accounts:read external_bank_accounts:pii:read transfers: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) | | Bank Application | bank_applications:read (Organization, Bank) | | | | 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 Application | organization_applications:read (Organization) | | | | Organization | organizations:read (Organization) | organizations:write (Organization) | | | User | users:read (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) | API keys and organization users are created, updated and deleted only in the Partner Portal. Tokens issued for an organization API key can list and get organization applications, bank applications and users, and tokens issued for a bank API key can list and get bank applications; neither can create, update or delete them. Requesting the `organization_applications:write`, `organization_applications:execute`, `bank_applications:write`, `bank_applications:execute`, `users:write` or `users:execute` scopes alongside other scopes is tolerated: they are dropped and the token is issued with the rest. ## 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 | Get and list bank API keys | | Identity | CustomerToken | /api/customer_tokens | Create customer JWT access tokens | | Identity | Organization | /api/organization_applications | Get and list organization API keys | | Identity | Organization | /api/users | Get 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 | Get and list invoices | | Bank | PaymentInstruction | /api/payment_instructions | 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.1266
7
+ Contact: support@cybrid.app
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CybridApiId
17
+ class AuthorizationIdpModel
18
+ # Identifier of the user authorization.
19
+ attr_accessor :id
20
+
21
+ # Guid of the user.
22
+ attr_accessor :user_guid
23
+
24
+ # Type of the resource the authorization is on.
25
+ attr_accessor :resource_type
26
+
27
+ # Guid of the resource the authorization is on.
28
+ attr_accessor :resource_guid
29
+
30
+ # Portal the authorization routes to. Null for authorizations that have no portal.
31
+ attr_accessor :portal
32
+
33
+ # The list of scopes that the user is allowed to request.
34
+ attr_accessor :allowed_scopes
35
+
36
+ # ISO8601 datetime the authorization was disabled at. Null for enabled authorizations.
37
+ attr_accessor :disabled_at
38
+
39
+ # ISO8601 datetime the record was created at.
40
+ attr_accessor :created_at
41
+
42
+ # ISO8601 datetime the record was last updated at.
43
+ attr_accessor :updated_at
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
+ :'id' => :'id',
71
+ :'user_guid' => :'user_guid',
72
+ :'resource_type' => :'resource_type',
73
+ :'resource_guid' => :'resource_guid',
74
+ :'portal' => :'portal',
75
+ :'allowed_scopes' => :'allowed_scopes',
76
+ :'disabled_at' => :'disabled_at',
77
+ :'created_at' => :'created_at',
78
+ :'updated_at' => :'updated_at'
79
+ }
80
+ end
81
+
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ attribute_map.values
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'id' => :'Integer',
91
+ :'user_guid' => :'String',
92
+ :'resource_type' => :'String',
93
+ :'resource_guid' => :'String',
94
+ :'portal' => :'String',
95
+ :'allowed_scopes' => :'Array<String>',
96
+ :'disabled_at' => :'Time',
97
+ :'created_at' => :'Time',
98
+ :'updated_at' => :'Time'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ :'portal',
106
+ :'disabled_at',
107
+ ])
108
+ end
109
+
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ if (!attributes.is_a?(Hash))
114
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CybridApiId::AuthorizationIdpModel` initialize method"
115
+ end
116
+
117
+ # check to see if the attribute exists and convert string to symbol for hash key
118
+ attributes = attributes.each_with_object({}) { |(k, v), h|
119
+ if (!self.class.attribute_map.key?(k.to_sym))
120
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CybridApiId::AuthorizationIdpModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
121
+ end
122
+ h[k.to_sym] = v
123
+ }
124
+
125
+ if attributes.key?(:'id')
126
+ self.id = attributes[:'id']
127
+ else
128
+ self.id = nil
129
+ end
130
+
131
+ if attributes.key?(:'user_guid')
132
+ self.user_guid = attributes[:'user_guid']
133
+ else
134
+ self.user_guid = nil
135
+ end
136
+
137
+ if attributes.key?(:'resource_type')
138
+ self.resource_type = attributes[:'resource_type']
139
+ else
140
+ self.resource_type = nil
141
+ end
142
+
143
+ if attributes.key?(:'resource_guid')
144
+ self.resource_guid = attributes[:'resource_guid']
145
+ else
146
+ self.resource_guid = nil
147
+ end
148
+
149
+ if attributes.key?(:'portal')
150
+ self.portal = attributes[:'portal']
151
+ else
152
+ self.portal = nil
153
+ end
154
+
155
+ if attributes.key?(:'allowed_scopes')
156
+ if (value = attributes[:'allowed_scopes']).is_a?(Array)
157
+ self.allowed_scopes = value
158
+ end
159
+ else
160
+ self.allowed_scopes = nil
161
+ end
162
+
163
+ if attributes.key?(:'disabled_at')
164
+ self.disabled_at = attributes[:'disabled_at']
165
+ else
166
+ self.disabled_at = nil
167
+ end
168
+
169
+ if attributes.key?(:'created_at')
170
+ self.created_at = attributes[:'created_at']
171
+ else
172
+ self.created_at = nil
173
+ end
174
+
175
+ if attributes.key?(:'updated_at')
176
+ self.updated_at = attributes[:'updated_at']
177
+ end
178
+ end
179
+
180
+ # Show invalid properties with the reasons. Usually used together with valid?
181
+ # @return Array for valid properties with the reasons
182
+ def list_invalid_properties
183
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
184
+ invalid_properties = Array.new
185
+ if @id.nil?
186
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
187
+ end
188
+
189
+ if @user_guid.nil?
190
+ invalid_properties.push('invalid value for "user_guid", user_guid cannot be nil.')
191
+ end
192
+
193
+ if @resource_type.nil?
194
+ invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.')
195
+ end
196
+
197
+ if @resource_guid.nil?
198
+ invalid_properties.push('invalid value for "resource_guid", resource_guid cannot be nil.')
199
+ end
200
+
201
+ if @allowed_scopes.nil?
202
+ invalid_properties.push('invalid value for "allowed_scopes", allowed_scopes cannot be nil.')
203
+ end
204
+
205
+ if @created_at.nil?
206
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
207
+ end
208
+
209
+ invalid_properties
210
+ end
211
+
212
+ # Check to see if the all the properties in the model are valid
213
+ # @return true if the model is valid
214
+ def valid?
215
+ warn '[DEPRECATED] the `valid?` method is obsolete'
216
+ return false if @id.nil?
217
+ return false if @user_guid.nil?
218
+ return false if @resource_type.nil?
219
+ resource_type_validator = EnumAttributeValidator.new('String', ["organization", "customer"])
220
+ return false unless resource_type_validator.valid?(@resource_type)
221
+ return false if @resource_guid.nil?
222
+ return false if @allowed_scopes.nil?
223
+ return false if @created_at.nil?
224
+ true
225
+ end
226
+
227
+ # Custom attribute writer method checking allowed values (enum).
228
+ # @param [Object] resource_type Object to be assigned
229
+ def resource_type=(resource_type)
230
+ validator = EnumAttributeValidator.new('String', ["organization", "customer"])
231
+ unless validator.valid?(resource_type)
232
+ fail ArgumentError, "invalid value for \"resource_type\", must be one of #{validator.allowable_values}."
233
+ end
234
+ @resource_type = resource_type
235
+ end
236
+
237
+ # Checks equality by comparing each attribute.
238
+ # @param [Object] Object to be compared
239
+ def ==(o)
240
+ return true if self.equal?(o)
241
+ self.class == o.class &&
242
+ id == o.id &&
243
+ user_guid == o.user_guid &&
244
+ resource_type == o.resource_type &&
245
+ resource_guid == o.resource_guid &&
246
+ portal == o.portal &&
247
+ allowed_scopes == o.allowed_scopes &&
248
+ disabled_at == o.disabled_at &&
249
+ created_at == o.created_at &&
250
+ updated_at == o.updated_at
251
+ end
252
+
253
+ # @see the `==` method
254
+ # @param [Object] Object to be compared
255
+ def eql?(o)
256
+ self == o
257
+ end
258
+
259
+ # Calculates hash code according to all attributes.
260
+ # @return [Integer] Hash code
261
+ def hash
262
+ [id, user_guid, resource_type, resource_guid, portal, allowed_scopes, disabled_at, created_at, updated_at].hash
263
+ end
264
+
265
+ # Builds the object from hash
266
+ # @param [Hash] attributes Model attributes in the form of hash
267
+ # @return [Object] Returns the model itself
268
+ def self.build_from_hash(attributes)
269
+ return nil unless attributes.is_a?(Hash)
270
+ attributes = attributes.transform_keys(&:to_sym)
271
+ transformed_hash = {}
272
+ openapi_types.each_pair do |key, type|
273
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
274
+ transformed_hash["#{key}"] = nil
275
+ elsif type =~ /\AArray<(.*)>/i
276
+ # check to ensure the input is an array given that the attribute
277
+ # is documented as an array but the input is not
278
+ if attributes[attribute_map[key]].is_a?(Array)
279
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
280
+ end
281
+ elsif !attributes[attribute_map[key]].nil?
282
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
283
+ end
284
+ end
285
+ new(transformed_hash)
286
+ end
287
+
288
+ # Deserializes the data based on type
289
+ # @param string type Data type
290
+ # @param string value Value to be deserialized
291
+ # @return [Object] Deserialized data
292
+ def self._deserialize(type, value)
293
+ case type.to_sym
294
+ when :Time
295
+ Time.parse(value)
296
+ when :Date
297
+ Date.parse(value)
298
+ when :String
299
+ value.to_s
300
+ when :Integer
301
+ value.to_i
302
+ when :Float
303
+ value.to_f
304
+ when :Boolean
305
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
306
+ true
307
+ else
308
+ false
309
+ end
310
+ when :Object
311
+ # generic object (usually a Hash), return directly
312
+ value
313
+ when /\AArray<(?<inner_type>.+)>\z/
314
+ inner_type = Regexp.last_match[:inner_type]
315
+ value.map { |v| _deserialize(inner_type, v) }
316
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
317
+ k_type = Regexp.last_match[:k_type]
318
+ v_type = Regexp.last_match[:v_type]
319
+ {}.tap do |hash|
320
+ value.each do |k, v|
321
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
322
+ end
323
+ end
324
+ else # model
325
+ # models (e.g. Pet) or oneOf
326
+ klass = CybridApiId.const_get(type)
327
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
328
+ end
329
+ end
330
+
331
+ # Returns the string representation of the object
332
+ # @return [String] String presentation of the object
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_hash (backward compatibility)
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_body
340
+ to_hash
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ if value.nil?
350
+ is_nullable = self.class.openapi_nullable.include?(attr)
351
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
352
+ end
353
+
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ # Outputs non-array value in the form of hash
360
+ # For object, use to_hash. Otherwise, just return the value
361
+ # @param [Object] value Any valid value
362
+ # @return [Hash] Returns the value in the form of hash
363
+ def _to_hash(value)
364
+ if value.is_a?(Array)
365
+ value.compact.map { |v| _to_hash(v) }
366
+ elsif value.is_a?(Hash)
367
+ {}.tap do |hash|
368
+ value.each { |k, v| hash[k] = _to_hash(v) }
369
+ end
370
+ elsif value.respond_to? :to_hash
371
+ value.to_hash
372
+ else
373
+ value
374
+ end
375
+ end
376
+
377
+ end
378
+
379
+ end