yt 0.13.7 → 0.13.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92bd4d67d0b039373542dd45a4f85abaf95d3aa3
4
- data.tar.gz: 8ec36efd6d006f719ff41fa9a85cda983ee9ac5f
3
+ metadata.gz: c180d75d3544370dcf5ad0bf29cd7da6a22b62b3
4
+ data.tar.gz: f2d6f98305c7f759e63f9350d8b9d15b28326b1c
5
5
  SHA512:
6
- metadata.gz: 575970ef892b48beb15b0ff0266ebc67f68e175820696b30fdfbbde1017039a4fb1eafb83c86aa46819e6bf399ae9f3ea868c6c1a75125e8cc546d1fab61195b
7
- data.tar.gz: b25da01c60ec08ae5a7aa8796a5f778e3038a0f32532a8cbb9b201f39fad91be71bf69a3cca0f11daa09b0f8386d9c4468580b7bc846bab7aca07009b72892d4
6
+ metadata.gz: 733901314de6696b5c92d2e6040d50823fc83e78b7bea221df6c3c9616e4fa640da693dcb1900afb260d3a903a6e46e2763ea4f6d597b8b69faf928ad38b5d87
7
+ data.tar.gz: 3b30960bbed06617f1632f41b148946bdc37fad836b5b6a48913a0de7587209e46ba17e1640898facc5f082902b0685a43ccb227e89bb8bcdbdffd33c6f52ff8
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ For more information about changelogs, check
6
6
  [Keep a Changelog](http://keepachangelog.com) and
7
7
  [Vandamme](http://tech-angels.github.io/vandamme).
8
8
 
9
+ ## 0.13.8 - 2015-01-15
10
+
11
+ * [FEATURE] AssetSearch resources available.
12
+ * [FEATURE] Access asset metadata (`effective` and `mine`) via the asset object.
13
+ * [ENHANCEMENT] Support `isManualClaim` parameter in claims#insert.
14
+
9
15
  ## 0.13.7 - 2014-10-27
10
16
 
11
17
  * [FEATURE] New video reports: monetized playbacks.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- gem 'pry'
2
+
3
3
  # Specify your gem's dependencies in yt.gemspec
4
4
  gemspec
@@ -74,7 +74,6 @@ module Yt
74
74
  {data: data, auth: @auth}
75
75
  end
76
76
 
77
-
78
77
  def more_pages?
79
78
  @last_index.zero? || !@page_token.nil?
80
79
  end
@@ -1,5 +1,6 @@
1
1
  require 'yt/collections/base'
2
2
  require 'yt/models/asset'
3
+ require 'yt/models/asset_snippet'
3
4
 
4
5
  module Yt
5
6
  module Collections
@@ -16,6 +17,37 @@ module Yt
16
17
 
17
18
  private
18
19
 
20
+ def new_item(data)
21
+ klass = (data["kind"] == "youtubePartner#assetSnippet") ? Yt::AssetSnippet : Yt::Asset
22
+ klass.new attributes_for_new_item(data)
23
+ end
24
+
25
+ # @return [Hash] the parameters to submit to YouTube to list assets
26
+ # owned by the content owner.
27
+ # @see https://developers.google.com/youtube/partner/docs/v1/assets/list
28
+ def list_params
29
+ super.tap do |params|
30
+ params[:path] = assets_path
31
+ params[:params] = assets_params
32
+ end
33
+ end
34
+
35
+ def assets_params
36
+ apply_where_params! on_behalf_of_content_owner: @auth.owner_name
37
+ end
38
+
39
+ # @private
40
+ # @todo: This is one of three places outside of base.rb where @where_params
41
+ # is accessed; it should be replaced with a filter on params instead.
42
+ def assets_path
43
+ @where_params ||= {}
44
+ if @where_params.empty? || @where_params.key?(:id)
45
+ '/youtube/partner/v1/assets'
46
+ else
47
+ '/youtube/partner/v1/assetSearch'
48
+ end
49
+ end
50
+
19
51
  # @return [Hash] the parameters to submit to YouTube to add a asset.
20
52
  # @see https://developers.google.com/youtube/partner/docs/v1/assets/insert
21
53
  def insert_params
@@ -11,7 +11,7 @@ module Yt
11
11
  underscore_keys! attributes
12
12
  body = attributes.slice :asset_id, :video_id, :content_type, :policy
13
13
  body[:policy] = {id: attributes[:policy_id]} if attributes[:policy_id]
14
- params = {on_behalf_of_content_owner: @auth.owner_name}
14
+ params = attributes.slice(:is_manual_claim).merge({on_behalf_of_content_owner: @auth.owner_name})
15
15
  do_insert(params: params, body: body)
16
16
  end
17
17
 
@@ -41,7 +41,7 @@ module Yt
41
41
  end
42
42
 
43
43
  # @private
44
- # @todo: This is one of two places outside of base.rb where @where_params
44
+ # @todo: This is one of three places outside of base.rb where @where_params
45
45
  # is accessed; it should be replaced with a filter on params instead.
46
46
  def claims_path
47
47
  @where_params ||= {}
@@ -71,7 +71,7 @@ module Yt
71
71
  # /videos should be used when the query specifies video IDs or a chart,
72
72
  # /search otherwise.
73
73
  # @return [Boolean] whether to use the /videos endpoint.
74
- # @todo: This is one of two places outside of base.rb where @where_params
74
+ # @todo: This is one of three places outside of base.rb where @where_params
75
75
  # is accessed; it should be replaced with a filter on params instead.
76
76
  def use_list_endpoint?
77
77
  @where_params ||= {}
@@ -1,4 +1,5 @@
1
1
  require 'yt/models/base'
2
+ require 'yt/models/asset_metadata'
2
3
 
3
4
  module Yt
4
5
  module Models
@@ -8,7 +9,7 @@ module Yt
8
9
  attr_reader :auth
9
10
 
10
11
  def initialize(options = {})
11
- @data = options[:data]
12
+ @data = options.fetch(:data, {})
12
13
  @id = options[:id]
13
14
  @auth = options[:auth]
14
15
  end
@@ -25,6 +26,14 @@ module Yt
25
26
  delegate :general_owners, :performance_owners, :synchronization_owners,
26
27
  :mechanical_owners, to: :ownership
27
28
 
29
+ def metadata_mine
30
+ @metadata_mine ||= Yt::Models::AssetMetadata.new data: @data.fetch('metadataMine', {})
31
+ end
32
+
33
+ def metadata_effective
34
+ @metadata_effective ||= Yt::Models::AssetMetadata.new data: @data.fetch('metadataEffective', {})
35
+ end
36
+
28
37
  # Soft-deletes the asset.
29
38
  # @note YouTube API does not provide a +delete+ method for the Asset
30
39
  # resource, but only an +update+ method. Updating the +status+ of a
@@ -54,6 +63,12 @@ module Yt
54
63
  # video_game, and web.
55
64
  has_attribute :type
56
65
 
66
+ # @return [Array<Yt::Models::Tag>] the list of asset labels associated
67
+ # with the asset. You can apply a label to multiple assets to group
68
+ # them. You can use the labels as search filters to perform bulk updates,
69
+ # to download reports, or to filter YouTube Analytics.
70
+ has_attribute :label
71
+
57
72
  # Status
58
73
 
59
74
  STATUSES = %q(active inactive pending)
@@ -0,0 +1,38 @@
1
+ require 'yt/models/base'
2
+
3
+ module Yt
4
+ module Models
5
+ # The AssetMetadata object specifies the metadata for an asset.
6
+ # @see https://developers.google.com/youtube/partner/docs/v1/assets#metadataMine
7
+ class AssetMetadata < Base
8
+ def initialize(options = {})
9
+ @data = options[:data]
10
+ end
11
+
12
+ # @return [String] A unique value that you, the metadata provider,
13
+ # use to identify an asset. The value could be a unique ID that
14
+ # you created for the asset or a standard identifier, such as an
15
+ # ISRC.
16
+ def custom_id
17
+ @data['customId']
18
+ end
19
+
20
+ # @return [String] The asset's title or name.
21
+ def title
22
+ @data['title']
23
+ end
24
+
25
+ # @return [String] A description of the asset. The description may be
26
+ # displayed on YouTube or in CMS.
27
+ def notes
28
+ @data['notes']
29
+ end
30
+
31
+ # @return [String] the ID that YouTube assigns and uses to uniquely
32
+ # identify the asset.
33
+ def description
34
+ @data['description']
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,45 @@
1
+ require 'yt/models/base'
2
+
3
+ module Yt
4
+ module Models
5
+ # Provides methods to interact with YouTube ContentID assetSnippets.
6
+ # @see https://developers.google.com/youtube/partner/docs/v1/assetSearch
7
+ class AssetSnippet < Base
8
+ attr_reader :auth
9
+
10
+ def initialize(options = {})
11
+ @data = options.fetch(:data, {})
12
+ @auth = options[:auth]
13
+ end
14
+
15
+ # @return [String] the ID that YouTube assigns and uses to uniquely
16
+ # identify the asset.
17
+ has_attribute :id
18
+
19
+ # @return [String] the asset’s type. This value determines the metadata
20
+ # fields that you can set for the asset. In addition, certain API
21
+ # functions may only be supported for specific types of assets. For
22
+ # example, composition assets may have more complex ownership data than
23
+ # other types of assets.
24
+ # Valid values for this property are: art_track_video, composition,
25
+ # episode, general, movie, music_video, season, show, sound_recording,
26
+ # video_game, and web.
27
+ has_attribute :type
28
+
29
+ # @return [String] the title of this asset.
30
+ has_attribute :title
31
+
32
+ # @return [String] the Custom ID assigned by the content owner to
33
+ # this asset.
34
+ has_attribute :custom_id
35
+
36
+ # @return [String] the ISRC (International Standard Recording Code)
37
+ # for this asset.
38
+ has_attribute :isrc
39
+
40
+ # @return [String] the ISWC (International Standard Musical Work Code)
41
+ # for this asset.
42
+ has_attribute :iswc
43
+ end
44
+ end
45
+ end
data/lib/yt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.13.7'
2
+ VERSION = '0.13.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.7
4
+ version: 0.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -173,6 +173,8 @@ files:
173
173
  - lib/yt/models/advertising_options_set.rb
174
174
  - lib/yt/models/annotation.rb
175
175
  - lib/yt/models/asset.rb
176
+ - lib/yt/models/asset_metadata.rb
177
+ - lib/yt/models/asset_snippet.rb
176
178
  - lib/yt/models/authentication.rb
177
179
  - lib/yt/models/base.rb
178
180
  - lib/yt/models/channel.rb