class Cryptopay::Rate

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::Rate] Returns the model itself

# File lib/cryptopay/models/rate.rb, line 59
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/rate.rb, line 24
def initialize(attributes = {})
  @attributes = ENCODER.sanitize(attributes)
end

Public Instance Methods

buy_rate() click to toggle source

Buy rate

# File lib/cryptopay/models/rate.rb, line 29
def buy_rate
  @attributes[:buy_rate]
end
inspect() click to toggle source
# File lib/cryptopay/models/rate.rb, line 70
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/rate.rb, line 40
def invalid_properties
  properties = []

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

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

  properties
end
sell_rate() click to toggle source

Buy rate

# File lib/cryptopay/models/rate.rb, line 34
def sell_rate
  @attributes[:sell_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/rate.rb, line 66
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/rate.rb, line 52
def valid?
  invalid_properties.empty?
end