class Prosper::Api::Empresa
Attributes
attributes[RW]
errors[RW]
Public Class Methods
all()
click to toggle source
# File lib/prosper/api/empresa.rb, line 29 def self.all Empresa.where end
find(id)
click to toggle source
# File lib/prosper/api/empresa.rb, line 22 def self.find(id) return nil if id.blank? prosper_object = get("/api/empresas/#{id}").parsed_response.symbolize_keys prosper_object = {:id => id} if prosper_object.empty? Empresa.new( prosper_object ) end
new(attributes = {})
click to toggle source
# File lib/prosper/api/empresa.rb, line 14 def initialize(attributes = {}) self.attributes = attributes end
where(options = {})
click to toggle source
# File lib/prosper/api/empresa.rb, line 33 def self.where(options = {}) list = get("/api/empresas", :body => options).parsed_response resposta = [] list.each do |object| resposta << Empresa.new(object.symbolize_keys) end resposta end
Public Instance Methods
load!()
click to toggle source
# File lib/prosper/api/empresa.rb, line 42 def load! attributes = Empresa.find(self.attributes[:id]).attributes end
method_missing(m, *args, &block)
click to toggle source
# File lib/prosper/api/empresa.rb, line 46 def method_missing(m, *args, &block) self.attributes[m.to_sym] end
save()
click to toggle source
# File lib/prosper/api/empresa.rb, line 18 def save self.attributes = self.class.post("/api/empresas", :body => {:empresa => self.attributes}).parsed_response.symbolize_keys end