module Spektrix::Base
This is a mixin which allows any class to get data from a Spektrix
endpoint
Public Class Methods
included(base)
click to toggle source
# File lib/spektrix/base.rb, line 4 def self.included(base) # Include Her::Model. Her does most of the heavy lifting. base.include Her::Model # Extend class methods (below) base.extend ClassMethods # Use the connection we set up in the configuration. base.send(:use_api,->{Spektrix.configuration.connection}) end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Define method_missing
here to allow us to inspect the custom attributes on the object and return as normal attributes.
Calls superclass method
# File lib/spektrix/base.rb, line 16 def method_missing(method, *args, &block) if attributes.has_key?(:custom_attributes) && custom_attributes.has_key?(method.to_sym) custom_attributes[method.to_sym] else super end end