Class: EBSCO::EDS::RetrievalCriteria

Inherits:
Object
  • Object
show all
Includes:
JSONable
Defined in:
lib/ebsco/eds/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JSONable

#as_json, included, #to_json

Constructor Details

#initialize(options = {}, info) ⇒ RetrievalCriteria

Returns a new instance of RetrievalCriteria.



538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/ebsco/eds/options.rb', line 538

def initialize(options = {}, info)

  # defaults
  @View = info.default_result_list_view
  @IncludeImageQuickView = info.default_include_image_quick_view
  @ResultsPerPage = info.default_results_per_page
  @PageNumber = 1

  options.each do |key, value|

    case key

      # ====================================================================================
      # view
      # ====================================================================================
      when :view, 'view'
        if info.available_result_list_views.include? value.downcase
          @View = value.downcase
        else
          @View = info.default_result_list_view
        end

      # ====================================================================================
      # results per page
      # ====================================================================================
      when :results_per_page, 'results_per_page', 'rows', 'per_page'
        if value.to_i > info.max_results_per_page
          @ResultsPerPage = info.max_results_per_page
        else
          @ResultsPerPage = value.to_i
        end

      # ====================================================================================
      # page number
      # ====================================================================================
      when :page_number, 'page_number', 'page'
        @PageNumber = value.to_i
      # solr starts at page 0
      # when 'start'
      #  @PageNumber = value.to_i + 1

      # ====================================================================================
      # highlight
      # ====================================================================================
      when :highlight, 'highlight'
        @Highlight = value
      # solr/blacklight version
      when 'hl'
        if value == 'on'
          @Highlight = 'y'
        else
          @Highlight = 'y' # API bug: if set to 'n' you won't get research starter abstracts!
        end

      # ====================================================================================
      # image quick view
      # ====================================================================================
      when :include_image_quick_view, 'include_image_quick_view'
        @IncludeImageQuickView = value ? 'y' : 'n'

      else

    end

  end

end

Instance Attribute Details

#HighlightObject

Returns the value of attribute Highlight.



537
538
539
# File 'lib/ebsco/eds/options.rb', line 537

def Highlight
  @Highlight
end

#IncludeImageQuickViewObject

Returns the value of attribute IncludeImageQuickView.



537
538
539
# File 'lib/ebsco/eds/options.rb', line 537

def IncludeImageQuickView
  @IncludeImageQuickView
end

#PageNumberObject

Returns the value of attribute PageNumber.



537
538
539
# File 'lib/ebsco/eds/options.rb', line 537

def PageNumber
  @PageNumber
end

#ResultsPerPageObject

Returns the value of attribute ResultsPerPage.



537
538
539
# File 'lib/ebsco/eds/options.rb', line 537

def ResultsPerPage
  @ResultsPerPage
end

#ViewObject

Returns the value of attribute View.



537
538
539
# File 'lib/ebsco/eds/options.rb', line 537

def View
  @View
end