Class: Smartcoin::Util
- Inherits:
-
Object
- Object
- Smartcoin::Util
- Defined in:
- lib/smartcoin/util.rb
Constant Summary collapse
- OBJECT_TYPES =
{ 'card' => Smartcoin::Card, 'charge' => Smartcoin::Charge, 'refund' => Smartcoin::Refund, 'fee' => Smartcoin::Fee, 'installment' => Smartcoin::Installment, 'Token' => Smartcoin::Token, }
Class Method Summary collapse
Class Method Details
.get_object_type(type) ⇒ Object
12 13 14 15 16 |
# File 'lib/smartcoin/util.rb', line 12 def self.get_object_type(type) object_type = Smartcoin::SmartcoinObject object_type = OBJECT_TYPES[type] if OBJECT_TYPES[type] object_type end |
.symbolize_names(object) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/smartcoin/util.rb', line 18 def self.symbolize_names(object) case object when Hash new = {} object.each do |key, value| key = (key.to_sym rescue key) || key new[key] = symbolize_names(value) end new when Array object.map { |value| symbolize_names(value) } else object end end |