class Cryptopay::ChannelPayment

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

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

Public Instance Methods

address() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 136
def address
  @attributes[:address]
end
channel_id() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 72
def channel_id
  @attributes[:channel_id]
end
coin_withdrawal_id() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 124
def coin_withdrawal_id
  @attributes[:coin_withdrawal_id]
end
created_at() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 140
def created_at
  @attributes[:created_at]
end
custom_id() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 128
def custom_id
  @attributes[:custom_id]
end
customer_id() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 132
def customer_id
  @attributes[:customer_id]
end
exchange() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 104
def exchange
  @attributes[:exchange]
end
fee() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 92
def fee
  @attributes[:fee]
end
fee_currency() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 96
def fee_currency
  @attributes[:fee_currency]
end
id() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 68
def id
  @attributes[:id]
end
inspect() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 212
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/channel_payment.rb, line 146
def invalid_properties
  properties = []

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

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

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

  properties.push('invalid value for "paid_currency", paid_currency cannot be nil.') if paid_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 "fee", fee cannot be nil.') if fee.nil?

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

  properties.push('invalid value for "txid", txid cannot be nil.') if txid.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 "status", status cannot be nil.') if status.nil?

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

  if !status_context.nil? && !%w[illicit_resource channel_disabled].include?(status_context)
    properties.push('invalid value for status_context, must be one of "illicit_resource", "channel_disabled"')
  end

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

  properties
end
paid_amount() click to toggle source
paid_currency() click to toggle source
received_amount() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 84
def received_amount
  @attributes[:received_amount]
end
received_currency() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 88
def received_currency
  @attributes[:received_currency]
end
refund_address() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 120
def refund_address
  @attributes[:refund_address]
end
risk() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 108
def risk
  @attributes[:risk]
end
status() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 112
def status
  @attributes[:status]
end
status_context() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 116
def status_context
  @attributes[:status_context]
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/channel_payment.rb, line 208
def to_hash
  ENCODER.to_hash(@attributes)
end
txid() click to toggle source
# File lib/cryptopay/models/channel_payment.rb, line 100
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/channel_payment.rb, line 194
def valid?
  invalid_properties.empty?
end