Class: CrystalApi::Money

Inherits:
Money
  • Object
show all
Defined in:
lib/crystal_api/money.rb

Class Method Summary collapse

Class Method Details

.from_json(hash) ⇒ Object



3
4
5
6
# File 'lib/crystal_api/money.rb', line 3

def self.from_json(hash)
  attrs = hash.fetch('money', {})
  ::Money.new(attrs.fetch('cents', 0), attrs.fetch('currency', 'USD'))
end