Sha256: 9f8af9ba211770978ae8753e65b64023f63184d10f7614184a00ee1ffe422b41

Contents?: true

Size: 760 Bytes

Versions: 15

Compression:

Stored size: 760 Bytes

Contents

module DynaModel
  class Response

    def initialize(response)
      raise ArgumentError, "response should be an AWS::Core::Response" unless response.is_a?(AWS::Core::Response)
      @raw_response = response
    end

    #def values_from_response_hash(options = {})
      #@raw_response.inject({}) do |h, (key, value_hash)|
        #h.update(key => value_hash.to_a.last)
      #end
    #end

    def count
      @raw_response[:count]
    end

    def last_evaluated_key
      @raw_response[:last_evaluated_key]
    end

    def more_results?
      @raw_response.has_key?(:last_evaluated_key)
    end

    def self.strip_attr_types(hash)
      attrs = {}
      hash.each_pair do |k,v|
        attrs[k] = v.values.first
      end
      attrs
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dyna_model-0.0.15 lib/dyna_model/response.rb
dyna_model-0.0.14 lib/dyna_model/response.rb
dyna_model-0.0.13 lib/dyna_model/response.rb
dyna_model-0.0.12 lib/dyna_model/response.rb
dyna_model-0.0.11 lib/dyna_model/response.rb
dyna_model-0.0.10 lib/dyna_model/response.rb
dyna_model-0.0.9 lib/dyna_model/response.rb
dyna_model-0.0.8 lib/dyna_model/response.rb
dyna_model-0.0.7 lib/dyna_model/response.rb
dyna_model-0.0.6 lib/dyna_model/response.rb
dyna_model-0.0.5 lib/dyna_model/response.rb
dyna_model-0.0.4 lib/dyna_model/response.rb
dyna_model-0.0.3 lib/dyna_model/response.rb
dyna_model-0.0.2 lib/dyna_model/response.rb
dyna_model-0.0.1 lib/dyna_model/response.rb