Module: Arkenstone::Document
- Defined in:
- lib/arkenstone/document.rb
Overview
Document
A ‘Document` is the main entry point for Arkenstone. A `Document` is a model that is retrieved and/or stored on a RESTful service. For example, if you have a web service that has a URL structure like:
http://example.com/users
You can create a ‘User` model, include `Document` and it will automatically create methods to fetch and save data from that URL.
class User
include Arkenstone::Document
url 'http://example.com/users'
attributes :first_name, :last_name, :email
end
Attributes create properties on instances that match up with the data returned by the ‘url`. Properties on the web service are ignored if they are not present within the `attributes` list.
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/arkenstone/document.rb', line 25 def included(base) base.send :include, Arkenstone::Helpers base.send :include, Arkenstone::Associations base.send :include, Arkenstone::Document::InstanceMethods base.send :include, Arkenstone::Network base.extend Arkenstone::Document::ClassMethods end |