Class: OCLC::Classify
- Inherits:
-
Object
- Object
- OCLC::Classify
- Defined in:
- lib/oclc_classify.rb
Defined Under Namespace
Classes: Recommendations, Response
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #classify ⇒ Object
-
#initialize(input, value, summary = false, orderBy = nil, maxRecs = nil) ⇒ Classify
constructor
oclc = OCLC::Classify.new ‘oclc’, ‘610837844’ result = oclc.classify p result.author p result.title r = result.recommendations ‘ddc’, :popular s = result.recommendations ‘ddc’, :recent t = result.recommendations ‘ddc’, :latest p r p s p t r.each {|k,v| puts k }.
- #maxRecs(number) ⇒ Object
- #orderBy(entry) ⇒ Object
Constructor Details
#initialize(input, value, summary = false, orderBy = nil, maxRecs = nil) ⇒ Classify
oclc = OCLC::Classify.new ‘oclc’, ‘610837844’ result = oclc.classify p result.author p result.title r = result.recommendations ‘ddc’, :popular s = result.recommendations ‘ddc’, :recent t = result.recommendations ‘ddc’, :latest p r p s p t r.each {|k,v| puts k }
47 48 49 50 51 52 53 54 |
# File 'lib/oclc_classify.rb', line 47 def initialize(input, value, summary = false, orderBy = nil, maxRecs = nil) raise "Invalid argument parameter: " + input unless ARGUMENTS.include? input @summary = summary ? '&summary=true' : '&summary=false' @query_string = input + '=' + value + @summary @orderBy = orderBy @maxRecs = maxRecs.to_s if maxRecs self end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
32 33 34 |
# File 'lib/oclc_classify.rb', line 32 def url @url end |
Instance Method Details
#classify ⇒ Object
64 65 66 67 |
# File 'lib/oclc_classify.rb', line 64 def classify @url = construct_query return OCLC::Classify::Response.new(@url) end |
#maxRecs(number) ⇒ Object
60 61 62 |
# File 'lib/oclc_classify.rb', line 60 def maxRecs(number) @maxRecs ||= number.to_s end |
#orderBy(entry) ⇒ Object
56 57 58 |
# File 'lib/oclc_classify.rb', line 56 def orderBy(entry) @orderBy ||= entry end |