Sha256: 7b10eafdf11f97b271cb2a0c3578f9533f8f63b1a5f58ebd2f509d89c7fa3235

Contents?: true

Size: 447 Bytes

Versions: 2

Compression:

Stored size: 447 Bytes

Contents

module JsonApiClient
  module Helpers
    module Linkable
      extend ActiveSupport::Concern

      included do
        class_attribute :linker
        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.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.beta3 lib/json_api_client/helpers/linkable.rb
json_api_client-1.0.0.beta2 lib/json_api_client/helpers/linkable.rb