class Cryptopay::CoinWithdrawal

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

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

Public Instance Methods

address() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 75
def address
  @attributes[:address]
end
charged_amount() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 87
def charged_amount
  @attributes[:charged_amount]
end
charged_currency() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 91
def charged_currency
  @attributes[:charged_currency]
end
created_at() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 127
def created_at
  @attributes[:created_at]
end
custom_id() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 67
def custom_id
  @attributes[:custom_id]
end
customer_id() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 71
def customer_id
  @attributes[:customer_id]
end
exchange() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 119
def exchange
  @attributes[:exchange]
end
fee() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 111
def fee
  @attributes[:fee]
end
fee_currency() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 115
def fee_currency
  @attributes[:fee_currency]
end
id() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 63
def id
  @attributes[:id]
end
inspect() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 201
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/coin_withdrawal.rb, line 133
def invalid_properties
  properties = []

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

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

  if !status.nil? && !%w[new pending on_hold processing sent completed failed cancelled].include?(status)
    properties.push('invalid value for status, must be one of "new", "pending", "on_hold", "processing", "sent", "completed", "failed", "cancelled"')
  end

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

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

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

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

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

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

  if !network_fee_level.nil? && !%w[fast average slow].include?(network_fee_level)
    properties.push('invalid value for network_fee_level, must be one of "fast", "average", "slow"')
  end

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

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

  exchange&.invalid_properties&.each do |prop|
    properties.push("invalid value for \"exchange\": #{prop}")
  end

  risk&.invalid_properties&.each do |prop|
    properties.push("invalid value for \"risk\": #{prop}")
  end

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

  properties
end
network_fee() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 103
def network_fee
  @attributes[:network_fee]
end
network_fee_level() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 107
def network_fee_level
  @attributes[:network_fee_level]
end
received_amount() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 95
def received_amount
  @attributes[:received_amount]
end
received_currency() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 99
def received_currency
  @attributes[:received_currency]
end
risk() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 123
def risk
  @attributes[:risk]
end
status() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 83
def status
  @attributes[:status]
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/coin_withdrawal.rb, line 197
def to_hash
  ENCODER.to_hash(@attributes)
end
txid() click to toggle source
# File lib/cryptopay/models/coin_withdrawal.rb, line 79
def txid
  @attributes[:txid]
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/coin_withdrawal.rb, line 183
def valid?
  invalid_properties.empty?
end