Class: Exlibris::Primo::Reviews
- Inherits:
-
Object
- Object
- Exlibris::Primo::Reviews
- Includes:
- ChainGang::Base, ChainGang::Record, ChainGang::User, Config::Attributes, RequestAttributes, WriteAttributes
- Defined in:
- lib/exlibris/primo/reviews.rb
Overview
Instance Attribute Summary collapse
-
#record_id ⇒ Object
readonly
Returns the value of attribute record_id.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#add_review(value, rating, user_display_name, status = 2, allow_user_name = true) ⇒ Object
Call web service to add a review to Primo for the specified record.
-
#initialize(*args) ⇒ Reviews
constructor
A new instance of Reviews.
-
#rating_reviews(rating) ⇒ Object
Get the reviews of a certain rating for the specified user.
-
#record_reviews ⇒ Object
Call web service to get all reviews for the specified record.
-
#remove_review ⇒ Object
Call web service to remove review from Primo for the specified record.
-
#reviews ⇒ Object
Call web service to get reviews for the specified user and record.
-
#user_reviews ⇒ Object
Call web service to get all reviews for the specified user.
Methods included from WriteAttributes
Methods included from ChainGang::Record
Methods included from ChainGang::User
Methods included from ChainGang::Base
#base_url!, #group!, #institution!, #ip!, #logged_in, #logged_out, #off_campus, #on_campus, #pds_handle!
Methods included from Config::Attributes
#availability_statuses, #base_url, #config, #facet_collections, #facet_labels, #facet_resource_types, #facet_top_level, #institution, #institutions, #libraries, #sources
Constructor Details
#initialize(*args) ⇒ Reviews
Returns a new instance of Reviews.
20 21 22 |
# File 'lib/exlibris/primo/reviews.rb', line 20 def initialize *args super end |
Instance Attribute Details
#record_id ⇒ Object (readonly)
Returns the value of attribute record_id.
18 19 20 |
# File 'lib/exlibris/primo/reviews.rb', line 18 def record_id @record_id end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
18 19 20 |
# File 'lib/exlibris/primo/reviews.rb', line 18 def user_id @user_id end |
Instance Method Details
#add_review(value, rating, user_display_name, status = 2, allow_user_name = true) ⇒ Object
Call web service to add a review to Primo for the specified record
59 60 61 62 63 |
# File 'lib/exlibris/primo/reviews.rb', line 59 def add_review(value, , user_display_name, status=2, allow_user_name = true) Exlibris::Primo::WebService::Request::AddReview.new(user_record_request_attributes.merge :value => value, :rating => , :user_display_name => user_display_name, :status =>status, :allow_user_name => allow_user_name).call reset_reviews end |
#rating_reviews(rating) ⇒ Object
Get the reviews of a certain rating for the specified user
51 52 53 54 |
# File 'lib/exlibris/primo/reviews.rb', line 51 def () Exlibris::Primo::WebService::Request::GetReviewsByRating.new( user_request_attributes.merge :rating => ).call.reviews end |
#record_reviews ⇒ Object
Call web service to get all reviews for the specified record
43 44 45 46 |
# File 'lib/exlibris/primo/reviews.rb', line 43 def record_reviews @record_reviews ||= Exlibris::Primo::WebService::Request::GetReviewsForRecord.new( record_request_attributes).call.reviews end |
#remove_review ⇒ Object
Call web service to remove review from Primo for the specified record
68 69 70 71 |
# File 'lib/exlibris/primo/reviews.rb', line 68 def remove_review Exlibris::Primo::WebService::Request::RemoveReview.new(user_record_request_attributes).call reset_reviews end |
#reviews ⇒ Object
Call web service to get reviews for the specified user and record
27 28 29 30 |
# File 'lib/exlibris/primo/reviews.rb', line 27 def reviews @reviews ||= Exlibris::Primo::WebService::Request::GetReviews.new( user_record_request_attributes).call.reviews end |
#user_reviews ⇒ Object
Call web service to get all reviews for the specified user
35 36 37 38 |
# File 'lib/exlibris/primo/reviews.rb', line 35 def user_reviews @user_reviews ||= Exlibris::Primo::WebService::Request::GetAllMyReviews.new( user_request_attributes).call.reviews end |