Sha256: 7fc8964acc58a98f4136e3afedf8b930a3d9d32eefc5b4b54b852d56ae4233ab

Contents?: true

Size: 952 Bytes

Versions: 1

Compression:

Stored size: 952 Bytes

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
  #     uses_api $api
  #   end
  #
  #   @user = User.new(:name => "RĂ©mi")
  module Model
    autoload :Base,          "her/model/base"
    autoload :HTTP,          "her/model/http"
    autoload :ORM,           "her/model/orm"
    autoload :Relationships, "her/model/relationships"

    extend ActiveSupport::Concern

    # Instance methods
    include Her::Model::ORM

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

      # 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

1 entries across 1 versions & 1 rubygems

Version Path
her-0.1.5 lib/her/model.rb