Class: FreeAgent::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/free_agent/base.rb

Overview

The Base class for any FreeAgent resource.

Dynamic Finders

Like ActiveRecord, this class support dynamic finders. You can use dynamic finders to search a resource by any of its attributes.

class Contact < Base
end

Contact.find_by_email '[email protected]'
Contact.find_by_username_and_email 'weppos', '[email protected]'

However, there’s one important caveat we should mention. This feature is not very efficient and the more records you have,  the longer the query it takes.

This is because record filtering is performed client-side. The library first loads and instantiate all records, then it filters them applying given criteria.

Defined Under Namespace

Classes: DynamicFinderMatch

Instance Method Summary collapse

Instance Method Details

#respond_to?(method_id, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


128
129
130
131
132
133
134
# File 'lib/free_agent/base.rb', line 128

def respond_to?(method_id, include_private = false)
  if DynamicFinderMatch.match(method_id)
    return true
  end

  super
end