class Contentful::Management::Snapshot

Resource class for Snapshot. @see _ www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots

Public Class Methods

all(client, space_id, environment_id, resource_id, resource_type = 'entries', params = {}) click to toggle source

Gets all snapshots for a resource

@param [Contentful::Management::Client] client @param [String] space_id @param [String] environment_id @param [String] resource_id @param [String] resource_type

@return [Contentful::Management::Array<Contentful::Management::Snapshot>] rubocop:disable Metrics/ParameterLists

# File lib/contentful/management/snapshot.rb, line 41
def self.all(client, space_id, environment_id, resource_id, resource_type = 'entries', params = {})
  ClientSnapshotMethodsFactory.new(client, space_id, environment_id, resource_type).all(resource_id, params)
end
build_endpoint(endpoint_options) click to toggle source

@private

# File lib/contentful/management/snapshot.rb, line 70
def self.build_endpoint(endpoint_options)
  resource_type = endpoint_options.fetch(:resource_type, 'entries')
  space_id = endpoint_options.fetch(:space_id)
  environment_id = endpoint_options.fetch(:environment_id)
  resource_id = endpoint_options.fetch(:resource_id)
  snapshot_id = endpoint_options.fetch(:snapshot_id, nil)

  endpoint = "spaces/#{space_id}/environments/#{environment_id}/#{resource_type}/#{resource_id}/snapshots"
  endpoint = "#{endpoint}/#{snapshot_id}" if snapshot_id

  endpoint
end
create(*) click to toggle source

Not supported

# File lib/contentful/management/snapshot.rb, line 60
def self.create(*)
  fail 'Not supported'
end
endpoint() click to toggle source

@private

# File lib/contentful/management/snapshot.rb, line 65
def self.endpoint
  'snapshots'
end
find(client, space_id, environment_id, resource_id, snapshot_id, resource_type = 'entries') click to toggle source

Gets a snapshot by ID

@param [Contentful::Management::Client] client @param [String] space_id @param [String] environment_id @param [String] resource_id @param [String] snapshot_id @param [String] resource_type

@return [Contentful::Management::Snapshot]

# File lib/contentful/management/snapshot.rb, line 55
def self.find(client, space_id, environment_id, resource_id, snapshot_id, resource_type = 'entries')
  ClientSnapshotMethodsFactory.new(client, space_id, environment_id, resource_type).find(resource_id, snapshot_id)
end
property_coercions() click to toggle source

@private

# File lib/contentful/management/snapshot.rb, line 16
def self.property_coercions
  {
    snapshot: lambda do |h|
      case h.fetch('sys', {})['type']
      when 'Entry'
        DynamicEntry.new(h)
      when 'ContentType'
        ContentType.new(h)
      end
    end
  }
end

Public Instance Methods

destroy() click to toggle source

Not supported

# File lib/contentful/management/snapshot.rb, line 84
def destroy
  fail 'Not supported'
end
update(*) click to toggle source

Not supported

# File lib/contentful/management/snapshot.rb, line 89
def update(*)
  fail 'Not supported'
end