class Cryptopay::InvoiceCallback

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

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

Public Instance Methods

data() click to toggle source
# File lib/cryptopay/models/invoice_callback.rb, line 38
def data
  @attributes[:data]
end
event() click to toggle source
# File lib/cryptopay/models/invoice_callback.rb, line 34
def event
  @attributes[:event]
end
inspect() click to toggle source
# File lib/cryptopay/models/invoice_callback.rb, line 86
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/invoice_callback.rb, line 44
def invalid_properties
  properties = []

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

  properties.push('invalid value for type, must be one of "Invoice"') if !type.nil? && !['Invoice'].include?(type)

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

  if !event.nil? && !%w[created refunded recalculated status_changed transaction_created transaction_confirmed].include?(event)
    properties.push('invalid value for event, must be one of "created", "refunded", "recalculated", "status_changed", "transaction_created", "transaction_confirmed"')
  end

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

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

  properties
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/invoice_callback.rb, line 82
def to_hash
  ENCODER.to_hash(@attributes)
end
type() click to toggle source
# File lib/cryptopay/models/invoice_callback.rb, line 30
def type
  @attributes[:type]
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/invoice_callback.rb, line 68
def valid?
  invalid_properties.empty?
end