Class: Contentful::Management::TaxonomyConceptScheme

Inherits:
Object
  • Object
show all
Includes:
Resource, Resource::Refresher, Resource::SystemProperties
Defined in:
lib/contentful/management/taxonomy_concept_scheme.rb

Overview

Instance Attribute Summary

Attributes included from Resource::SystemProperties

#sys

Attributes included from Resource

#client, #properties, #raw_object, #request

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource::Refresher

#reload

Methods included from Resource

#array?, #default_locale, #environment_id, #fields, #nested_locale_fields?, #resource?, #save, #sys

Class Method Details

.all(client, organization_id, query = {}) ⇒ Object



38
39
40
41
# File 'lib/contentful/management/taxonomy_concept_scheme.rb', line 38

def self.all(client, organization_id, query = {})
  requester = ResourceRequester.new(client, self)
  requester.all({ organization_id: organization_id }, query)
end

.create(client, organization_id, attributes) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/contentful/management/taxonomy_concept_scheme.rb', line 53

def self.create(client, organization_id, attributes)
  requester = ResourceRequester.new(client, self)
  requester.create(
    { organization_id: organization_id },
    attributes
  )
end

.find(client, organization_id, concept_scheme_id) ⇒ Contentful::Management::TaxonomyConceptScheme

Finds a Taxonomy Concept Scheme by ID.

Parameters:

Returns:



30
31
32
33
34
35
36
# File 'lib/contentful/management/taxonomy_concept_scheme.rb', line 30

def self.find(client, organization_id, concept_scheme_id)
  requester = ResourceRequester.new(client, self)
  requester.find(
    id: concept_scheme_id,
    organization_id: organization_id
  )
end

.total(client, organization_id) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/contentful/management/taxonomy_concept_scheme.rb', line 43

def self.total(client, organization_id)
  response = client.get(
    Request.new(
      client,
      build_endpoint(total: true, organization_id: organization_id)
    )
  )
  response.object['total']
end

Instance Method Details

#destroyObject



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/contentful/management/taxonomy_concept_scheme.rb', line 81

def destroy
  requester = ResourceRequester.new(client, self.class)
  requester.destroy(
    {
      organization_id: sys[:organization].id,
      id: id
    },
    {},
    { 'X-Contentful-Version' => sys[:version].to_s }
  )
end

#update(patch_operations) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/contentful/management/taxonomy_concept_scheme.rb', line 66

def update(patch_operations)
  requester = ResourceRequester.new(client, self.class)
  requester.patch(
    {
      organization_id: sys[:organization].id,
      id: id
    },
    patch_operations,
    {
      'Content-Type' => 'application/json-patch+json',
      'X-Contentful-Version' => sys[:version].to_s
    }
  )
end