Sha256: 17e8ed99fb5620563243c3e8541b940c5d455f5e89adfef6bf445b2981dff447

Contents?: true

Size: 453 Bytes

Versions: 14

Compression:

Stored size: 453 Bytes

Contents

# encoding: utf-8

require 'faraday'

module Nimbu
  class Response::Mashify < Response
    dependency 'hashie/mash'

    define_parser do |body|
      ::Hashie::Mash.new body
    end

    def parse(body)
      case body
      when Hash
        self.class.parser.call body
      when Array
        body.map { |item| item.is_a?(Hash) ? self.class.parser.call(item) : item }
      else
        body
      end
    end
  end # Response::Mashify
end # Nimbu

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
nimbu-api-0.3.0 lib/nimbu-api/response/mashify.rb
nimbu-api-0.2.1 lib/nimbu-api/response/mashify.rb
nimbu-api-0.2 lib/nimbu-api/response/mashify.rb
nimbu-api-0.2.beta.3 lib/nimbu-api/response/mashify.rb
nimbu-api-0.2.beta.2 lib/nimbu-api/response/mashify.rb
nimbu-api-0.2.beta.1 lib/nimbu-api/response/mashify.rb
nimbu-api-0.2.beta lib/nimbu-api/response/mashify.rb
nimbu-api-0.1.5 lib/nimbu-api/response/mashify.rb
nimbu-api-0.1.4 lib/nimbu-api/response/mashify.rb
nimbu-api-0.1.3 lib/nimbu-api/response/mashify.rb
nimbu-api-0.1.1 lib/nimbu-api/response/mashify.rb
nimbu-api-0.1 lib/nimbu-api/response/mashify.rb
nimbu-api-0.0.2 lib/nimbu-api/response/mashify.rb
nimbu-api-0.0.1 lib/nimbu-api/response/mashify.rb