prosper-api 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Rakefile +8 -0
- data/lib/prosper/api.rb +14 -1
- data/lib/prosper/api/configuracao.rb +7 -2
- data/lib/prosper/api/conta.rb +53 -0
- data/lib/prosper/api/empresa.rb +53 -0
- data/lib/prosper/api/forma_pagamento.rb +53 -0
- data/lib/prosper/api/lancamento_financeiro.rb +53 -0
- data/lib/prosper/api/version.rb +2 -1
- data/prosper-api.gemspec +5 -0
- data/test/api_config_test.rb +23 -0
- data/test/contas_test.rb +33 -0
- data/test/empresas_test.rb +58 -0
- data/test/formas_pagamento_test.rb +58 -0
- data/test/lancamentos_financeiros_test.rb +60 -0
- metadata +73 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTM3MTZiYjJmODI1NDY4ZDkwNGI5ZGQ0YzYzYWY3ZmY3MmMyYzRmNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWZkYTczNGJlZTU5ZDI2NDczYzc3N2Y2YWFmMGU5NzZkNGQxYjUxMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzQ2NDhmZmYzZmFjNjBkNjE2ZjBkYjk4ODg1ZGM1OTc4YzI2YTk3MTBiZGE0
|
10
|
+
ZGMzN2YwMTlkMjhhZDQwZTI4MDM4Mjc4YzQ5NjIyMjU4NDg5MTcyYjUxYjU1
|
11
|
+
M2JmMjgwZjVkOGYwZjE4ZDRhOGY1MjI0Y2NhMjg4NWMxNDY2YWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTQ3NDUyZDlmZTQxNjhhN2EzMWQyNGY0YzhjOWI2NzA4YTA1Mzk5YWFmNzE0
|
14
|
+
ZDVjMWJhOTJmNGRiZDBjMTE5YWMyYjc0Y2JiOGYzNWRmMjUzODJjOWJjNjk1
|
15
|
+
NTljYzExZjBiNjQ1Y2RkNzU2ZjE5MjA4MjdkODkxZTQ1ZDhjZDQ=
|
data/Rakefile
CHANGED
data/lib/prosper/api.rb
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'active_support/core_ext'
|
1
3
|
require "prosper/api/version"
|
2
4
|
|
3
5
|
module Prosper
|
4
6
|
module Api
|
5
|
-
|
7
|
+
|
8
|
+
autoload :Configuracao, 'prosper/api/configuracao'
|
9
|
+
autoload :Conta, 'prosper/api/conta'
|
10
|
+
autoload :Empresa, 'prosper/api/empresa'
|
11
|
+
autoload :FormaPagamento, 'prosper/api/forma_pagamento'
|
12
|
+
autoload :LancamentoFinanceiro, 'prosper/api/lancamento_financeiro'
|
13
|
+
|
14
|
+
def self.config
|
15
|
+
yield(Configuracao.instance) if block_given?
|
16
|
+
return Configuracao.instance
|
17
|
+
end
|
18
|
+
|
6
19
|
end
|
7
20
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Prosper
|
6
|
+
module Api
|
7
|
+
class Conta
|
8
|
+
|
9
|
+
include HTTParty
|
10
|
+
base_uri ::Prosper::Api.config.url
|
11
|
+
|
12
|
+
attr_accessor :attributes
|
13
|
+
attr_accessor :errors
|
14
|
+
|
15
|
+
def initialize(attributes = {})
|
16
|
+
self.attributes = attributes
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
self.attributes = self.class.post("/api/contas", :body => {:lancamento_financeiro => self.attributes}).parsed_response.symbolize_keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.find(id)
|
24
|
+
return nil if id.blank?
|
25
|
+
prosper_object = get("/api/contas/#{id}").parsed_response.symbolize_keys
|
26
|
+
prosper_object = {:id => id} if prosper_object.empty?
|
27
|
+
Conta.new( prosper_object )
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.all
|
31
|
+
Conta.where
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.where(options = {})
|
35
|
+
list = get("/api/contas", :body => options).parsed_response
|
36
|
+
resposta = []
|
37
|
+
list.each do |object|
|
38
|
+
resposta << Conta.new(object.symbolize_keys)
|
39
|
+
end
|
40
|
+
resposta
|
41
|
+
end
|
42
|
+
|
43
|
+
def load!
|
44
|
+
self.attributes = Conta.find(self.attributes[:id]).attributes
|
45
|
+
end
|
46
|
+
|
47
|
+
def method_missing(m, *args, &block)
|
48
|
+
self.attributes[m.to_sym]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Prosper
|
6
|
+
module Api
|
7
|
+
class Empresa
|
8
|
+
|
9
|
+
include HTTParty
|
10
|
+
base_uri ::Prosper::Api.config.url
|
11
|
+
|
12
|
+
attr_accessor :attributes
|
13
|
+
attr_accessor :errors
|
14
|
+
|
15
|
+
def initialize(attributes = {})
|
16
|
+
self.attributes = attributes
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
self.attributes = self.class.post("/api/empresas", :body => {:empresa => self.attributes}).parsed_response.symbolize_keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.find(id)
|
24
|
+
return nil if id.blank?
|
25
|
+
prosper_object = get("/api/empresas/#{id}").parsed_response.symbolize_keys
|
26
|
+
prosper_object = {:id => id} if prosper_object.empty?
|
27
|
+
Empresa.new( prosper_object )
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.all
|
31
|
+
Empresa.where
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.where(options = {})
|
35
|
+
list = get("/api/empresas", :body => options).parsed_response
|
36
|
+
resposta = []
|
37
|
+
list.each do |object|
|
38
|
+
resposta << Empresa.new(object.symbolize_keys)
|
39
|
+
end
|
40
|
+
resposta
|
41
|
+
end
|
42
|
+
|
43
|
+
def load!
|
44
|
+
attributes = Empresa.find(self.attributes[:id]).attributes
|
45
|
+
end
|
46
|
+
|
47
|
+
def method_missing(m, *args, &block)
|
48
|
+
self.attributes[m.to_sym]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Prosper
|
6
|
+
module Api
|
7
|
+
class FormaPagamento
|
8
|
+
|
9
|
+
include HTTParty
|
10
|
+
base_uri ::Prosper::Api.config.url
|
11
|
+
|
12
|
+
attr_accessor :attributes
|
13
|
+
attr_accessor :errors
|
14
|
+
|
15
|
+
def initialize(attributes = {})
|
16
|
+
self.attributes = attributes
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
self.attributes = self.class.post("/api/formas_pagamento", :body => {:lancamento_financeiro => self.attributes}).parsed_response.symbolize_keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.find(id)
|
24
|
+
return nil if id.blank?
|
25
|
+
prosper_object = get("/api/formas_pagamento/#{id}").parsed_response.symbolize_keys
|
26
|
+
prosper_object = {:id => id} if prosper_object.empty?
|
27
|
+
FormaPagamento.new( prosper_object )
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.all
|
31
|
+
FormaPagamento.where
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.where(options = {})
|
35
|
+
list = get("/api/formas_pagamento", :body => options).parsed_response
|
36
|
+
resposta = []
|
37
|
+
list.each do |object|
|
38
|
+
resposta << FormaPagamento.new(object.symbolize_keys)
|
39
|
+
end
|
40
|
+
resposta
|
41
|
+
end
|
42
|
+
|
43
|
+
def load!
|
44
|
+
attributes = FormaPagamento.find(self.attributes[:id]).attributes
|
45
|
+
end
|
46
|
+
|
47
|
+
def method_missing(m, *args, &block)
|
48
|
+
self.attributes[m.to_sym]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Prosper
|
6
|
+
module Api
|
7
|
+
class LancamentoFinanceiro
|
8
|
+
|
9
|
+
include HTTParty
|
10
|
+
base_uri ::Prosper::Api.config.url
|
11
|
+
|
12
|
+
attr_accessor :attributes
|
13
|
+
attr_accessor :errors
|
14
|
+
|
15
|
+
def initialize(attributes = {})
|
16
|
+
self.attributes = attributes
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
self.attributes = self.class.post("/api/lancamentos_financeiros", :body => {:lancamento_financeiro => self.attributes}).parsed_response.symbolize_keys
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.find(id)
|
24
|
+
return nil if id.blank?
|
25
|
+
prosper_object = get("/api/lancamentos_financeiros/#{id}").parsed_response.symbolize_keys
|
26
|
+
prosper_object = {:id => id} if prosper_object.empty?
|
27
|
+
LancamentoFinanceiro.new( prosper_object )
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.all
|
31
|
+
LancamentoFinanceiro.where
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.where(options = {})
|
35
|
+
list = get("/api/lancamentos_financeiros", :body => options).parsed_response
|
36
|
+
resposta = []
|
37
|
+
list.each do |object|
|
38
|
+
resposta << LancamentoFinanceiro.new(object.symbolize_keys)
|
39
|
+
end
|
40
|
+
resposta
|
41
|
+
end
|
42
|
+
|
43
|
+
def load!
|
44
|
+
attributes = LancamentoFinanceiro.find(self.attributes[:id]).attributes
|
45
|
+
end
|
46
|
+
|
47
|
+
def method_missing(m, *args, &block)
|
48
|
+
self.attributes[m.to_sym]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/prosper/api/version.rb
CHANGED
data/prosper-api.gemspec
CHANGED
@@ -13,6 +13,10 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "http://www.qw3.com.br"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
+
spec.add_dependency 'httparty', '>= 0.11.0'
|
17
|
+
spec.add_dependency 'json', '~> 1.7.7'
|
18
|
+
spec.add_dependency 'activesupport', '>= 3.2.1'
|
19
|
+
|
16
20
|
spec.files = `git ls-files`.split($/)
|
17
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
@@ -20,4 +24,5 @@ Gem::Specification.new do |spec|
|
|
20
24
|
|
21
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
26
|
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency 'minitest', '>= 5.0'
|
23
28
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'prosper/api'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe Prosper::Api do
|
8
|
+
|
9
|
+
before do
|
10
|
+
Prosper::Api.config do |config|
|
11
|
+
config.url = 'http://localhost:3001'
|
12
|
+
config.token = 'xyz123'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "deveria guardar os dados corretamente" do
|
17
|
+
|
18
|
+
Prosper::Api.config.url.must_equal 'http://localhost:3001'
|
19
|
+
Prosper::Api.config.token.must_equal 'xyz123'
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/test/contas_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'prosper/api'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe Prosper::Api::Conta do
|
8
|
+
|
9
|
+
before do
|
10
|
+
@object = Prosper::Api::Conta.new( { :id => 1 })
|
11
|
+
end
|
12
|
+
|
13
|
+
it "deveria listar corretamente" do
|
14
|
+
@lancamentos = Prosper::Api::Conta.all
|
15
|
+
@lancamentos.count.must_equal 1
|
16
|
+
@lancamentos.first.must_be_instance_of Prosper::Api::Conta
|
17
|
+
end
|
18
|
+
|
19
|
+
it "deveria guardar dados corretamente" do
|
20
|
+
@object.load!
|
21
|
+
@object.id.must_equal 1
|
22
|
+
@object.nome.must_equal 'Conta Principal'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "deveria recuperar dados corretamente" do
|
26
|
+
obj = Prosper::Api::Conta.find(1)
|
27
|
+
obj.nome.must_equal 'Conta Principal'
|
28
|
+
|
29
|
+
obj = Prosper::Api::Conta.find(1363222)
|
30
|
+
obj.nome.must_equal nil
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# # -*- encoding : utf-8 -*-
|
2
|
+
# require 'prosper'
|
3
|
+
|
4
|
+
# require 'minitest/spec'
|
5
|
+
# require 'minitest/autorun'
|
6
|
+
|
7
|
+
# describe Prosper::LancamentoFinanceiro do
|
8
|
+
|
9
|
+
# before do
|
10
|
+
# @prosper_lancamento_financeiro = Prosper::LancamentoFinanceiro.new( {
|
11
|
+
# :id => 9999,
|
12
|
+
# :valor => 100,
|
13
|
+
# :data => '2014-01-30',
|
14
|
+
# :data_prevista => '2014-01-30',
|
15
|
+
# :descricao => "Pagamento de Comissão #1",
|
16
|
+
# :observacoes => "Pagamento referente às comissões do representante: '<Nome do representante>'\nConsulte o sistema de comissões para mais detalhes.",
|
17
|
+
# :forma_pagamento_id => 1,
|
18
|
+
# :conta_id => 1,
|
19
|
+
# :link_detalhes => 'http://localhost:3001/pagamentos_comissao',
|
20
|
+
# :empresa_id => 1
|
21
|
+
# })
|
22
|
+
# end
|
23
|
+
|
24
|
+
# it "deveria listar corretamente" do
|
25
|
+
# @lancamentos = Prosper::LancamentoFinanceiro.all
|
26
|
+
# @lancamentos.count.must_be :>, 0
|
27
|
+
# @lancamentos.first.must_be_instance_of Prosper::LancamentoFinanceiro
|
28
|
+
# end
|
29
|
+
|
30
|
+
# it "deveria guardar dados corretamente" do
|
31
|
+
# @prosper_lancamento_financeiro.id.must_equal 9999
|
32
|
+
# @prosper_lancamento_financeiro.valor.must_equal 100
|
33
|
+
# @prosper_lancamento_financeiro.data.must_equal '2014-01-30'
|
34
|
+
# @prosper_lancamento_financeiro.data_prevista.must_equal '2014-01-30'
|
35
|
+
# @prosper_lancamento_financeiro.descricao.must_equal "Pagamento de Comissão #1"
|
36
|
+
# @prosper_lancamento_financeiro.observacoes.must_equal "Pagamento referente às comissões do representante: '<Nome do representante>'\nConsulte o sistema de comissões para mais detalhes."
|
37
|
+
# @prosper_lancamento_financeiro.forma_pagamento_id.must_equal 1
|
38
|
+
# @prosper_lancamento_financeiro.conta_id.must_equal 1
|
39
|
+
# @prosper_lancamento_financeiro.link_detalhes.must_equal 'http://localhost:3001/pagamentos_comissao'
|
40
|
+
# end
|
41
|
+
|
42
|
+
# it "deveria recuperar dados corretamente" do
|
43
|
+
# lf = Prosper::LancamentoFinanceiro.find(1363)
|
44
|
+
# lf.valor.to_f.must_equal 39.33
|
45
|
+
|
46
|
+
# lf = Prosper::LancamentoFinanceiro.find(1363222)
|
47
|
+
# lf.valor.must_equal nil
|
48
|
+
# end
|
49
|
+
|
50
|
+
# it "deveria salvar dados corretamente" do
|
51
|
+
# @prosper_lancamento_financeiro.save
|
52
|
+
|
53
|
+
# lf = Prosper::LancamentoFinanceiro.find(9999)
|
54
|
+
# lf.valor.to_f.must_equal 100
|
55
|
+
# lf.data.must_equal '2014-01-30'
|
56
|
+
# end
|
57
|
+
|
58
|
+
# end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# # -*- encoding : utf-8 -*-
|
2
|
+
# require 'prosper'
|
3
|
+
|
4
|
+
# require 'minitest/spec'
|
5
|
+
# require 'minitest/autorun'
|
6
|
+
|
7
|
+
# describe Prosper::LancamentoFinanceiro do
|
8
|
+
|
9
|
+
# before do
|
10
|
+
# @prosper_lancamento_financeiro = Prosper::LancamentoFinanceiro.new( {
|
11
|
+
# :id => 9999,
|
12
|
+
# :valor => 100,
|
13
|
+
# :data => '2014-01-30',
|
14
|
+
# :data_prevista => '2014-01-30',
|
15
|
+
# :descricao => "Pagamento de Comissão #1",
|
16
|
+
# :observacoes => "Pagamento referente às comissões do representante: '<Nome do representante>'\nConsulte o sistema de comissões para mais detalhes.",
|
17
|
+
# :forma_pagamento_id => 1,
|
18
|
+
# :conta_id => 1,
|
19
|
+
# :link_detalhes => 'http://localhost:3001/pagamentos_comissao',
|
20
|
+
# :empresa_id => 1
|
21
|
+
# })
|
22
|
+
# end
|
23
|
+
|
24
|
+
# it "deveria listar corretamente" do
|
25
|
+
# @lancamentos = Prosper::LancamentoFinanceiro.all
|
26
|
+
# @lancamentos.count.must_be :>, 0
|
27
|
+
# @lancamentos.first.must_be_instance_of Prosper::LancamentoFinanceiro
|
28
|
+
# end
|
29
|
+
|
30
|
+
# it "deveria guardar dados corretamente" do
|
31
|
+
# @prosper_lancamento_financeiro.id.must_equal 9999
|
32
|
+
# @prosper_lancamento_financeiro.valor.must_equal 100
|
33
|
+
# @prosper_lancamento_financeiro.data.must_equal '2014-01-30'
|
34
|
+
# @prosper_lancamento_financeiro.data_prevista.must_equal '2014-01-30'
|
35
|
+
# @prosper_lancamento_financeiro.descricao.must_equal "Pagamento de Comissão #1"
|
36
|
+
# @prosper_lancamento_financeiro.observacoes.must_equal "Pagamento referente às comissões do representante: '<Nome do representante>'\nConsulte o sistema de comissões para mais detalhes."
|
37
|
+
# @prosper_lancamento_financeiro.forma_pagamento_id.must_equal 1
|
38
|
+
# @prosper_lancamento_financeiro.conta_id.must_equal 1
|
39
|
+
# @prosper_lancamento_financeiro.link_detalhes.must_equal 'http://localhost:3001/pagamentos_comissao'
|
40
|
+
# end
|
41
|
+
|
42
|
+
# it "deveria recuperar dados corretamente" do
|
43
|
+
# lf = Prosper::LancamentoFinanceiro.find(1363)
|
44
|
+
# lf.valor.to_f.must_equal 39.33
|
45
|
+
|
46
|
+
# lf = Prosper::LancamentoFinanceiro.find(1363222)
|
47
|
+
# lf.valor.must_equal nil
|
48
|
+
# end
|
49
|
+
|
50
|
+
# it "deveria salvar dados corretamente" do
|
51
|
+
# @prosper_lancamento_financeiro.save
|
52
|
+
|
53
|
+
# lf = Prosper::LancamentoFinanceiro.find(9999)
|
54
|
+
# lf.valor.to_f.must_equal 100
|
55
|
+
# lf.data.must_equal '2014-01-30'
|
56
|
+
# end
|
57
|
+
|
58
|
+
# end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'prosper/api'
|
3
|
+
|
4
|
+
require 'minitest/spec'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
describe Prosper::Api::LancamentoFinanceiro do
|
8
|
+
|
9
|
+
# tá comentado porque essa base tá vazia
|
10
|
+
|
11
|
+
# before do
|
12
|
+
# @prosper_lancamento_financeiro = Prosper::Api::LancamentoFinanceiro.new( {
|
13
|
+
# :id => 9999,
|
14
|
+
# :valor => 100,
|
15
|
+
# :data => '2014-01-30',
|
16
|
+
# :data_prevista => '2014-01-30',
|
17
|
+
# :descricao => "Pagamento de Comissão #1",
|
18
|
+
# :observacoes => "Pagamento referente às comissões do representante: '<Nome do representante>'\nConsulte o sistema de comissões para mais detalhes.",
|
19
|
+
# :forma_pagamento_id => 1,
|
20
|
+
# :conta_id => 1,
|
21
|
+
# :link_detalhes => 'http://localhost:3001/pagamentos_comissao',
|
22
|
+
# :empresa_id => 1
|
23
|
+
# })
|
24
|
+
# end
|
25
|
+
|
26
|
+
# it "deveria listar corretamente" do
|
27
|
+
# @lancamentos = Prosper::Api::LancamentoFinanceiro.all
|
28
|
+
# @lancamentos.count.must_be :>, 0
|
29
|
+
# @lancamentos.first.must_be_instance_of Prosper::Api::LancamentoFinanceiro
|
30
|
+
# end
|
31
|
+
|
32
|
+
# it "deveria guardar dados corretamente" do
|
33
|
+
# @prosper_lancamento_financeiro.id.must_equal 9999
|
34
|
+
# @prosper_lancamento_financeiro.valor.must_equal 100
|
35
|
+
# @prosper_lancamento_financeiro.data.must_equal '2014-01-30'
|
36
|
+
# @prosper_lancamento_financeiro.data_prevista.must_equal '2014-01-30'
|
37
|
+
# @prosper_lancamento_financeiro.descricao.must_equal "Pagamento de Comissão #1"
|
38
|
+
# @prosper_lancamento_financeiro.observacoes.must_equal "Pagamento referente às comissões do representante: '<Nome do representante>'\nConsulte o sistema de comissões para mais detalhes."
|
39
|
+
# @prosper_lancamento_financeiro.forma_pagamento_id.must_equal 1
|
40
|
+
# @prosper_lancamento_financeiro.conta_id.must_equal 1
|
41
|
+
# @prosper_lancamento_financeiro.link_detalhes.must_equal 'http://localhost:3001/pagamentos_comissao'
|
42
|
+
# end
|
43
|
+
|
44
|
+
# it "deveria recuperar dados corretamente" do
|
45
|
+
# lf = Prosper::Api::LancamentoFinanceiro.find(1363)
|
46
|
+
# lf.valor.to_f.must_equal 39.33
|
47
|
+
|
48
|
+
# lf = Prosper::Api::LancamentoFinanceiro.find(1363222)
|
49
|
+
# lf.valor.must_equal nil
|
50
|
+
# end
|
51
|
+
|
52
|
+
# it "deveria salvar dados corretamente" do
|
53
|
+
# @prosper_lancamento_financeiro.save
|
54
|
+
|
55
|
+
# lf = Prosper::Api::LancamentoFinanceiro.find(9999)
|
56
|
+
# lf.valor.to_f.must_equal 100
|
57
|
+
# lf.data.must_equal '2014-01-30'
|
58
|
+
# end
|
59
|
+
|
60
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prosper-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QW3 Software & Marketing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.11.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.11.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.2.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.2.1
|
13
55
|
- !ruby/object:Gem::Dependency
|
14
56
|
name: bundler
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +80,20 @@ dependencies:
|
|
38
80
|
- - ! '>='
|
39
81
|
- !ruby/object:Gem::Version
|
40
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
41
97
|
description: Fornece uma interface de conexão com os serviços REST do Prosper ERP
|
42
98
|
email:
|
43
99
|
- contato@qw3.com.br
|
@@ -52,8 +108,17 @@ files:
|
|
52
108
|
- Rakefile
|
53
109
|
- lib/prosper/api.rb
|
54
110
|
- lib/prosper/api/configuracao.rb
|
111
|
+
- lib/prosper/api/conta.rb
|
112
|
+
- lib/prosper/api/empresa.rb
|
113
|
+
- lib/prosper/api/forma_pagamento.rb
|
114
|
+
- lib/prosper/api/lancamento_financeiro.rb
|
55
115
|
- lib/prosper/api/version.rb
|
56
116
|
- prosper-api.gemspec
|
117
|
+
- test/api_config_test.rb
|
118
|
+
- test/contas_test.rb
|
119
|
+
- test/empresas_test.rb
|
120
|
+
- test/formas_pagamento_test.rb
|
121
|
+
- test/lancamentos_financeiros_test.rb
|
57
122
|
homepage: http://www.qw3.com.br
|
58
123
|
licenses:
|
59
124
|
- MIT
|
@@ -78,4 +143,9 @@ rubygems_version: 2.0.3
|
|
78
143
|
signing_key:
|
79
144
|
specification_version: 4
|
80
145
|
summary: Integra com a API do Prosper ERP
|
81
|
-
test_files:
|
146
|
+
test_files:
|
147
|
+
- test/api_config_test.rb
|
148
|
+
- test/contas_test.rb
|
149
|
+
- test/empresas_test.rb
|
150
|
+
- test/formas_pagamento_test.rb
|
151
|
+
- test/lancamentos_financeiros_test.rb
|