forked from contentful/contentful-management.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
4,370 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require_relative 'client_association_methods_factory' | ||
|
||
module Contentful | ||
module Management | ||
# Wrapper for Tag API for usage from within Client | ||
# @private | ||
class ClientTagMethodsFactory | ||
include Contentful::Management::ClientAssociationMethodsFactory | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lib/contentful/management/environment_tag_methods_factory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require_relative 'environment_association_methods_factory' | ||
|
||
module Contentful | ||
module Management | ||
# Wrapper for Tag API for usage from within Environment | ||
# @private | ||
class EnvironmentTagMethodsFactory | ||
include Contentful::Management::EnvironmentAssociationMethodsFactory | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,41 @@ | ||
require_relative 'resource' | ||
require_relative 'resource/environment_aware' | ||
|
||
module Contentful | ||
module Management | ||
# Resource Class for Tags | ||
# https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-tags | ||
class Tag | ||
include Contentful::Management::Resource | ||
include Contentful::Management::Resource::Refresher | ||
include Contentful::Management::Resource::SystemProperties | ||
include Contentful::Management::Resource::EnvironmentAware | ||
|
||
property :name | ||
|
||
# @private | ||
def self.create_attributes(_client, attributes) | ||
return {} if attributes.nil? || attributes.empty? | ||
|
||
{ | ||
'name' => attributes.fetch(:name), | ||
'sys' => { | ||
'visibility' => attributes.fetch(:visibility, 'private'), | ||
'id' => attributes.fetch(:id), | ||
'type' => 'Tag' | ||
} | ||
} | ||
end | ||
|
||
def destroy | ||
ResourceRequester.new(client, self.class).destroy( | ||
{ space_id: space.id, | ||
environment_id: environment_id, | ||
resource_id: id }, | ||
{}, | ||
version: sys[:version] | ||
) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.