Sha256: 8f58030c45c9cd0134f07cffad3d552ec0e8737b17a1242db9074cbc2f6a020c
Contents?: true
Size: 664 Bytes
Versions: 1
Compression:
Stored size: 664 Bytes
Contents
module JsonApiClient module Linking class TopLevelLinks attr_reader :links, :record_class def initialize(record_class, links) @links = links @record_class = record_class end def respond_to_missing?(method, include_private = false) links.has_key?(method.to_s) || super end def method_missing(method, *args) if respond_to_missing?(method) fetch_link(method) else super end end def fetch_link(link_name) link_definition = links.fetch(link_name.to_s) record_class.requestor.linked(link_definition) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json_api_client-1.0.0.beta | lib/json_api_client/linking/top_level_links.rb |