Sha256: a9ed1074da0472aa359694595c3b54be15bdff311b6669b92c864dc4f85fa13b

Contents?: true

Size: 523 Bytes

Versions: 2

Compression:

Stored size: 523 Bytes

Contents

module JsonApiClient
  module Helpers
    module Serializable
      RESERVED = ['id', 'type', 'links', 'meta', 'relationships']

      # def as_json(options=nil)
      #   attributes.slice(*RESERVED).tap do |h|
      #     h['attributes'] = serialized_attributes
      #   end
      # end

      def data
        attributes.slice(*RESERVED).tap do |h|
          h['attributes'] = serialized_attributes
        end
      end

      def serialized_attributes
        attributes.except(*RESERVED)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_api_client-1.0.0.beta3 lib/json_api_client/helpers/serializable.rb
json_api_client-1.0.0.beta2 lib/json_api_client/helpers/serializable.rb