lib/contentful/management/resource/environment_aware.rb in contentful-management-2.0.1 vs lib/contentful/management/resource/environment_aware.rb in contentful-management-2.0.2
- old
+ new
@@ -3,10 +3,18 @@
module Resource
# Mixin for environment aware resources
module EnvironmentAware
# Gets the environment ID for the resource.
def environment_id
- sys.fetch(:environment, {}).fetch(:id, 'master')
+ env = sys.fetch(:environment, {})
+ case env
+ when ::Hash
+ env.fetch(:id, 'master')
+ when ::Contentful::Management::Link
+ env.id
+ else
+ 'master'
+ end
end
end
end
end
end