Sha256: fc34c60d5e2457648f6a13925aa317c9a63172b08eb542d9833e850c4b57398b

Contents?: true

Size: 1.3 KB

Versions: 19

Compression:

Stored size: 1.3 KB

Contents

require_relative 'resource'
require_relative 'resource/environment_aware'

module Contentful
  module Management
    # Resource class for Locale.
    class Locale
      include Contentful::Management::Resource
      include Contentful::Management::Resource::SystemProperties
      include Contentful::Management::Resource::Refresher
      include Contentful::Management::Resource::EnvironmentAware

      property :code, :string
      property :name, :string
      property :publish, :boolean
      property :default, :boolean
      property :optional, :boolean
      property :fallbackCode, :string
      property :contentDeliveryApi, :boolean
      property :contentManagementApi, :boolean

      # @private
      def self.create_attributes(_client, attributes)
        {
          'name' => attributes.fetch(:name),
          'code' => attributes.fetch(:code),
          'optional' => attributes.fetch(:optional, false),
          'fallbackCode' => attributes.fetch(:fallback_code, nil)
        }
      end

      protected

      def query_attributes(attributes)
        {
          name: name,
          code: code,
          optional: optional,
          fallbackCode: fallback_code
        }.merge(
          attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v }
        )
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
contentful-management-3.8.0 lib/contentful/management/locale.rb
contentful-management-3.7.0 lib/contentful/management/locale.rb
contentful-management-3.6.0 lib/contentful/management/locale.rb
contentful-management-3.5.0 lib/contentful/management/locale.rb
contentful-management-3.4.0 lib/contentful/management/locale.rb
contentful-management-3.3.0 lib/contentful/management/locale.rb
contentful-management-3.2.0 lib/contentful/management/locale.rb
contentful-management-3.1.0 lib/contentful/management/locale.rb
contentful-management-3.0.0 lib/contentful/management/locale.rb
contentful-management-2.13.1 lib/contentful/management/locale.rb
contentful-management-2.13.0 lib/contentful/management/locale.rb
contentful-management-2.12.1 lib/contentful/management/locale.rb
contentful-management-2.12.0 lib/contentful/management/locale.rb
contentful-management-2.11.0 lib/contentful/management/locale.rb
contentful-management-2.10.0 lib/contentful/management/locale.rb
contentful-management-2.9.1 lib/contentful/management/locale.rb
contentful-management-2.9.0 lib/contentful/management/locale.rb
contentful-management-2.8.2 lib/contentful/management/locale.rb
contentful-management-2.8.1 lib/contentful/management/locale.rb