Sha256: 4311e205fe8d87ddb7a023f015cfe84f235b6880757b20e14a2244d74bc46017

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

module JsonApiClient
  module Helpers
    module Linkable
      extend ActiveSupport::Concern

      included do
        class_attribute :linker, instance_accessor: false
        self.linker = Linking::Links

        # the links for this resource
        attr_accessor :links

        initializer do |obj, params|
          links = params && params.delete("links")
          links ||= {}
          obj.links = obj.class.linker.new(links)
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_api_client-1.0.0.beta5 lib/json_api_client/helpers/linkable.rb
json_api_client-1.0.0.beta4 lib/json_api_client/helpers/linkable.rb