Sha256: fe9a285fb7aaa57f9c70f106aea6213674040333f1d80cede7e156e09628ba9d

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

module EndecaOnDemand
  class Response
    class BusinessRulesResult
      class BusinessRule < EndecaOnDemand::Proxy

        include EndecaOnDemand::PP

        def inspect_attributes; [ :options, :properties, :records_set ]; end

        ## fields ##

        attr_reader :options, :properties, :records_set

        def initialize(records_set, xml)
          @records_set, @xml = records_set, xml

          define_getters(:options)
        end

        ## override proxy ##

        def class
          EndecaOnDemand::Response::BusinessRulesResult::BusinessRule
        end

        ##

        ## associations ##

        def properties
          @properties ||= EndecaOnDemand::Collection.new(EndecaOnDemand::Response::Property, xml.children.css('properties'), self)
        end

        def records_set
          @records_set ||= EndecaOnDemand::Response::RecordsSet.new(self, xml.children.css('RecordsSet'))
        end

        ##

        ## data ##

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

        ##

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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