Class: WCC::Contentful::SimpleClient::Management

Inherits:
WCC::Contentful::SimpleClient show all
Defined in:
lib/wcc/contentful/simple_client.rb

Constant Summary

Constants inherited from WCC::Contentful::SimpleClient

ADAPTERS

Instance Method Summary collapse

Methods inherited from WCC::Contentful::SimpleClient

#get, load_adapter

Constructor Details

#initialize(management_token:, **options) ⇒ Management

Returns a new instance of Management.



158
159
160
161
162
163
164
165
# File 'lib/wcc/contentful/simple_client.rb', line 158

def initialize(management_token:, **options)
  super(
    api_url: options[:api_url] || 'https://api.contentful.com',
    space: options[:space] || '/',
    access_token: management_token,
    **options
  )
end

Instance Method Details

#content_types(space: nil, **query) ⇒ Object

Raises:

  • (ArgumentError)


167
168
169
170
171
172
173
# File 'lib/wcc/contentful/simple_client.rb', line 167

def content_types(space: nil, **query)
  space ||= @space
  raise ArgumentError, 'please provide a space ID' if space.nil?

  resp = get("/spaces/#{space}/content_types", query)
  resp.assert_ok!
end