class AppReview

Attributes

app[RW]
body[RW]
date[RW]
rating[RW]
title[RW]

Public Class Methods

all() click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 14
def self.all
  @@all
end
create(app_attributes, app = nil) click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 26
def self.create(app_attributes, app = nil)
  a = self.new(app_attributes, app)
  a.save
end
create_from_collection(review_array, app) click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 36
def self.create_from_collection(review_array, app)
  review_array.each do |review_info|
    self.create(review_info, app)
  end
end
destroy_all() click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 18
def self.destroy_all
  self.class.all.clear
end
new(app_attributes, app = nil) click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 6
def initialize(app_attributes, app = nil)
  @title = app_attributes[:title]
  @body = app_attributes[:body]
  @date = app_attributes[:date]
  @rating = app_attributes[:rating]
  @app = app if app
end

Public Instance Methods

app=() click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 31
def app=
  @app = app
  app.reviews << self unless app.reviews.include?(self)
end
save() click to toggle source
# File lib/shopify_app_reviews/app_review.rb, line 22
def save
  self.class.all << self
end