Module: Omise::Util
- Defined in:
- lib/omise/util.rb
Class Method Summary collapse
Class Method Details
.load_response(response) ⇒ Object
18 19 20 21 22 |
# File 'lib/omise/util.rb', line 18 def load_response(response) object = JSON.load(response) raise Omise::Error.new(object) if object["object"] == "error" object end |
.typecast(object) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/omise/util.rb', line 8 def typecast(object) klass = begin const_get(object["object"].capitalize) rescue NameError OmiseObject end klass.new(object) end |