Class: Revver4R::SearchBase
- Inherits:
-
Object
- Object
- Revver4R::SearchBase
- Defined in:
- lib/revver4r.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#criteria ⇒ Object
Returns the value of attribute criteria.
-
#feed_contents ⇒ Object
Returns the value of attribute feed_contents.
-
#media ⇒ Object
Returns the value of attribute media.
Instance Method Summary collapse
-
#initialize(media = "flash", feed_contents = "tag", criteria = "rails", options = {"affiliate" => "chalkers"}) ⇒ SearchBase
constructor
A new instance of SearchBase.
- #search ⇒ Object
Constructor Details
#initialize(media = "flash", feed_contents = "tag", criteria = "rails", options = {"affiliate" => "chalkers"}) ⇒ SearchBase
Returns a new instance of SearchBase.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/revver4r.rb', line 43 def initialize(media="flash", feed_contents="tag", criteria="rails", = {"affiliate" => "chalkers"}) if POSSIBLE_MEDIA_TYPES.include? media @media = media else raise "Invalid 'media' type. Choose from " + POSSIBLE_MEDIA_TYPES.join[", "] end if POSSIBLE_CONTENTS.include? feed_contents @feed_contents = feed_contents else raise "Invalid 'feed_content' type. Choose from " + POSSIBLE_CONTENTS.join[", "] end @criteria = criteria .delete("affiliate") if ["affiliate"] == "" raise "Invalid 'offset' must be an Integer" if (.has_key?"offset" && ["offset"].is_a?(Integer)) raise "Invalid 'order'. Choose from "+ POSSIBLE_ORDERS.join[", "] if (.has_key?"order" && !POSSIBLE_ORDERS.include?(["order"])) raise "Invalid 'orderBy'. Choose from "+ POSSIBLE_ORDER_BYS.join[", "] if (.has_key?"orderBy" && !POSSIBLE_ORDER_BYS.include?(["order"])) ["minAgeRestriction","maxAgeRestriction"].each do |restriction| raise "Invalid '#{restriction}'. It must be between " + RESTRICTION_RANGE.first + " - " + RESTRICTION_RANGE.last if (.has_key?restriction && !RESTRICTION_RANGE.include?([restriction])) end @options = end |
Instance Attribute Details
#criteria ⇒ Object
Returns the value of attribute criteria.
42 43 44 |
# File 'lib/revver4r.rb', line 42 def criteria @criteria end |
#feed_contents ⇒ Object
Returns the value of attribute feed_contents.
42 43 44 |
# File 'lib/revver4r.rb', line 42 def feed_contents @feed_contents end |
#media ⇒ Object
Returns the value of attribute media.
42 43 44 |
# File 'lib/revver4r.rb', line 42 def media @media end |
Instance Method Details
#search ⇒ Object
70 71 72 |
# File 'lib/revver4r.rb', line 70 def search raise "'search' method not implemented" end |