Class: Fera::Review

Inherits:
Base
  • Object
show all
Includes:
BelongsToCustomer, BelongsToOrder, BelongsToProduct, BelongsToSubmission, HasMedia, HasSubject
Defined in:
lib/fera/models/review.rb

Instance Attribute Summary

Attributes inherited from Base

#last_response, #last_response_body, #last_response_exception, #last_response_message, #options

Instance Method Summary collapse

Methods included from BelongsToOrder

#external_order_id=, #order, #order=, #order_id=, #reload

Methods included from BelongsToSubmission

#submission, #submission=

Methods included from BelongsToProduct

#product, #product=

Methods included from BelongsToCustomer

#customer, #customer=, #customer_id=, #external_customer_id=

Methods included from HasSubject

#for_product?, #for_store?, #product

Methods included from HasMedia

#add_media, #add_photo, #add_video, #media, #media=, #new_media, #new_photo, #new_video, #photos, #photos=, #videos, #videos=

Methods inherited from Base

api_key, api_key=, belongs_to, belongs_tos, #clone_selected_fields, #clone_with_nil, #create, create, #create!, create!, #created_at=, #destroy!, find_every, find_one, find_single, has_many, has_manys, has_one, has_ones, headers, headers=, #initialize, #known_attribute?, #load, #method_missing, new_element_path, order, #respond_to_missing?, #save, #save!, #set_last_response, #update, #update!, #updated_at=, #valid?

Constructor Details

This class inherits a constructor from Fera::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Fera::Base

Instance Method Details

#only_rating?Boolean Also known as: rating_only?

Returns:

  • (Boolean)


10
11
12
# File 'lib/fera/models/review.rb', line 10

def only_rating?
  body.blank? && heading.blank?
end

#starsObject



15
16
17
# File 'lib/fera/models/review.rb', line 15

def stars
  (('' * rating) + ('' * (5 - rating))).chars.join(" ")
end