cybrid_api_bank_ruby 0.51.4 → 0.51.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +36 -24
  4. data/cybrid_api_bank_ruby.gemspec +2 -2
  5. data/docs/PostWorkflowBankModel.md +32 -0
  6. data/docs/WorkflowBankModel.md +24 -0
  7. data/docs/WorkflowWithDetailsAllOfBankModel.md +18 -0
  8. data/docs/WorkflowWithDetailsBankModel.md +26 -0
  9. data/docs/WorkflowsBankApi.md +236 -0
  10. data/docs/WorkflowsListBankModel.md +24 -0
  11. data/lib/cybrid_api_bank_ruby/api/accounts_bank_api.rb +2 -2
  12. data/lib/cybrid_api_bank_ruby/api/assets_bank_api.rb +2 -2
  13. data/lib/cybrid_api_bank_ruby/api/banks_bank_api.rb +2 -2
  14. data/lib/cybrid_api_bank_ruby/api/customers_bank_api.rb +2 -2
  15. data/lib/cybrid_api_bank_ruby/api/external_bank_accounts_bank_api.rb +2 -2
  16. data/lib/cybrid_api_bank_ruby/api/fee_configurations_bank_api.rb +2 -2
  17. data/lib/cybrid_api_bank_ruby/api/identity_records_bank_api.rb +2 -2
  18. data/lib/cybrid_api_bank_ruby/api/identity_verifications_bank_api.rb +2 -2
  19. data/lib/cybrid_api_bank_ruby/api/prices_bank_api.rb +2 -2
  20. data/lib/cybrid_api_bank_ruby/api/quotes_bank_api.rb +2 -2
  21. data/lib/cybrid_api_bank_ruby/api/rewards_bank_api.rb +2 -2
  22. data/lib/cybrid_api_bank_ruby/api/symbols_bank_api.rb +2 -2
  23. data/lib/cybrid_api_bank_ruby/api/trades_bank_api.rb +2 -2
  24. data/lib/cybrid_api_bank_ruby/api/verification_keys_bank_api.rb +2 -2
  25. data/lib/cybrid_api_bank_ruby/api/workflows_bank_api.rb +237 -0
  26. data/lib/cybrid_api_bank_ruby/api_client.rb +2 -2
  27. data/lib/cybrid_api_bank_ruby/api_error.rb +2 -2
  28. data/lib/cybrid_api_bank_ruby/configuration.rb +2 -2
  29. data/lib/cybrid_api_bank_ruby/models/account_bank_model.rb +2 -2
  30. data/lib/cybrid_api_bank_ruby/models/account_list_bank_model.rb +2 -2
  31. data/lib/cybrid_api_bank_ruby/models/asset_bank_model.rb +2 -2
  32. data/lib/cybrid_api_bank_ruby/models/asset_list_bank_model.rb +2 -2
  33. data/lib/cybrid_api_bank_ruby/models/attestation_details_bank_model.rb +2 -2
  34. data/lib/cybrid_api_bank_ruby/models/bank_bank_model.rb +2 -2
  35. data/lib/cybrid_api_bank_ruby/models/bank_list_bank_model.rb +2 -2
  36. data/lib/cybrid_api_bank_ruby/models/customer_bank_model.rb +2 -2
  37. data/lib/cybrid_api_bank_ruby/models/customer_list_bank_model.rb +2 -2
  38. data/lib/cybrid_api_bank_ruby/models/error_response_bank_model.rb +2 -2
  39. data/lib/cybrid_api_bank_ruby/models/external_bank_account_bank_model.rb +2 -2
  40. data/lib/cybrid_api_bank_ruby/models/external_bank_account_list_bank_model.rb +2 -2
  41. data/lib/cybrid_api_bank_ruby/models/fee_bank_model.rb +2 -2
  42. data/lib/cybrid_api_bank_ruby/models/fee_configuration_bank_model.rb +2 -2
  43. data/lib/cybrid_api_bank_ruby/models/fee_configuration_list_bank_model.rb +2 -2
  44. data/lib/cybrid_api_bank_ruby/models/identity_record_bank_model.rb +2 -2
  45. data/lib/cybrid_api_bank_ruby/models/identity_record_list_bank_model.rb +2 -2
  46. data/lib/cybrid_api_bank_ruby/models/identity_verification_bank_model.rb +2 -2
  47. data/lib/cybrid_api_bank_ruby/models/identity_verification_list_bank_model.rb +2 -2
  48. data/lib/cybrid_api_bank_ruby/models/patch_bank_bank_model.rb +2 -2
  49. data/lib/cybrid_api_bank_ruby/models/post_account_bank_model.rb +2 -2
  50. data/lib/cybrid_api_bank_ruby/models/post_bank_bank_model.rb +2 -2
  51. data/lib/cybrid_api_bank_ruby/models/post_customer_bank_model.rb +2 -2
  52. data/lib/cybrid_api_bank_ruby/models/post_external_bank_account_bank_model.rb +2 -2
  53. data/lib/cybrid_api_bank_ruby/models/post_fee_bank_model.rb +2 -2
  54. data/lib/cybrid_api_bank_ruby/models/post_fee_configuration_bank_model.rb +2 -2
  55. data/lib/cybrid_api_bank_ruby/models/post_identity_record_attestation_details_bank_model.rb +2 -2
  56. data/lib/cybrid_api_bank_ruby/models/post_identity_record_bank_model.rb +2 -2
  57. data/lib/cybrid_api_bank_ruby/models/post_identity_verification_bank_model.rb +2 -2
  58. data/lib/cybrid_api_bank_ruby/models/post_quote_bank_model.rb +2 -2
  59. data/lib/cybrid_api_bank_ruby/models/post_reward_bank_model.rb +2 -2
  60. data/lib/cybrid_api_bank_ruby/models/post_trade_bank_model.rb +2 -2
  61. data/lib/cybrid_api_bank_ruby/models/post_verification_key_bank_model.rb +2 -2
  62. data/lib/cybrid_api_bank_ruby/models/post_workflow_bank_model.rb +475 -0
  63. data/lib/cybrid_api_bank_ruby/models/quote_bank_model.rb +2 -2
  64. data/lib/cybrid_api_bank_ruby/models/quote_list_bank_model.rb +2 -2
  65. data/lib/cybrid_api_bank_ruby/models/reward_bank_model.rb +2 -2
  66. data/lib/cybrid_api_bank_ruby/models/reward_list_bank_model.rb +2 -2
  67. data/lib/cybrid_api_bank_ruby/models/symbol_price_bank_model.rb +2 -2
  68. data/lib/cybrid_api_bank_ruby/models/trade_bank_model.rb +2 -2
  69. data/lib/cybrid_api_bank_ruby/models/trade_list_bank_model.rb +2 -2
  70. data/lib/cybrid_api_bank_ruby/models/verification_key_bank_model.rb +2 -2
  71. data/lib/cybrid_api_bank_ruby/models/verification_key_list_bank_model.rb +2 -2
  72. data/lib/cybrid_api_bank_ruby/models/workflow_bank_model.rb +332 -0
  73. data/lib/cybrid_api_bank_ruby/models/workflow_with_details_all_of_bank_model.rb +221 -0
  74. data/lib/cybrid_api_bank_ruby/models/workflow_with_details_bank_model.rb +351 -0
  75. data/lib/cybrid_api_bank_ruby/models/workflows_list_bank_model.rb +329 -0
  76. data/lib/cybrid_api_bank_ruby/version.rb +3 -3
  77. data/lib/cybrid_api_bank_ruby.rb +8 -2
  78. data/spec/api/accounts_bank_api_spec.rb +2 -2
  79. data/spec/api/assets_bank_api_spec.rb +2 -2
  80. data/spec/api/banks_bank_api_spec.rb +2 -2
  81. data/spec/api/customers_bank_api_spec.rb +2 -2
  82. data/spec/api/external_bank_accounts_bank_api_spec.rb +2 -2
  83. data/spec/api/fee_configurations_bank_api_spec.rb +2 -2
  84. data/spec/api/identity_records_bank_api_spec.rb +2 -2
  85. data/spec/api/identity_verifications_bank_api_spec.rb +2 -2
  86. data/spec/api/prices_bank_api_spec.rb +2 -2
  87. data/spec/api/quotes_bank_api_spec.rb +2 -2
  88. data/spec/api/rewards_bank_api_spec.rb +2 -2
  89. data/spec/api/symbols_bank_api_spec.rb +2 -2
  90. data/spec/api/trades_bank_api_spec.rb +2 -2
  91. data/spec/api/verification_keys_bank_api_spec.rb +2 -2
  92. data/spec/api/workflows_bank_api_spec.rb +75 -0
  93. data/spec/api_client_spec.rb +2 -2
  94. data/spec/configuration_spec.rb +2 -2
  95. data/spec/models/account_bank_model_spec.rb +2 -2
  96. data/spec/models/account_list_bank_model_spec.rb +2 -2
  97. data/spec/models/asset_bank_model_spec.rb +2 -2
  98. data/spec/models/asset_list_bank_model_spec.rb +2 -2
  99. data/spec/models/attestation_details_bank_model_spec.rb +2 -2
  100. data/spec/models/bank_bank_model_spec.rb +2 -2
  101. data/spec/models/bank_list_bank_model_spec.rb +2 -2
  102. data/spec/models/customer_bank_model_spec.rb +2 -2
  103. data/spec/models/customer_list_bank_model_spec.rb +2 -2
  104. data/spec/models/error_response_bank_model_spec.rb +2 -2
  105. data/spec/models/external_bank_account_bank_model_spec.rb +2 -2
  106. data/spec/models/external_bank_account_list_bank_model_spec.rb +2 -2
  107. data/spec/models/fee_bank_model_spec.rb +2 -2
  108. data/spec/models/fee_configuration_bank_model_spec.rb +2 -2
  109. data/spec/models/fee_configuration_list_bank_model_spec.rb +2 -2
  110. data/spec/models/identity_record_bank_model_spec.rb +2 -2
  111. data/spec/models/identity_record_list_bank_model_spec.rb +2 -2
  112. data/spec/models/identity_verification_bank_model_spec.rb +2 -2
  113. data/spec/models/identity_verification_list_bank_model_spec.rb +2 -2
  114. data/spec/models/patch_bank_bank_model_spec.rb +2 -2
  115. data/spec/models/post_account_bank_model_spec.rb +2 -2
  116. data/spec/models/post_bank_bank_model_spec.rb +2 -2
  117. data/spec/models/post_customer_bank_model_spec.rb +2 -2
  118. data/spec/models/post_external_bank_account_bank_model_spec.rb +2 -2
  119. data/spec/models/post_fee_bank_model_spec.rb +2 -2
  120. data/spec/models/post_fee_configuration_bank_model_spec.rb +2 -2
  121. data/spec/models/post_identity_record_attestation_details_bank_model_spec.rb +2 -2
  122. data/spec/models/post_identity_record_bank_model_spec.rb +2 -2
  123. data/spec/models/post_identity_verification_bank_model_spec.rb +2 -2
  124. data/spec/models/post_quote_bank_model_spec.rb +2 -2
  125. data/spec/models/post_reward_bank_model_spec.rb +2 -2
  126. data/spec/models/post_trade_bank_model_spec.rb +2 -2
  127. data/spec/models/post_verification_key_bank_model_spec.rb +2 -2
  128. data/spec/models/post_workflow_bank_model_spec.rb +88 -0
  129. data/spec/models/quote_bank_model_spec.rb +2 -2
  130. data/spec/models/quote_list_bank_model_spec.rb +2 -2
  131. data/spec/models/reward_bank_model_spec.rb +2 -2
  132. data/spec/models/reward_list_bank_model_spec.rb +2 -2
  133. data/spec/models/symbol_price_bank_model_spec.rb +2 -2
  134. data/spec/models/trade_bank_model_spec.rb +2 -2
  135. data/spec/models/trade_list_bank_model_spec.rb +2 -2
  136. data/spec/models/verification_key_bank_model_spec.rb +2 -2
  137. data/spec/models/verification_key_list_bank_model_spec.rb +2 -2
  138. data/spec/models/workflow_bank_model_spec.rb +56 -0
  139. data/spec/models/workflow_with_details_all_of_bank_model_spec.rb +34 -0
  140. data/spec/models/workflow_with_details_bank_model_spec.rb +62 -0
  141. data/spec/models/workflows_list_bank_model_spec.rb +52 -0
  142. data/spec/spec_helper.rb +2 -2
  143. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/byebug-11.1.3/gem_make.out +2 -2
  144. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/ffi-1.15.5/gem_make.out +2 -2
  145. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/jaro_winkler-1.5.4/gem_make.out +2 -2
  146. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.6/gem_make.out +2 -2
  147. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/stringio-3.0.2/gem_make.out +2 -2
  148. data/vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/ext/byebug/Makefile +2 -2
  149. data/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
  150. data/vendor/bundle/ruby/3.1.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler/Makefile +2 -2
  151. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.6/ext/psych/Makefile +2 -2
  152. data/vendor/bundle/ruby/3.1.0/gems/stringio-3.0.2/ext/stringio/Makefile +2 -2
  153. metadata +25 -1
@@ -0,0 +1,332 @@
1
+ =begin
2
+ #Cybrid Bank 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.demo.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. [Getting Started in the Cybrid Sandbox](https://www.cybrid.xyz/guides/getting-started) 2. [Getting Ready for Trading](https://www.cybrid.xyz/guides/getting-ready-for-trading) 3. [Running the Web Demo App](https://www.cybrid.xyz/guides/running-the-cybrid-web-demo-crypto-app) (or, alternatively, [Testing with Hosted Web Demo App](https://www.cybrid.xyz/guides/testing-with-the-web-demo-crypo-app)) In [Getting Started in the Cybrid Sandbox](https://www.cybrid.xyz/guides/getting-started), we walk you through how to use the [Cybrid Sandbox](https://id.demo.cybrid.app/) to create a test bank, generate API keys, and set banks fees. In [Getting Ready for Trading](https://www.cybrid.xyz/guides/getting-ready-for-trading), we walk through creating customers, customer identities, accounts, as well as executing quotes and trades. If you've already run through the first two guides, you can follow the [Running the Web Demo App](https://www.cybrid.xyz/guides/running-the-cybrid-web-demo-crypto-app) guide to test our web SDK with your sandbox `bank` and `customer`. ## 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), Apple-coming soon) 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.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage organizations | | [Bank API](https://bank.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage banks (and all downstream customer activity) | | [Identities API](https://id.demo.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.demo.cybrid.app). Access tokens can be generated for a `Customer` as well via the [Cybrid IdP](https://id.demo.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. <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. ``` curl -X POST https://id.demo.cybrid.app/oauth/token -d '{ \"grant_type\": \"client_credentials\", \"client_id\": \"<Your Client ID>\", \"client_secret\": \"<Your Secret>\", \"scope\": \"banks:read banks:write accounts:read accounts:execute customers:read customers:write customers:execute prices:read quotes:execute trades:execute trades:read\" }' -H \"Content-Type: application/json\" ``` <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 or a Bank 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) | |------------------------|------------------------------------------------------------|------------------------------------|-------------------------------------------------| | Organizations | organizations:read (Organization) | organizations:write (Organization) | | | Banks | banks:read (Organization, Bank) | banks:write (Organization, Bank) | banks:execute (Organization) | | Customers | customers:read (Organization, Bank, Customer) | customers:write (Bank, Customer) | customers:execute (Bank) | | Accounts | accounts:read (Organization, Bank, Customer) | | accounts:execute (Bank, Customer) | | Prices | prices:read (Bank, Customer) | | | | Quotes | quotes:read (Organization, Bank, Customer) | | quotes:execute (Bank, Customer) | | Trades | trades:read (Organization, Bank, Customer) | | trades:execute (Bank) | | Rewards | rewards:read (Bank, Customer) | | rewards:execute (Bank) | | External bank accounts | external_bank_accounts:read (Organization, Bank, Customer) | | external_bank_accounts:execute (Bank, Customer) | | Workflows | workflows:read (Organization, Bank, Customer) | | workflows:execute (Bank, Customer) | ## Available Endpoints The available APIs for the [Identity](https://id.demo.cybrid.app/api/schema/swagger-ui), [Organization](https://organization.demo.cybrid.app/api/schema/swagger-ui) and [Bank](https://bank.demo.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 | Organization | /api/organization_applications | Create and list organizations | | Identity | CustomerToken | /api/customer_tokens | Create customer JWT access tokens | | Organization | Organization | /api/organizations | APIs to retrieve and update organization name | | Bank | Asset | /api/assets | Get a list of assets supported by the platform (ex: BTC, ETH) | | Bank | VerificationKey | /api/bank_verification_keys | Create, list and retrive verification keys, used for signing identities | | Bank | Banks | /api/banks | Create, update and list banks, the parent to customers, accounts, etc | | Bank | FeeConfiguration | /api/fee_configurations | Create and list bank fees (spread or fixed) | | Bank | Customers | /api/customers | Create and list customers | | Bank | IdentityRecord | /api/identity_records | Create and list identity records, which are attached to customers for KYC | | Bank | Accounts | /api/accounts | Create and list accounts, which hold a specific asset for a customers | | Bank | Symbols | /api/symbols | Get a list of symbols supported for trade (ex: BTC-USD) | | Bank | Prices | /api/prices | Get the current prices for assets on the platform | | Bank | Quotes | /api/quotes | Create and list quotes, which are required to execute trades | | Bank | Trades | /api/trades | Create and list trades, which buy or sell cryptocurrency | | Bank | Rewards | /api/rewards | Create a new reward (automates quote/trade for simplicity) | | Bank | ExternalBankAccounts | /api/external_bank_accounts | Create, get and list external bank accounts, which connect customer bank accounts to the platform | | Bank | Workflows | /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` 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 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 processes will be simulated rather than performed, however asset prices are representative of real-world values. You have an unlimited amout 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 in our system before they can play any part on the platform, which means they must have an associated and valid `Identity Record`. See the Identity Records 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.51.6
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 CybridApiBank
17
+ class WorkflowBankModel
18
+ # Auto-generated unique identifier for the workflow.
19
+ attr_accessor :guid
20
+
21
+ # The associated customer's identifier.
22
+ attr_accessor :customer_guid
23
+
24
+ # The type of workflow.
25
+ attr_accessor :type
26
+
27
+ # ISO8601 datetime the bank was created at.
28
+ attr_accessor :created_at
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'guid' => :'guid',
56
+ :'customer_guid' => :'customer_guid',
57
+ :'type' => :'type',
58
+ :'created_at' => :'created_at'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'guid' => :'String',
71
+ :'customer_guid' => :'String',
72
+ :'type' => :'String',
73
+ :'created_at' => :'Time'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CybridApiBank::WorkflowBankModel` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CybridApiBank::WorkflowBankModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'guid')
99
+ self.guid = attributes[:'guid']
100
+ end
101
+
102
+ if attributes.key?(:'customer_guid')
103
+ self.customer_guid = attributes[:'customer_guid']
104
+ end
105
+
106
+ if attributes.key?(:'type')
107
+ self.type = attributes[:'type']
108
+ end
109
+
110
+ if attributes.key?(:'created_at')
111
+ self.created_at = attributes[:'created_at']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if !@guid.nil? && @guid.to_s.length > 32
120
+ invalid_properties.push('invalid value for "guid", the character length must be smaller than or equal to 32.')
121
+ end
122
+
123
+ if !@guid.nil? && @guid.to_s.length < 32
124
+ invalid_properties.push('invalid value for "guid", the character length must be great than or equal to 32.')
125
+ end
126
+
127
+ if !@customer_guid.nil? && @customer_guid.to_s.length > 32
128
+ invalid_properties.push('invalid value for "customer_guid", the character length must be smaller than or equal to 32.')
129
+ end
130
+
131
+ if !@customer_guid.nil? && @customer_guid.to_s.length < 32
132
+ invalid_properties.push('invalid value for "customer_guid", the character length must be great than or equal to 32.')
133
+ end
134
+
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if !@guid.nil? && @guid.to_s.length > 32
142
+ return false if !@guid.nil? && @guid.to_s.length < 32
143
+ return false if !@customer_guid.nil? && @customer_guid.to_s.length > 32
144
+ return false if !@customer_guid.nil? && @customer_guid.to_s.length < 32
145
+ type_validator = EnumAttributeValidator.new('String', ["plaid"])
146
+ return false unless type_validator.valid?(@type)
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] guid Value to be assigned
152
+ def guid=(guid)
153
+ if !guid.nil? && guid.to_s.length > 32
154
+ fail ArgumentError, 'invalid value for "guid", the character length must be smaller than or equal to 32.'
155
+ end
156
+
157
+ if !guid.nil? && guid.to_s.length < 32
158
+ fail ArgumentError, 'invalid value for "guid", the character length must be great than or equal to 32.'
159
+ end
160
+
161
+ @guid = guid
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] customer_guid Value to be assigned
166
+ def customer_guid=(customer_guid)
167
+ if !customer_guid.nil? && customer_guid.to_s.length > 32
168
+ fail ArgumentError, 'invalid value for "customer_guid", the character length must be smaller than or equal to 32.'
169
+ end
170
+
171
+ if !customer_guid.nil? && customer_guid.to_s.length < 32
172
+ fail ArgumentError, 'invalid value for "customer_guid", the character length must be great than or equal to 32.'
173
+ end
174
+
175
+ @customer_guid = customer_guid
176
+ end
177
+
178
+ # Custom attribute writer method checking allowed values (enum).
179
+ # @param [Object] type Object to be assigned
180
+ def type=(type)
181
+ validator = EnumAttributeValidator.new('String', ["plaid"])
182
+ unless validator.valid?(type)
183
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
184
+ end
185
+ @type = type
186
+ end
187
+
188
+ # Checks equality by comparing each attribute.
189
+ # @param [Object] Object to be compared
190
+ def ==(o)
191
+ return true if self.equal?(o)
192
+ self.class == o.class &&
193
+ guid == o.guid &&
194
+ customer_guid == o.customer_guid &&
195
+ type == o.type &&
196
+ created_at == o.created_at
197
+ end
198
+
199
+ # @see the `==` method
200
+ # @param [Object] Object to be compared
201
+ def eql?(o)
202
+ self == o
203
+ end
204
+
205
+ # Calculates hash code according to all attributes.
206
+ # @return [Integer] Hash code
207
+ def hash
208
+ [guid, customer_guid, type, created_at].hash
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def self.build_from_hash(attributes)
215
+ new.build_from_hash(attributes)
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ attributes = attributes.transform_keys(&:to_sym)
224
+ self.class.openapi_types.each_pair do |key, type|
225
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
226
+ self.send("#{key}=", nil)
227
+ elsif type =~ /\AArray<(.*)>/i
228
+ # check to ensure the input is an array given that the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
231
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
232
+ end
233
+ elsif !attributes[self.class.attribute_map[key]].nil?
234
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
235
+ end
236
+ end
237
+
238
+ self
239
+ end
240
+
241
+ # Deserializes the data based on type
242
+ # @param string type Data type
243
+ # @param string value Value to be deserialized
244
+ # @return [Object] Deserialized data
245
+ def _deserialize(type, value)
246
+ case type.to_sym
247
+ when :Time
248
+ Time.parse(value)
249
+ when :Date
250
+ Date.parse(value)
251
+ when :String
252
+ value.to_s
253
+ when :Integer
254
+ value.to_i
255
+ when :Float
256
+ value.to_f
257
+ when :Boolean
258
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
259
+ true
260
+ else
261
+ false
262
+ end
263
+ when :Object
264
+ # generic object (usually a Hash), return directly
265
+ value
266
+ when /\AArray<(?<inner_type>.+)>\z/
267
+ inner_type = Regexp.last_match[:inner_type]
268
+ value.map { |v| _deserialize(inner_type, v) }
269
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
270
+ k_type = Regexp.last_match[:k_type]
271
+ v_type = Regexp.last_match[:v_type]
272
+ {}.tap do |hash|
273
+ value.each do |k, v|
274
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
275
+ end
276
+ end
277
+ else # model
278
+ # models (e.g. Pet) or oneOf
279
+ klass = CybridApiBank.const_get(type)
280
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
281
+ end
282
+ end
283
+
284
+ # Returns the string representation of the object
285
+ # @return [String] String presentation of the object
286
+ def to_s
287
+ to_hash.to_s
288
+ end
289
+
290
+ # to_body is an alias to to_hash (backward compatibility)
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_body
293
+ to_hash
294
+ end
295
+
296
+ # Returns the object in the form of hash
297
+ # @return [Hash] Returns the object in the form of hash
298
+ def to_hash
299
+ hash = {}
300
+ self.class.attribute_map.each_pair do |attr, param|
301
+ value = self.send(attr)
302
+ if value.nil?
303
+ is_nullable = self.class.openapi_nullable.include?(attr)
304
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
305
+ end
306
+
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ # Outputs non-array value in the form of hash
313
+ # For object, use to_hash. Otherwise, just return the value
314
+ # @param [Object] value Any valid value
315
+ # @return [Hash] Returns the value in the form of hash
316
+ def _to_hash(value)
317
+ if value.is_a?(Array)
318
+ value.compact.map { |v| _to_hash(v) }
319
+ elsif value.is_a?(Hash)
320
+ {}.tap do |hash|
321
+ value.each { |k, v| hash[k] = _to_hash(v) }
322
+ end
323
+ elsif value.respond_to? :to_hash
324
+ value.to_hash
325
+ else
326
+ value
327
+ end
328
+ end
329
+
330
+ end
331
+
332
+ end
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Cybrid Bank 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.demo.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. [Getting Started in the Cybrid Sandbox](https://www.cybrid.xyz/guides/getting-started) 2. [Getting Ready for Trading](https://www.cybrid.xyz/guides/getting-ready-for-trading) 3. [Running the Web Demo App](https://www.cybrid.xyz/guides/running-the-cybrid-web-demo-crypto-app) (or, alternatively, [Testing with Hosted Web Demo App](https://www.cybrid.xyz/guides/testing-with-the-web-demo-crypo-app)) In [Getting Started in the Cybrid Sandbox](https://www.cybrid.xyz/guides/getting-started), we walk you through how to use the [Cybrid Sandbox](https://id.demo.cybrid.app/) to create a test bank, generate API keys, and set banks fees. In [Getting Ready for Trading](https://www.cybrid.xyz/guides/getting-ready-for-trading), we walk through creating customers, customer identities, accounts, as well as executing quotes and trades. If you've already run through the first two guides, you can follow the [Running the Web Demo App](https://www.cybrid.xyz/guides/running-the-cybrid-web-demo-crypto-app) guide to test our web SDK with your sandbox `bank` and `customer`. ## 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), Apple-coming soon) 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.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage organizations | | [Bank API](https://bank.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage banks (and all downstream customer activity) | | [Identities API](https://id.demo.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.demo.cybrid.app). Access tokens can be generated for a `Customer` as well via the [Cybrid IdP](https://id.demo.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. <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. ``` curl -X POST https://id.demo.cybrid.app/oauth/token -d '{ \"grant_type\": \"client_credentials\", \"client_id\": \"<Your Client ID>\", \"client_secret\": \"<Your Secret>\", \"scope\": \"banks:read banks:write accounts:read accounts:execute customers:read customers:write customers:execute prices:read quotes:execute trades:execute trades:read\" }' -H \"Content-Type: application/json\" ``` <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 or a Bank 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) | |------------------------|------------------------------------------------------------|------------------------------------|-------------------------------------------------| | Organizations | organizations:read (Organization) | organizations:write (Organization) | | | Banks | banks:read (Organization, Bank) | banks:write (Organization, Bank) | banks:execute (Organization) | | Customers | customers:read (Organization, Bank, Customer) | customers:write (Bank, Customer) | customers:execute (Bank) | | Accounts | accounts:read (Organization, Bank, Customer) | | accounts:execute (Bank, Customer) | | Prices | prices:read (Bank, Customer) | | | | Quotes | quotes:read (Organization, Bank, Customer) | | quotes:execute (Bank, Customer) | | Trades | trades:read (Organization, Bank, Customer) | | trades:execute (Bank) | | Rewards | rewards:read (Bank, Customer) | | rewards:execute (Bank) | | External bank accounts | external_bank_accounts:read (Organization, Bank, Customer) | | external_bank_accounts:execute (Bank, Customer) | | Workflows | workflows:read (Organization, Bank, Customer) | | workflows:execute (Bank, Customer) | ## Available Endpoints The available APIs for the [Identity](https://id.demo.cybrid.app/api/schema/swagger-ui), [Organization](https://organization.demo.cybrid.app/api/schema/swagger-ui) and [Bank](https://bank.demo.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 | Organization | /api/organization_applications | Create and list organizations | | Identity | CustomerToken | /api/customer_tokens | Create customer JWT access tokens | | Organization | Organization | /api/organizations | APIs to retrieve and update organization name | | Bank | Asset | /api/assets | Get a list of assets supported by the platform (ex: BTC, ETH) | | Bank | VerificationKey | /api/bank_verification_keys | Create, list and retrive verification keys, used for signing identities | | Bank | Banks | /api/banks | Create, update and list banks, the parent to customers, accounts, etc | | Bank | FeeConfiguration | /api/fee_configurations | Create and list bank fees (spread or fixed) | | Bank | Customers | /api/customers | Create and list customers | | Bank | IdentityRecord | /api/identity_records | Create and list identity records, which are attached to customers for KYC | | Bank | Accounts | /api/accounts | Create and list accounts, which hold a specific asset for a customers | | Bank | Symbols | /api/symbols | Get a list of symbols supported for trade (ex: BTC-USD) | | Bank | Prices | /api/prices | Get the current prices for assets on the platform | | Bank | Quotes | /api/quotes | Create and list quotes, which are required to execute trades | | Bank | Trades | /api/trades | Create and list trades, which buy or sell cryptocurrency | | Bank | Rewards | /api/rewards | Create a new reward (automates quote/trade for simplicity) | | Bank | ExternalBankAccounts | /api/external_bank_accounts | Create, get and list external bank accounts, which connect customer bank accounts to the platform | | Bank | Workflows | /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` 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 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 processes will be simulated rather than performed, however asset prices are representative of real-world values. You have an unlimited amout 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 in our system before they can play any part on the platform, which means they must have an associated and valid `Identity Record`. See the Identity Records 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.51.6
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 CybridApiBank
17
+ class WorkflowWithDetailsAllOfBankModel
18
+ # The Plaid link token generated by the workflow.
19
+ attr_accessor :plaid_link_token
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'plaid_link_token' => :'plaid_link_token'
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
+ :'plaid_link_token' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ :'plaid_link_token'
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CybridApiBank::WorkflowWithDetailsAllOfBankModel` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CybridApiBank::WorkflowWithDetailsAllOfBankModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'plaid_link_token')
63
+ self.plaid_link_token = attributes[:'plaid_link_token']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ plaid_link_token == o.plaid_link_token
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [plaid_link_token].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = CybridApiBank.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end