Class: Yt::Models::Subscription
- Defined in:
- lib/yt/models/subscription.rb
Overview
Provides methods to interact with YouTube subscriptions.
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
The ID that uniquely identify a YouTube subscription.
Instance Method Summary collapse
- #delete(options = {}) ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(options = {}) ⇒ Subscription
constructor
A new instance of Subscription.
Methods included from Associations::HasReports
Methods included from Associations::HasOne
Methods included from Associations::HasMany
Methods included from Associations::HasAuthentication
Constructor Details
#initialize(options = {}) ⇒ Subscription
Returns a new instance of Subscription.
11 12 13 14 |
# File 'lib/yt/models/subscription.rb', line 11 def initialize( = {}) @id = [:id] @auth = [:auth] end |
Instance Attribute Details
#id ⇒ String (readonly)
Returns the ID that uniquely identify a YouTube subscription.
9 10 11 |
# File 'lib/yt/models/subscription.rb', line 9 def id @id end |
Instance Method Details
#delete(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/yt/models/subscription.rb', line 16 def delete( = {}) begin do_delete {@id = nil} rescue Yt::Error => error ignorable_errors = error.reasons & ['subscriptionNotFound'] raise error unless [:ignore_errors] && ignorable_errors.any? @id = nil end !exists? end |
#exists? ⇒ Boolean
27 28 29 |
# File 'lib/yt/models/subscription.rb', line 27 def exists? !@id.nil? end |