Module: Contentful::Management::Resource::EnvironmentAware

Included in:
Asset, ContentType, EditorInterface, Entry, Locale, Snapshot, UIExtension
Defined in:
lib/contentful/management/resource/environment_aware.rb

Overview

Mixin for environment aware resources

Instance Method Summary collapse

Instance Method Details

#environment_idObject

Gets the environment ID for the resource.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/contentful/management/resource/environment_aware.rb', line 7

def environment_id
  env = sys.fetch(:environment, {})
  case env
  when ::Hash
    env.fetch(:id, 'master')
  when ::Contentful::Management::Link
    env.id
  else
    'master'
  end
end