diff --git a/lib/yt/collections/channels.rb b/lib/yt/collections/channels.rb index cf388871..e5797151 100644 --- a/lib/yt/collections/channels.rb +++ b/lib/yt/collections/channels.rb @@ -28,4 +28,4 @@ def channels_params end end end -end \ No newline at end of file +end diff --git a/lib/yt/collections/videos.rb b/lib/yt/collections/videos.rb index 05126770..bad00852 100644 --- a/lib/yt/collections/videos.rb +++ b/lib/yt/collections/videos.rb @@ -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 diff --git a/lib/yt/models/authentication.rb b/lib/yt/models/authentication.rb index 5a317e64..18023097 100644 --- a/lib/yt/models/authentication.rb +++ b/lib/yt/models/authentication.rb @@ -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, @@ -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. @@ -80,4 +84,4 @@ def expiration_date(options = {}) end end end -end \ No newline at end of file +end diff --git a/lib/yt/models/channel.rb b/lib/yt/models/channel.rb index 23cf963a..3c853c8c 100644 --- a/lib/yt/models/channel.rb +++ b/lib/yt/models/channel.rb @@ -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 diff --git a/lib/yt/models/snippet.rb b/lib/yt/models/snippet.rb index b1ec0e2d..8dbef40f 100644 --- a/lib/yt/models/snippet.rb +++ b/lib/yt/models/snippet.rb @@ -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 diff --git a/lib/yt/models/user_info.rb b/lib/yt/models/user_info.rb index 20caa81d..82606ad2 100644 --- a/lib/yt/models/user_info.rb +++ b/lib/yt/models/user_info.rb @@ -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