Sha256: f885b1d9757e3f5e01491a8835c6f24d7df0a9dcc3dd2207bcca025f9efeefa5
Contents?: true
Size: 809 Bytes
Versions: 14
Compression:
Stored size: 809 Bytes
Contents
module JsonApiClient module Helpers module Linkable extend ActiveSupport::Concern included do attr_accessor :links, :linked_data initializer do |obj, params| if params && links = params.delete("links") obj.links = links end end end def method_missing(method, *args) return super unless has_link?(method) linked_data.data_for(method, links[method.to_s]) end def respond_to?(symbol, include_all = false) return true if has_link?(symbol) super end private def has_link?(symbol) links && links.has_key?(symbol.to_s) && linked_data && linked_data.has_link?(symbol.to_s) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems