Sha256: a3b5fa560ea3a1d45445311af96d45fde443175dc1f56f53bef5e7299a152697

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module Her
  # This module is the main element of Her. After creating a Her::API object,
  # include this module in your models to get a few magic methods defined in them.
  #
  # @example
  #   class User
  #     include Her::Model
  #   end
  #
  #   @user = User.new(:name => "RĂ©mi")
  #   @user.save
  module Model
    autoload :Base,          "her/model/base"
    autoload :HTTP,          "her/model/http"
    autoload :ORM,           "her/model/orm"
    autoload :Relationships, "her/model/relationships"
    autoload :Hooks,         "her/model/hooks"
    autoload :Introspection, "her/model/introspection"

    extend ActiveSupport::Concern

    # Instance methods
    include Her::Model::ORM
    include Her::Model::Introspection

    # Class methods
    included do
      extend Her::Model::Base
      extend Her::Model::HTTP
      extend Her::Model::ORM
      extend Her::Model::Relationships
      extend Her::Model::Hooks

      # Define default settings
      collection_path "#{self.to_s.downcase.pluralize}"
      item_path "#{self.to_s.downcase}"
      uses_api Her::API.default_api
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
her-0.2 lib/her/model.rb
her-0.1.8.1 lib/her/model.rb
her-0.1.8 lib/her/model.rb