Class: IOTA::Models::Input
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#keyIndex ⇒ Object
Returns the value of attribute keyIndex.
-
#security ⇒ Object
Returns the value of attribute security.
Instance Method Summary collapse
-
#initialize(options) ⇒ Input
constructor
A new instance of Input.
- #valid? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Input
Returns a new instance of Input.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/iota/models/input.rb', line 6 def initialize() utils = IOTA::Utils::Utils.new = symbolize_keys() @address = [:address] || nil if @address.nil? raise StandardError, "address not provided for transfer" end if @address.length == 90 && !utils.isValidChecksum(@address) raise StandardError, "Invalid checksum: #{thisTransfer[:address]}" end @address = utils.noChecksum(@address) if @address.length == 90 @keyIndex = [:keyIndex] @security = [:security] @balance = [:balance] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/iota/models/input.rb', line 4 def address @address end |
#balance ⇒ Object
Returns the value of attribute balance.
4 5 6 |
# File 'lib/iota/models/input.rb', line 4 def balance @balance end |
#keyIndex ⇒ Object
Returns the value of attribute keyIndex.
4 5 6 |
# File 'lib/iota/models/input.rb', line 4 def keyIndex @keyIndex end |
#security ⇒ Object
Returns the value of attribute security.
4 5 6 |
# File 'lib/iota/models/input.rb', line 4 def security @security end |
Instance Method Details
#valid? ⇒ Boolean
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/iota/models/input.rb', line 26 def valid? keysToValidate = [ { key: 'address', validator: :isAddress, args: nil }, { key: 'security', validator: :isValue, args: nil }, { key: 'keyIndex', validator: :isValue, args: nil } ] validator = IOTA::Utils::ObjectValidator.new(keysToValidate) validator.valid?(self) end |