Class: Postal::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/postal/base.rb

Direct Known Subclasses

List, Mailing, Member

Class Method Summary collapse

Class Method Details

.allObject

Alias for find(:all)



17
18
19
# File 'lib/postal/base.rb', line 17

def all
  find(:all)
end

.create(*args) ⇒ Object

Make a new user and immediately save to Lyris



23
24
25
26
27
# File 'lib/postal/base.rb', line 23

def create(*args)
  instance = self.new(*args)
  instance.save
  return instance
end

.create!(*args) ⇒ Object

Make a new user and immediately save to Lyris, but throw an error if the save fails.



31
32
33
34
35
# File 'lib/postal/base.rb', line 31

def create!(*args)
  instance = self.new(*args)
  instance.save!
  return instance
end

.find(*args) ⇒ Object

Find objects based on some options



7
8
9
10
11
12
13
# File 'lib/postal/base.rb', line 7

def find(*args)
  options = extract_options(args)
  case args.first
  when :all then  find_all(options)
  else            find_some(args,options)
  end
end