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

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

Instance Method Summary collapse

Methods inherited from WCC::Contentful::SimpleClient

#get

Constructor Details

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



109
110
111
112
113
114
115
116
# File 'lib/wcc/contentful/simple_client.rb', line 109

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)


118
119
120
121
122
123
124
# File 'lib/wcc/contentful/simple_client.rb', line 118

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