class ActiveRequest::Base

Attributes

errors[R]

Public Class Methods

model_name() click to toggle source
# File lib/active_request/base.rb, line 25
def self.model_name
  name.underscore
end
new(options = nil) click to toggle source
# File lib/active_request/base.rb, line 11
def initialize(options = nil)
  if options.present?
    options.symbolize_keys!
    attributes.each do |att|
      send("#{att}=", options[att]) if options[att].present?
    end
    belongs_tos.each do |att|
      simble = att[:foreign_key].to_sym
      send("#{att[:foreign_key]}=", options[simble]) if options[simble].present?
    end if belongs_tos
  end
  self.class.base_uri("#{ActiveRequest.configuration.uri}/#{ActiveRequest.configuration.api_version}/")
end
new(*args, &blk) click to toggle source
# File lib/active_request/base.rb, line 29
def self.new(*args, &blk)
  alloc = allocate
  build_has_manys(alloc)
  build_belongs_tos(alloc)
  alloc.instance_eval { initialize(*args, &blk) }
  alloc
end