Class: AppReview
- Inherits:
-
Object
- Object
- AppReview
- Defined in:
- lib/shopify_app_reviews/app_review.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#body ⇒ Object
Returns the value of attribute body.
-
#date ⇒ Object
Returns the value of attribute date.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
- .all ⇒ Object
- .create(app_attributes, app = nil) ⇒ Object
- .create_from_collection(review_array, app) ⇒ Object
- .destroy_all ⇒ Object
Instance Method Summary collapse
-
#initialize(app_attributes, app = nil) ⇒ AppReview
constructor
A new instance of AppReview.
- #save ⇒ Object
Constructor Details
#initialize(app_attributes, app = nil) ⇒ AppReview
Returns a new instance of AppReview.
6 7 8 9 10 11 12 |
# 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 |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
2 3 4 |
# File 'lib/shopify_app_reviews/app_review.rb', line 2 def app @app end |
#body ⇒ Object
Returns the value of attribute body.
2 3 4 |
# File 'lib/shopify_app_reviews/app_review.rb', line 2 def body @body end |
#date ⇒ Object
Returns the value of attribute date.
2 3 4 |
# File 'lib/shopify_app_reviews/app_review.rb', line 2 def date @date end |
#rating ⇒ Object
Returns the value of attribute rating.
2 3 4 |
# File 'lib/shopify_app_reviews/app_review.rb', line 2 def @rating end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/shopify_app_reviews/app_review.rb', line 2 def title @title end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/shopify_app_reviews/app_review.rb', line 14 def self.all @@all end |
.create(app_attributes, app = nil) ⇒ Object
26 27 28 29 |
# 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) ⇒ Object
36 37 38 39 40 |
# 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 ⇒ Object
18 19 20 |
# File 'lib/shopify_app_reviews/app_review.rb', line 18 def self.destroy_all self.class.all.clear end |
Instance Method Details
#save ⇒ Object
22 23 24 |
# File 'lib/shopify_app_reviews/app_review.rb', line 22 def save self.class.all << self end |