Sha256: 007273c9216d0dd6b4de3b49f6552d8b03dcb130c9ff4b2e631860abb72c3e22

Contents?: true

Size: 783 Bytes

Versions: 12

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

require 'easy/jsonapi/field'
require 'easy/jsonapi/document/resource/attributes'
require 'easy/jsonapi/name_value_pair'

module JSONAPI
  class Document
    class Resource
      class Attributes < JSONAPI::NameValuePairCollection

        # An individual attribute in a JSON:API Attributes object
        class Attribute < JSONAPI::NameValuePair

          attr_reader :field

          # @param name [String] The name of an attribute
          # @param value [String] The value of an attribute
          # @param type [Any] The type of an attribute value
          def initialize(name, value, type: String)
            @field = JSONAPI::Field.new(name, type: type)
            super(name, value)
          end

        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
easy-jsonapi-1.0.11 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.10 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.9 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.8 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.7 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.6 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.5 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.4 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.3 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.2 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.1 lib/easy/jsonapi/document/resource/attributes/attribute.rb
easy-jsonapi-1.0.0 lib/easy/jsonapi/document/resource/attributes/attribute.rb