Class: Cryptopay::RiskParams
- Inherits:
-
Object
- Object
- Cryptopay::RiskParams
- Defined in:
- lib/cryptopay/models/risk_params.rb
Class Method Summary collapse
-
.build_from_hash(data) ⇒ Cryptopay::RiskParams
Builds the object from hash.
Instance Method Summary collapse
-
#address ⇒ Object
Cryptocurrency address.
-
#currency ⇒ Object
Cryptocurrency symbol.
-
#initialize(attributes = {}) ⇒ RiskParams
constructor
Initializes the object.
- #inspect ⇒ Object
-
#invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
- #type ⇒ Object
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ RiskParams
Initializes the object
34 35 36 |
# File 'lib/cryptopay/models/risk_params.rb', line 34 def initialize(attributes = {}) @attributes = ENCODER.sanitize(attributes) end |
Class Method Details
.build_from_hash(data) ⇒ Cryptopay::RiskParams
Builds the object from hash
27 28 29 30 |
# File 'lib/cryptopay/models/risk_params.rb', line 27 def self.build_from_hash(data) attributes = ENCODER.build_from_hash(data) new(attributes) end |
Instance Method Details
#address ⇒ Object
Cryptocurrency address
39 40 41 |
# File 'lib/cryptopay/models/risk_params.rb', line 39 def address @attributes[:address] end |
#currency ⇒ Object
Cryptocurrency symbol
44 45 46 |
# File 'lib/cryptopay/models/risk_params.rb', line 44 def currency @attributes[:currency] end |
#inspect ⇒ Object
82 83 84 |
# File 'lib/cryptopay/models/risk_params.rb', line 82 def inspect "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash) end |
#invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cryptopay/models/risk_params.rb', line 54 def invalid_properties properties = [] properties.push('invalid value for "address", address cannot be nil.') if address.nil? properties.push('invalid value for "currency", currency cannot be nil.') if currency.nil? properties.push('invalid value for "type", type cannot be nil.') if type.nil? if !type.nil? && !%w[source_of_funds destination_of_funds].include?(type) properties.push('invalid value for type, must be one of "source_of_funds", "destination_of_funds"') end properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
78 79 80 |
# File 'lib/cryptopay/models/risk_params.rb', line 78 def to_hash ENCODER.to_hash(@attributes) end |
#type ⇒ Object
48 49 50 |
# File 'lib/cryptopay/models/risk_params.rb', line 48 def type @attributes[:type] end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
72 73 74 |
# File 'lib/cryptopay/models/risk_params.rb', line 72 def valid? invalid_properties.empty? end |