Class: SocialNet::Byte::Models::Post
- Inherits:
-
Object
- Object
- SocialNet::Byte::Models::Post
- Defined in:
- lib/social_net/byte/models/post.rb
Instance Attribute Summary collapse
-
#author_id ⇒ Object
readonly
Returns the value of attribute author_id.
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#comment_count ⇒ Object
readonly
Returns the value of attribute comment_count.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#like_count ⇒ Object
readonly
Returns the value of attribute like_count.
-
#loop_count ⇒ Object
readonly
Returns the value of attribute loop_count.
-
#mentions ⇒ Object
readonly
Returns the value of attribute mentions.
-
#thumb_src ⇒ Object
readonly
Returns the value of attribute thumb_src.
-
#video_src ⇒ Object
readonly
Returns the value of attribute video_src.
Class Method Summary collapse
-
.find_by(params = {}) ⇒ SocialNet::Byte::Models::post?
Returns the existing Byte post matching the provided attributes or nil when the post is not found.
-
.find_by!(params = {}) ⇒ SocialNet::Byte::Models::Post
Returns the existing Byte post matching the provided attributes or nil when the post is not found, and raises an error when the post is not found.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(attrs = {}) ⇒ Post
Returns a new instance of Post.
21 22 23 |
# File 'lib/social_net/byte/models/post.rb', line 21 def initialize(attrs = {}) attrs.each{|k, v| instance_variable_set("@#{k}", v) unless v.nil?} end |
Instance Attribute Details
#author_id ⇒ Object (readonly)
Returns the value of attribute author_id.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def @author_id end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def @caption end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def category @category end |
#comment_count ⇒ Object (readonly)
Returns the value of attribute comment_count.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def comment_count @comment_count end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def comments @comments end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def date @date end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def id @id end |
#like_count ⇒ Object (readonly)
Returns the value of attribute like_count.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def like_count @like_count end |
#loop_count ⇒ Object (readonly)
Returns the value of attribute loop_count.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def loop_count @loop_count end |
#mentions ⇒ Object (readonly)
Returns the value of attribute mentions.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def mentions @mentions end |
#thumb_src ⇒ Object (readonly)
Returns the value of attribute thumb_src.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def thumb_src @thumb_src end |
#video_src ⇒ Object (readonly)
Returns the value of attribute video_src.
8 9 10 |
# File 'lib/social_net/byte/models/post.rb', line 8 def video_src @video_src end |
Class Method Details
.find_by(params = {}) ⇒ SocialNet::Byte::Models::post?
Returns the existing Byte post matching the provided attributes or nil when the post is not found.
33 34 35 36 37 |
# File 'lib/social_net/byte/models/post.rb', line 33 def self.find_by(params = {}) find_by! params rescue Errors::UnknownPost nil end |
.find_by!(params = {}) ⇒ SocialNet::Byte::Models::Post
Returns the existing Byte post matching the provided attributes or nil when the post is not found, and raises an error when the post is not found.
47 48 49 50 51 |
# File 'lib/social_net/byte/models/post.rb', line 47 def self.find_by!(params = {}) if params[:id] find_by_id! params[:id] end end |