=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.25.2 Contact: support@cybrid.app Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.4.0 =end require 'date' require 'time' module CybridApiBank class PostQuoteBankModel # The unique identifier for the customer. attr_accessor :customer_guid # Symbol the quote is being requested for. Format is \"asset-counter_asset\" in uppercase. See the Symbols API for a complete list of cryptocurrencies supported. attr_accessor :symbol # The direction of the quote: either 'buy' or 'sell'. attr_accessor :side # The amount to be received in base units of the currency: currency is \"asset\" for buy and \"counter_asset\" for sell. attr_accessor :receive_amount # The amount to be delivered in base units of the currency: currency is \"counter_asset\" for buy and \"asset\" for sell. attr_accessor :deliver_amount 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 { :'customer_guid' => :'customer_guid', :'symbol' => :'symbol', :'side' => :'side', :'receive_amount' => :'receive_amount', :'deliver_amount' => :'deliver_amount' } 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 { :'customer_guid' => :'String', :'symbol' => :'String', :'side' => :'String', :'receive_amount' => :'Integer', :'deliver_amount' => :'Integer' } 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::PostQuoteBankModel` 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::PostQuoteBankModel`. 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?(:'customer_guid') self.customer_guid = attributes[:'customer_guid'] end if attributes.key?(:'symbol') self.symbol = attributes[:'symbol'] end if attributes.key?(:'side') self.side = attributes[:'side'] end if attributes.key?(:'receive_amount') self.receive_amount = attributes[:'receive_amount'] end if attributes.key?(:'deliver_amount') self.deliver_amount = attributes[:'deliver_amount'] 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 @customer_guid.nil? invalid_properties.push('invalid value for "customer_guid", customer_guid cannot be nil.') end if @customer_guid.to_s.length > 32 invalid_properties.push('invalid value for "customer_guid", the character length must be smaller than or equal to 32.') end if @customer_guid.to_s.length < 32 invalid_properties.push('invalid value for "customer_guid", the character length must be great than or equal to 32.') end if @symbol.nil? invalid_properties.push('invalid value for "symbol", symbol cannot be nil.') end if @symbol.to_s.length > 16 invalid_properties.push('invalid value for "symbol", the character length must be smaller than or equal to 16.') end if @symbol.to_s.length < 1 invalid_properties.push('invalid value for "symbol", the character length must be great than or equal to 1.') end if @side.nil? invalid_properties.push('invalid value for "side", side cannot be nil.') 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? return false if @customer_guid.nil? return false if @customer_guid.to_s.length > 32 return false if @customer_guid.to_s.length < 32 return false if @symbol.nil? return false if @symbol.to_s.length > 16 return false if @symbol.to_s.length < 1 return false if @side.nil? side_validator = EnumAttributeValidator.new('String', ["buy", "sell"]) return false unless side_validator.valid?(@side) true end # Custom attribute writer method with validation # @param [Object] customer_guid Value to be assigned def customer_guid=(customer_guid) if customer_guid.nil? fail ArgumentError, 'customer_guid cannot be nil' end if customer_guid.to_s.length > 32 fail ArgumentError, 'invalid value for "customer_guid", the character length must be smaller than or equal to 32.' end if customer_guid.to_s.length < 32 fail ArgumentError, 'invalid value for "customer_guid", the character length must be great than or equal to 32.' end @customer_guid = customer_guid end # Custom attribute writer method with validation # @param [Object] symbol Value to be assigned def symbol=(symbol) if symbol.nil? fail ArgumentError, 'symbol cannot be nil' end if symbol.to_s.length > 16 fail ArgumentError, 'invalid value for "symbol", the character length must be smaller than or equal to 16.' end if symbol.to_s.length < 1 fail ArgumentError, 'invalid value for "symbol", the character length must be great than or equal to 1.' end @symbol = symbol end # Custom attribute writer method checking allowed values (enum). # @param [Object] side Object to be assigned def side=(side) validator = EnumAttributeValidator.new('String', ["buy", "sell"]) unless validator.valid?(side) fail ArgumentError, "invalid value for \"side\", must be one of #{validator.allowable_values}." end @side = side 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 && customer_guid == o.customer_guid && symbol == o.symbol && side == o.side && receive_amount == o.receive_amount && deliver_amount == o.deliver_amount 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 [customer_guid, symbol, side, receive_amount, deliver_amount].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) 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