Sha256: 1e08802078b234266296c81aa030543c7adffe8afb7faf9906bda48bda8b3e2e
Contents?: true
Size: 495 Bytes
Versions: 2
Compression:
Stored size: 495 Bytes
Contents
module Moneta module Api class ResponseFactory class << self # @param [Savon::Response] # @return [Moneta::Api::Responses::*] def build(response) klass, data = response.to_hash.to_a.first klass = classify(klass) Object.const_get("Moneta::Api::Responses::#{ klass }").build(data) end private def classify(str) str.to_s.split('_').map(&:capitalize).join end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
moneta-api-1.0.1 | lib/moneta/api/response_factory.rb |
moneta-api-1.0.0 | lib/moneta/api/response_factory.rb |