diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0c0206..1bec771f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ For more information about changelogs, check [Keep a Changelog](http://keepachangelog.com) and [Vandamme](http://tech-angels.github.io/vandamme). + +## 0.32.5 - 2019-11-06 + +* [BUGFIX] Fix `MatchPolicy#update` and `Asset#update` by using `PUT` instead of `PATCH` +* Update `bin/yt` file to keep `yt info` command work + ## 0.32.4 - 2019-06-26 * [FEATURE] Add `ownership_effective` method to access asset ownership ("effective") via the asset object. diff --git a/lib/yt/models/asset.rb b/lib/yt/models/asset.rb index bb4539aa..717e8793 100644 --- a/lib/yt/models/asset.rb +++ b/lib/yt/models/asset.rb @@ -17,7 +17,7 @@ def initialize(options = {}) def update(attributes = {}) underscore_keys! attributes - do_patch body: attributes + do_update body: attributes true end @@ -112,6 +112,15 @@ def patch_params end end + # @see https://developers.google.com/youtube/partner/docs/v1/assets/update + def update_params + super.tap do |params| + params[:expected_response] = Net::HTTPOK + params[:path] = "/youtube/partner/v1/assets/#{@id}" + params[:params] = {on_behalf_of_content_owner: @auth.owner_name} + end + end + # @return [Hash] the parameters to submit to YouTube to get an asset. # @see https://developers.google.com/youtube/partner/docs/v1/assets/get def get_params diff --git a/lib/yt/models/match_policy.rb b/lib/yt/models/match_policy.rb index 8a084c72..066f89dd 100644 --- a/lib/yt/models/match_policy.rb +++ b/lib/yt/models/match_policy.rb @@ -13,16 +13,14 @@ def initialize(options = {}) def update(attributes = {}) underscore_keys! attributes - do_patch body: attributes.slice(:policy_id) + do_update body: attributes.slice(:policy_id) true end private - # @return [Hash] the parameters to submit to YouTube to patch an asset - # match policy. - # @see https://developers.google.com/youtube/partner/docs/v1/assetMatchPolicy/patch - def patch_params + # @see https://developers.google.com/youtube/partner/docs/v1/assetMatchPolicy/update + def update_params super.tap do |params| params[:path] = "/youtube/partner/v1/assets/#{@asset_id}/matchPolicy" params[:params] = {on_behalf_of_content_owner: @auth.owner_name} @@ -31,4 +29,4 @@ def patch_params end end end -end \ No newline at end of file +end diff --git a/lib/yt/version.rb b/lib/yt/version.rb index bc3b0450..71959e8c 100644 --- a/lib/yt/version.rb +++ b/lib/yt/version.rb @@ -1,3 +1,3 @@ module Yt - VERSION = '0.32.4' + VERSION = '0.32.5' end