Sha256: c4fb30d9e2d692af92735d9520e40f8b9f90a31c96061305ccdf4932d0e6acee
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# -*- encoding : utf-8 -*- require 'httparty' require 'json' module Prosper module Api class LancamentoFinanceiro include HTTParty base_uri ::Prosper::Api.config.url attr_accessor :attributes attr_accessor :errors def initialize(attributes = {}) self.attributes = attributes end def save self.attributes = self.class.post("/api/lancamentos_financeiros", :body => {:lancamento_financeiro => self.attributes}).parsed_response.symbolize_keys end 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 def self.all LancamentoFinanceiro.where end 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 def load! attributes = LancamentoFinanceiro.find(self.attributes[:id]).attributes end def method_missing(m, *args, &block) self.attributes[m.to_sym] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prosper-api-0.1.0 | lib/prosper/api/lancamento_financeiro.rb |