Sha256: 6e2c9fa338e2af02e5f165c6266f640626cd00cf1fe78ae7629df5391889bdc8

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require_relative 'resource'

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

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

      # @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

1 entries across 1 versions & 1 rubygems

Version Path
contentful-management-1.10.1 lib/contentful/management/locale.rb