Class: SocialNet::Instagram::Models::Video
- Inherits:
-
Object
- Object
- SocialNet::Instagram::Models::Video
- Defined in:
- lib/social_net/instagram/models/video.rb
Instance Attribute Summary collapse
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#likes ⇒ Object
readonly
Returns the value of attribute likes.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#thumbnail ⇒ Object
readonly
Returns the value of attribute thumbnail.
Class Method Summary collapse
-
.find_by(params = {}) ⇒ SocialNet::Instagram::Models::Video?
Returns the existing Instagram video matching the provided attributes or nil when the video is not found.
-
.find_by!(params = {}) ⇒ SocialNet::Instagram::Models::Video?
Returns the existing Instagram video matching the provided attributes or raises an error when the video is not found.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Video
constructor
A new instance of Video.
Constructor Details
#initialize(attrs = {}) ⇒ Video
Returns a new instance of Video.
11 12 13 14 15 16 17 18 |
# File 'lib/social_net/instagram/models/video.rb', line 11 def initialize(attrs = {}) @id = attrs['id'] @caption = attrs['caption']['text'] if attrs['caption'] @likes = attrs['likes']['count'] @file = attrs['videos']['standard_resolution']['url'] @thumbnail = attrs['images']['standard_resolution']['url'] @link = attrs['link'] end |
Instance Attribute Details
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
9 10 11 |
# File 'lib/social_net/instagram/models/video.rb', line 9 def caption @caption end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
9 10 11 |
# File 'lib/social_net/instagram/models/video.rb', line 9 def file @file end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/social_net/instagram/models/video.rb', line 9 def id @id end |
#likes ⇒ Object (readonly)
Returns the value of attribute likes.
9 10 11 |
# File 'lib/social_net/instagram/models/video.rb', line 9 def likes @likes end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
9 10 11 |
# File 'lib/social_net/instagram/models/video.rb', line 9 def link @link end |
#thumbnail ⇒ Object (readonly)
Returns the value of attribute thumbnail.
9 10 11 |
# File 'lib/social_net/instagram/models/video.rb', line 9 def thumbnail @thumbnail end |
Class Method Details
.find_by(params = {}) ⇒ SocialNet::Instagram::Models::Video?
Returns the existing Instagram video matching the provided attributes or nil when the video is not found.
27 28 29 30 31 |
# File 'lib/social_net/instagram/models/video.rb', line 27 def self.find_by(params = {}) find_by! params rescue Errors::UnknownVideo nil end |
.find_by!(params = {}) ⇒ SocialNet::Instagram::Models::Video?
Returns the existing Instagram video matching the provided attributes or raises an error when the video is not found.
41 42 43 44 45 |
# File 'lib/social_net/instagram/models/video.rb', line 41 def self.find_by!(params = {}) if params[:shortcode] find_by_shortcode! params[:shortcode] end end |