Sha256: 7fff03e35bb40cdfa5d5676066d26e16e9ce5782298a0e49f9464860558a24e3

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 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)
        attributes.each_with_object({}) { |(k, v), result| result[k.to_sym] = v }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
contentful-management-2.8.0 lib/contentful/management/locale.rb
contentful-management-2.7.0 lib/contentful/management/locale.rb
contentful-management-2.6.0 lib/contentful/management/locale.rb
contentful-management-2.5.0 lib/contentful/management/locale.rb
contentful-management-2.4.0 lib/contentful/management/locale.rb
contentful-management-2.3.0 lib/contentful/management/locale.rb
contentful-management-2.2.2 lib/contentful/management/locale.rb
contentful-management-2.2.1 lib/contentful/management/locale.rb
contentful-management-2.2.0 lib/contentful/management/locale.rb
contentful-management-2.1.1 lib/contentful/management/locale.rb
contentful-management-2.1.0 lib/contentful/management/locale.rb
contentful-management-2.0.2 lib/contentful/management/locale.rb
contentful-management-2.0.1 lib/contentful/management/locale.rb
contentful-management-2.0.0 lib/contentful/management/locale.rb