class Cryptopay::Exchange

Exchange details

Constants

ENCODER

Public Class Methods

build_from_hash(data) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Cryptopay::Exchange] Returns the model itself

# File lib/cryptopay/models/exchange.rb, line 74
def self.build_from_hash(data)
  attributes = ENCODER.build_from_hash(data)
  new(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/cryptopay/models/exchange.rb, line 29
def initialize(attributes = {})
  @attributes = ENCODER.sanitize(attributes)
end

Public Instance Methods

fee() click to toggle source

Exchange fee

# File lib/cryptopay/models/exchange.rb, line 44
def fee
  @attributes[:fee]
end
fee_currency() click to toggle source

Exchange fee currency

# File lib/cryptopay/models/exchange.rb, line 49
def fee_currency
  @attributes[:fee_currency]
end
inspect() click to toggle source
# File lib/cryptopay/models/exchange.rb, line 85
def inspect
  "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
end
invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/cryptopay/models/exchange.rb, line 55
def invalid_properties
  properties = []

  properties.push('invalid value for "pair", pair cannot be nil.') if pair.nil?

  properties.push('invalid value for "rate", rate cannot be nil.') if rate.nil?

  properties
end
pair() click to toggle source

Currency pair

# File lib/cryptopay/models/exchange.rb, line 34
def pair
  @attributes[:pair]
end
rate() click to toggle source

Exchange rate

# File lib/cryptopay/models/exchange.rb, line 39
def rate
  @attributes[:rate]
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/cryptopay/models/exchange.rb, line 81
def to_hash
  ENCODER.to_hash(@attributes)
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/cryptopay/models/exchange.rb, line 67
def valid?
  invalid_properties.empty?
end