Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/yt/collections/channels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def channels_params
end
end
end
end
end
1 change: 1 addition & 0 deletions lib/yt/collections/videos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def attributes_for_new_item(data)
attributes[:statistics] = data['statistics']
attributes[:video_category] = data['videoCategory']
attributes[:claim] = data['claim']
attributes[:player] = data['player']
attributes[:auth] = @auth
end
end
Expand Down
8 changes: 6 additions & 2 deletions lib/yt/models/authentication.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Yt
module Models
# Provides methods to authenticate with YouTube (and Google) API.
# @see https://developers.google.com/accounts/docs/OAuth2
# @see https://developers.google.com/identity/protocols/oauth2
class Authentication

# Before your application can access private data using a Google API,
Expand Down Expand Up @@ -52,11 +52,15 @@ class Authentication
# @return [Time] the time when access token no longer works.
attr_reader :expires_at

# @return [String] the OAuth2 Google id_token.
attr_reader :id_token

def initialize(data = {})
@access_token = data['access_token']
@refresh_token = data['refresh_token']
@error = data['error']
@expires_at = expiration_date data.slice('expires_at', 'expires_in')
@id_token = data['id_token']
end

# @return [Boolean] whether the access token has expired.
Expand All @@ -80,4 +84,4 @@ def expiration_date(options = {})
end
end
end
end
end
4 changes: 4 additions & 0 deletions lib/yt/models/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class Channel < Resource
# @return [String] the channel’s title.
delegate :title, to: :snippet

# @!attribute [r] custom_url
# @return [String] the channel’s handle or custom identifier.
delegate :custom_url, to: :snippet

# @!attribute [r] description
# @return [String] the channel’s description.
delegate :description, to: :snippet
Expand Down
1 change: 1 addition & 0 deletions lib/yt/models/snippet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def initialize(options = {})
end

has_attribute :title, default: ''
has_attribute :custom_url, default: ''
has_attribute :description, default: ''
has_attribute :published_at, type: Time
has_attribute :channel_id
Expand Down
1 change: 1 addition & 0 deletions lib/yt/models/user_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def initialize(options = {})
has_attribute :gender, default: ''
has_attribute :locale, default: ''
has_attribute :hd, default: ''
has_attribute :email_verified, default: false, camelize: false
end
end
end
Loading