Sha256: c0beb1fb981a1ccfc040e2b44de65aececb20d0b13c440e9fa789eca9779c0f0

Contents?: true

Size: 366 Bytes

Versions: 9

Compression:

Stored size: 366 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

          Object.const_get("Moneta::Api::Responses::#{ klass.to_s.camelize }").build(data)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
moneta-api-1.13.0 lib/moneta/api/response_factory.rb
moneta-api-1.12.8 lib/moneta/api/response_factory.rb
moneta-api-1.12.7 lib/moneta/api/response_factory.rb
moneta-api-1.12.6 lib/moneta/api/response_factory.rb
moneta-api-1.12.5 lib/moneta/api/response_factory.rb
moneta-api-1.12.4 lib/moneta/api/response_factory.rb
moneta-api-1.12.3 lib/moneta/api/response_factory.rb
moneta-api-1.12.2 lib/moneta/api/response_factory.rb
moneta-api-1.12.1 lib/moneta/api/response_factory.rb