Sha256: e96279f423a298c451b3806f0b34756ac702171b2b4f8561a699da5e798a2249

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

module EndecaOnDemand
  class Response
    class Dimension < EndecaOnDemand::Proxy

      include EndecaOnDemand::PP

      def inspect_attributes; [ :dimension_values, :options ]; end

      ## fields ##

      attr_reader :dimension_values, :options, :response
      
      def initialize(response, xml)
        @response, @xml = response, xml

        define_getters(:options)
      end

      ## override proxy ##

      def class
        EndecaOnDemand::Response::Dimension
      end

      ##

      ## associations ##

      def dimension_values
        @dimension_values ||= EndecaOnDemand::Collection.new(EndecaOnDemand::Response::Dimension::DimensionValue, xml.children.css('DimensionValues > DimensionValue'), self)
      end

      ##

      ## data ##

      def options
        @options ||= xml.xpath('child::node()[not(local-name() = "DimensionValues")]').inject({}) do |hash,child|
            hash.tap do
              hash[child.name] = child.content
            end
          end.symbolize_keys
      end

      ##

    end
  end
end

require 'endeca_on_demand/response/dimension/dimension_value'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
endeca_on_demand-1.3.4 lib/endeca_on_demand/response/dimension.rb
endeca_on_demand-1.3.3 lib/endeca_on_demand/response/dimension.rb
endeca_on_demand-1.3.2 lib/endeca_on_demand/response/dimension.rb
endeca_on_demand-1.3.1 lib/endeca_on_demand/response/dimension.rb
endeca_on_demand-1.3.0 lib/endeca_on_demand/response/dimension.rb