Class: Prosper::Api::LancamentoFinanceiro
- Inherits:
-
Object
- Object
- Prosper::Api::LancamentoFinanceiro
show all
- Includes:
- HTTParty
- Defined in:
- lib/prosper/api/lancamento_financeiro.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of LancamentoFinanceiro.
15
16
17
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 15
def initialize(attributes = {})
self.attributes = attributes
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
47
48
49
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 47
def method_missing(m, *args, &block)
self.attributes[m.to_sym]
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
12
13
14
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 12
def attributes
@attributes
end
|
#errors ⇒ Object
Returns the value of attribute errors.
13
14
15
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 13
def errors
@errors
end
|
Class Method Details
.find(id) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 23
def self.find(id)
return nil if id.blank?
prosper_object = get("/api/lancamentos_financeiros/#{id}").parsed_response.symbolize_keys
prosper_object = {:id => id} if prosper_object.empty?
LancamentoFinanceiro.new( prosper_object )
end
|
.where(options = {}) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 34
def self.where(options = {})
list = get("/api/lancamentos_financeiros", :body => options).parsed_response
resposta = []
list.each do |object|
resposta << LancamentoFinanceiro.new(object.symbolize_keys)
end
resposta
end
|
Instance Method Details
#load! ⇒ Object
43
44
45
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 43
def load!
attributes = LancamentoFinanceiro.find(self.attributes[:id]).attributes
end
|
#save ⇒ Object
19
20
21
|
# File 'lib/prosper/api/lancamento_financeiro.rb', line 19
def save
self.attributes = self.class.post("/api/lancamentos_financeiros", :body => {:lancamento_financeiro => self.attributes}).parsed_response.symbolize_keys
end
|