Class: Bitstamper::Models::Deposit
- Defined in:
- lib/bitstamper/models/deposit.rb
Constant Summary collapse
- MAPPING =
{ "address" => :string, "amount" => :float, "confirmations" => :integer, }
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#confirmations ⇒ Object
Returns the value of attribute confirmations.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Deposit
constructor
A new instance of Deposit.
Methods inherited from Base
Constructor Details
#initialize(hash) ⇒ Deposit
Returns a new instance of Deposit.
12 13 14 15 16 17 18 |
# File 'lib/bitstamper/models/deposit.rb', line 12 def initialize(hash) hash.each do |key, value| type = ::Bitstamper::Models::Deposit::MAPPING.fetch(key, nil) value = value && type ? ::Bitstamper::Utilities::convert_value(value, type) : value self.send("#{key}=", value) if self.respond_to?(key) end end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/bitstamper/models/deposit.rb', line 4 def address @address end |
#amount ⇒ Object
Returns the value of attribute amount.
4 5 6 |
# File 'lib/bitstamper/models/deposit.rb', line 4 def amount @amount end |
#confirmations ⇒ Object
Returns the value of attribute confirmations.
4 5 6 |
# File 'lib/bitstamper/models/deposit.rb', line 4 def confirmations @confirmations end |
Class Method Details
.parse(data) ⇒ Object
20 21 22 |
# File 'lib/bitstamper/models/deposit.rb', line 20 def self.parse(data) data&.collect { |item| ::Bitstamper::Models::Deposit.new(item) } end |