=begin #Cybrid Bank API ## Welcome Welcome to the Cybrid platform; enabling turnkey crypto banking services! In these documents, you will find information on the operations provided by our platform, as well as details on how our REST API operates more generally. Our complete set of APIs allows you to manage all your resources: your Organization, your banks and your identities. 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 | | [Identities API](https://id.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage identities | When you're ready, [request access](https://www.cybrid.xyz/access) to your Dashboard to view and administer your Organization. Once you've logged in, you can begin creating Banks, either for sandbox or production usage, and start enabling your customers to leverage DeFi and web3 with confidence. If you have any questions, please contact [Support](mailto:support@cybrid.app) at any time so that we can help. ## Authentication 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 your Dashboard ([request access](https://www.cybrid.xyz/access)). An Organization Token applies broadly to the whole Organization and all of its Banks, whereas, a Bank Token is specific to an individual 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. **Never share your Client ID or Secret publicly or in your source code repository** 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: ``` curl -X POST https://id.demo.cybrid.app/oauth/token -d '{ \"grant_type\": \"client_credentials\", \"client_id\": \"\", \"client_secret\": \"\", \"scope\": \"\" }' -H \"Content-Type: application/json\" ``` ## 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 | Write scope | Execute scope | Token Type | |---------------|--------------------|----------------------|-------------------|--------------------| | Organizations | organizations:read | organizations:write | | Organization/ Bank | | Banks | banks:read | banks:write | banks:execute | Organization/ Bank | | Customers | customers:read | customers:write | customers:execute | Bank | | Assets | prices:read | | | Bank | | Accounts | accounts:read | | accounts:execute | Bank | | Prices | prices:read | | | Bank | | Symbols | prices:read | | | Bank | | Quotes | quotes:read | | quotes:execute | Bank | | Trades | trades:read | | trades:execute | Bank | ## Organizations An Organization is meant to model 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. An example of a Bank would be your customer facing banking website, or an internal staging environment for testing and integration. An Organization can have multiple banks, in sandbox or production environments. A sandbox Bank will be backed by stubbed data and process flows. For instance, identity record and funding source processes will be simulated rather than performed. ## 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. 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. See the Accounts APIs for more details on setting up accounts for the customer. The version of the OpenAPI document: v0.28.6 Contact: support@cybrid.app Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.0.0 =end require 'date' require 'time' module CybridApiBank class ExchangeAccountBankModel # The exchange account type. attr_accessor :type # Auto-generated unique identifier for exchange account. attr_accessor :guid # ISO8601 datetime the exchange account was created at. attr_accessor :created_at # The identifier of the exchange that owns this exchange account. attr_accessor :exchange_guid # The asset code of the exchange account. attr_accessor :asset_code class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values def initialize(datatype, allowable_values) @allowable_values = allowable_values.map do |value| case datatype.to_s when /Integer/i value.to_i when /Float/i value.to_f else value end end end def valid?(value) !value || allowable_values.include?(value) end end # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'type' => :'type', :'guid' => :'guid', :'created_at' => :'created_at', :'exchange_guid' => :'exchange_guid', :'asset_code' => :'asset_code' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'type' => :'String', :'guid' => :'String', :'created_at' => :'Time', :'exchange_guid' => :'String', :'asset_code' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `CybridApiBank::ExchangeAccountBankModel` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `CybridApiBank::ExchangeAccountBankModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'guid') self.guid = attributes[:'guid'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'exchange_guid') self.exchange_guid = attributes[:'exchange_guid'] end if attributes.key?(:'asset_code') self.asset_code = attributes[:'asset_code'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new if !@guid.nil? && @guid.to_s.length > 32 invalid_properties.push('invalid value for "guid", the character length must be smaller than or equal to 32.') end if !@guid.nil? && @guid.to_s.length < 32 invalid_properties.push('invalid value for "guid", the character length must be great than or equal to 32.') end if !@exchange_guid.nil? && @exchange_guid.to_s.length > 32 invalid_properties.push('invalid value for "exchange_guid", the character length must be smaller than or equal to 32.') end if !@exchange_guid.nil? && @exchange_guid.to_s.length < 32 invalid_properties.push('invalid value for "exchange_guid", the character length must be great than or equal to 32.') end if !@asset_code.nil? && @asset_code.to_s.length > 128 invalid_properties.push('invalid value for "asset_code", the character length must be smaller than or equal to 128.') end if !@asset_code.nil? && @asset_code.to_s.length < 1 invalid_properties.push('invalid value for "asset_code", the character length must be great than or equal to 1.') end invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? type_validator = EnumAttributeValidator.new('String', ["fiat", "crypto"]) return false unless type_validator.valid?(@type) return false if !@guid.nil? && @guid.to_s.length > 32 return false if !@guid.nil? && @guid.to_s.length < 32 return false if !@exchange_guid.nil? && @exchange_guid.to_s.length > 32 return false if !@exchange_guid.nil? && @exchange_guid.to_s.length < 32 return false if !@asset_code.nil? && @asset_code.to_s.length > 128 return false if !@asset_code.nil? && @asset_code.to_s.length < 1 true end # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) validator = EnumAttributeValidator.new('String', ["fiat", "crypto"]) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end @type = type end # Custom attribute writer method with validation # @param [Object] guid Value to be assigned def guid=(guid) if !guid.nil? && guid.to_s.length > 32 fail ArgumentError, 'invalid value for "guid", the character length must be smaller than or equal to 32.' end if !guid.nil? && guid.to_s.length < 32 fail ArgumentError, 'invalid value for "guid", the character length must be great than or equal to 32.' end @guid = guid end # Custom attribute writer method with validation # @param [Object] exchange_guid Value to be assigned def exchange_guid=(exchange_guid) if !exchange_guid.nil? && exchange_guid.to_s.length > 32 fail ArgumentError, 'invalid value for "exchange_guid", the character length must be smaller than or equal to 32.' end if !exchange_guid.nil? && exchange_guid.to_s.length < 32 fail ArgumentError, 'invalid value for "exchange_guid", the character length must be great than or equal to 32.' end @exchange_guid = exchange_guid end # Custom attribute writer method with validation # @param [Object] asset_code Value to be assigned def asset_code=(asset_code) if !asset_code.nil? && asset_code.to_s.length > 128 fail ArgumentError, 'invalid value for "asset_code", the character length must be smaller than or equal to 128.' end if !asset_code.nil? && asset_code.to_s.length < 1 fail ArgumentError, 'invalid value for "asset_code", the character length must be great than or equal to 1.' end @asset_code = asset_code end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && type == o.type && guid == o.guid && created_at == o.created_at && exchange_guid == o.exchange_guid && asset_code == o.asset_code end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [type, guid, created_at, exchange_guid, asset_code].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = CybridApiBank.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end