class Cryptopay::Risk

Transaction risk level 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::Risk] Returns the model itself

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

Public Instance Methods

inspect() click to toggle source
# File lib/cryptopay/models/risk.rb, line 94
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/risk.rb, line 54
def invalid_properties
  properties = []

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

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

  if !level.nil? && !%w[low medium high].include?(level)
    properties.push('invalid value for level, must be one of "low", "medium", "high"')
  end

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

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

  properties
end
level() click to toggle source
# File lib/cryptopay/models/risk.rb, line 38
def level
  @attributes[:level]
end
resource_category() click to toggle source

A resource category the transaction has been received from

# File lib/cryptopay/models/risk.rb, line 48
def resource_category
  @attributes[:resource_category]
end
resource_name() click to toggle source

A resource name the transaction has been received from

# File lib/cryptopay/models/risk.rb, line 43
def resource_name
  @attributes[:resource_name]
end
score() click to toggle source

Transaction risk score

# File lib/cryptopay/models/risk.rb, line 34
def score
  @attributes[:score]
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/risk.rb, line 90
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/risk.rb, line 76
def valid?
  invalid_properties.empty?
end