Module: OpenX::Persistance::ClassMethods

Included in:
Services::Base
Defined in:
lib/openx/persistance.rb

Instance Method Summary collapse

Instance Method Details

#create!(params = {}) ⇒ Object



6
7
8
# File 'lib/openx/persistance.rb', line 6

def create!(params = {})
  new(params).save!
end

#destroy(id) ⇒ Object



22
23
24
# File 'lib/openx/persistance.rb', line 22

def destroy(id)
  new(:id => id).destroy
end

#find(id, *args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/openx/persistance.rb', line 10

def find(id, *args)
  if id == :all
    responses = remote.call(find_all, *args)
    responses.map do |response|
      new(translate(response))
    end
  else
    response  = remote.call(find_one, id)
    new(translate(response))
  end
end