Module: PublicContentInstanceVersions

Included in:
PublicContent
Defined in:
lib/pub/content/content_instance_versions.rb

Instance Method Summary collapse

Instance Method Details

#get_content_instance_version(slug, options = nil) ⇒ Object

Get Content Instance Version.

Get a single content instance version.

Parameters

slug

(String) – It’s the string identifier generated by Mints.

options

(Hash) – List of Single Resource Options shown above can be used as parameter.

First Example

@data = @mints_pub.get_content_instance_version('content_instance_version_slug')

Second Example

@data = @mints_pub.get_content_instance_version('content_instance_version_slug', options)

53
54
55
# File 'lib/pub/content/content_instance_versions.rb', line 53

def get_content_instance_version(slug, options = nil)
  @client.raw('get', "/content/content-instance-versions/#{slug}", options)
end

#get_content_instance_versions(options = nil) ⇒ Object

Get Content Instance Versions.

Get a collection of content instance versions.

Parameters

options

(Hash) – List of Resource collection Options shown above can be used as parameter.

use_post

(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.

First Example

@data = @mints_pub.get_content_instance_versions

Second Example

options = {
  fields: 'id, title'
}
@data = @mints_pub.get_content_instance_versions(options)

Third Example

options = {
  fields: 'id, title'
}
@data = @mints_pub.get_content_instance_versions(options, false)

26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pub/content/content_instance_versions.rb', line 26

def get_content_instance_versions(options = nil)
  unless options&.[](:template) || options&.[]('template')
    raise Mints::Errors::DynamicError.new(
      self,
      'Error 422 | Missing required fields, see the details for more information',
      'Add the template option, example { template: slug }',
      422,
      { template: ['The template option is required'] }
    )
  end

  @client.raw('get', '/content/content-instance-versions', options)
end