vpsa 0.0.26 → 0.0.27
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 +4 -4
- data/lib/vpsa/api/category_levels.rb +15 -0
- data/lib/vpsa/api/product_categories.rb +15 -0
- data/lib/vpsa/client.rb +9 -1
- data/lib/vpsa/entity/operational/category_level.rb +11 -0
- data/lib/vpsa/entity/operational/product_category.rb +11 -0
- data/lib/vpsa/version.rb +1 -1
- data/spec/vpsa/api/category_levels_spec.rb +21 -0
- data/spec/vpsa/api/product_categories_spec.rb +21 -0
- data/spec/vpsa/entity/operational/category_level_spec.rb +20 -0
- data/spec/vpsa/entity/operational/product_category_spec.rb +19 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c00eb2304cdaf283495f73c40703c30e0c93cc6
|
4
|
+
data.tar.gz: e08c0450892cfa536b5c1c2249c27c624c3f1456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2a8809933938510841a417bce605642bda815f583ff91f85128985dabd6dc1be3594b71382517dfd20cb822d6c87458094184c4876b0905a88efbc62d0dd85e
|
7
|
+
data.tar.gz: 5db6f70c434de3871b37a02fbfb3ef8ee49956b793535c41bb44530d372943b1645e867ec4531cf8ff6152b05764b69a48acabefbf6761ae7d4e6cf11d031df9
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Vpsa
|
2
|
+
module Api
|
3
|
+
class CategoryLevels < Client
|
4
|
+
require_all 'vpsa/entity/operational', 'category_level'
|
5
|
+
|
6
|
+
base_uri "#{Vpsa::API_ADDRESS}/niveis-categoria-produto"
|
7
|
+
|
8
|
+
def list
|
9
|
+
return parse_response(self.class.get("/", :body => build_body, :headers => header))
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Vpsa
|
2
|
+
module Api
|
3
|
+
class ProductCategories < Client
|
4
|
+
require_all 'vpsa/entity/operational', 'product_category'
|
5
|
+
|
6
|
+
base_uri "#{Vpsa::API_ADDRESS}/categorias-produto"
|
7
|
+
|
8
|
+
def list
|
9
|
+
return parse_response(self.class.get("/", :body => build_body, :headers => header))
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/vpsa/client.rb
CHANGED
@@ -11,7 +11,7 @@ module Vpsa
|
|
11
11
|
parser Proc.new {|b| JSON.parse(b) rescue b}
|
12
12
|
|
13
13
|
require_all 'vpsa/api', 'third_parties', 'entities', 'default_entries', 'provisions', 'user_data', 'installments', 'credit_limits',
|
14
|
-
'client_classes', 'receipts', 'sales_history', 'orders', 'companies', 'sellers', 'products'
|
14
|
+
'client_classes', 'receipts', 'sales_history', 'orders', 'companies', 'sellers', 'products', 'category_levels', 'product_categories'
|
15
15
|
|
16
16
|
attr_accessor :access_token
|
17
17
|
|
@@ -76,6 +76,14 @@ module Vpsa
|
|
76
76
|
Vpsa::Api::Products.new(@access_token)
|
77
77
|
end
|
78
78
|
|
79
|
+
def category_levels
|
80
|
+
Vpsa::Api::CategoryLevels.new(@access_token)
|
81
|
+
end
|
82
|
+
|
83
|
+
def product_categories
|
84
|
+
Vpsa::Api::ProductCategories.new(@access_token)
|
85
|
+
end
|
86
|
+
|
79
87
|
protected
|
80
88
|
def header
|
81
89
|
{"Content-Type" => "application/json", "Accept" => "application/json"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'vpsa/entity/base'
|
2
|
+
|
3
|
+
module Vpsa
|
4
|
+
module Entity
|
5
|
+
module Operational
|
6
|
+
class ProductCategory < Base
|
7
|
+
attr_accessor :id, :ativo, :dataAlteracao, :nome, :origem, :unidade, :metodoControle, :classificacao, :categoriaPai, :nivel
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/vpsa/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Vpsa::Api::CategoryLevels do
|
4
|
+
let(:header) {{"Content-Type" => "application/json", "Accept" => "application/json"}}
|
5
|
+
let(:product_param) {{}}
|
6
|
+
|
7
|
+
describe "list" do
|
8
|
+
before(:each) do
|
9
|
+
stub_request(:get, "#{Vpsa::API_ADDRESS}/niveis-categoria-produto/").to_return(:status => 200)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should issue a get to the category levels url" do
|
13
|
+
expect(Vpsa::Api::CategoryLevels).to receive(:get).with("/", :body => {:token => "abc"}.to_json, :headers => header).and_call_original
|
14
|
+
|
15
|
+
Vpsa.new("abc").category_levels.list
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Vpsa::Api::ProductCategories do
|
4
|
+
let(:header) {{"Content-Type" => "application/json", "Accept" => "application/json"}}
|
5
|
+
let(:product_param) {{}}
|
6
|
+
|
7
|
+
describe "list" do
|
8
|
+
before(:each) do
|
9
|
+
stub_request(:get, "#{Vpsa::API_ADDRESS}/categorias-produto/").to_return(:status => 200)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should issue a get to the product categories url" do
|
13
|
+
expect(Vpsa::Api::ProductCategories).to receive(:get).with("/", :body => {:token => "abc"}.to_json, :headers => header).and_call_original
|
14
|
+
|
15
|
+
Vpsa.new("abc").product_categories.list
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Vpsa::Entity::Operational::CategoryLevel do
|
4
|
+
describe "as_parameter" do
|
5
|
+
|
6
|
+
let(:category_level_as_parameter) {{"id"=>"1", 'ativo'=>'ativo', 'dataAlteracao'=>'01/01/2000', 'nome'=>'nome', 'nivel'=>'1',
|
7
|
+
'compoeReferenciaBase'=>'1', 'idNivelCategoriaProdutoPai'=> '1'}}
|
8
|
+
|
9
|
+
|
10
|
+
it "should return the product as parameter" do
|
11
|
+
category_level = Vpsa::Entity::Operational::CategoryLevel.new({"id"=>"1", 'ativo'=>'ativo', 'dataAlteracao'=>'01/01/2000', 'nome'=>'nome', 'nivel'=>'1',
|
12
|
+
'compoeReferenciaBase'=>'1', 'idNivelCategoriaProdutoPai'=> '1'})
|
13
|
+
|
14
|
+
expect(category_level.as_parameter).to eq(category_level_as_parameter)
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Vpsa::Entity::Operational::ProductCategory do
|
4
|
+
describe "as_parameter" do
|
5
|
+
|
6
|
+
let(:product_category_as_parameter) {{"id"=>"1", 'ativo'=>'ativo', 'dataAlteracao'=>'01/01/2000', 'nome'=>'nome', 'origem'=>'1',
|
7
|
+
'unidade'=>'UN', 'metodoControle'=>'ESTOCAVEL', 'classificacao'=>'1', 'categoriaPai'=>'2', 'nivel'=>'1'}}
|
8
|
+
|
9
|
+
it "should return the product as parameter" do
|
10
|
+
product_category = Vpsa::Entity::Operational::ProductCategory.new({"id"=>"1", 'ativo'=>'ativo', 'dataAlteracao'=>'01/01/2000', 'nome'=>'nome', 'origem'=>'1',
|
11
|
+
'unidade'=>'UN', 'metodoControle'=>'ESTOCAVEL', 'classificacao'=>'1', 'categoriaPai'=>'2', 'nivel'=>'1'})
|
12
|
+
|
13
|
+
expect(product_category.as_parameter).to eq(product_category_as_parameter)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vpsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Berdugo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
55
55
|
- lib/vpsa.rb
|
56
|
+
- lib/vpsa/api/category_levels.rb
|
56
57
|
- lib/vpsa/api/client_classes.rb
|
57
58
|
- lib/vpsa/api/companies.rb
|
58
59
|
- lib/vpsa/api/credit_limits.rb
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- lib/vpsa/api/entities.rb
|
61
62
|
- lib/vpsa/api/installments.rb
|
62
63
|
- lib/vpsa/api/orders.rb
|
64
|
+
- lib/vpsa/api/product_categories.rb
|
63
65
|
- lib/vpsa/api/products.rb
|
64
66
|
- lib/vpsa/api/provisions.rb
|
65
67
|
- lib/vpsa/api/receipts.rb
|
@@ -75,6 +77,8 @@ files:
|
|
75
77
|
- lib/vpsa/entity/commercial/credit_limit.rb
|
76
78
|
- lib/vpsa/entity/commercial/installment.rb
|
77
79
|
- lib/vpsa/entity/commercial/product.rb
|
80
|
+
- lib/vpsa/entity/operational/category_level.rb
|
81
|
+
- lib/vpsa/entity/operational/product_category.rb
|
78
82
|
- lib/vpsa/init_from_hash.rb
|
79
83
|
- lib/vpsa/searcher/administrative/company_searcher.rb
|
80
84
|
- lib/vpsa/searcher/administrative/entity_searcher.rb
|
@@ -88,6 +92,7 @@ files:
|
|
88
92
|
- lib/vpsa/searcher/operational/seller_searcher.rb
|
89
93
|
- lib/vpsa/version.rb
|
90
94
|
- spec/spec_helper.rb
|
95
|
+
- spec/vpsa/api/category_levels_spec.rb
|
91
96
|
- spec/vpsa/api/client_classes_spec.rb
|
92
97
|
- spec/vpsa/api/companies_spec.rb
|
93
98
|
- spec/vpsa/api/credit_limits_spec.rb
|
@@ -95,6 +100,7 @@ files:
|
|
95
100
|
- spec/vpsa/api/entities_spec.rb
|
96
101
|
- spec/vpsa/api/installments_spec.rb
|
97
102
|
- spec/vpsa/api/orders_spec.rb
|
103
|
+
- spec/vpsa/api/product_categories_spec.rb
|
98
104
|
- spec/vpsa/api/products_spec.rb
|
99
105
|
- spec/vpsa/api/provisions_spec.rb
|
100
106
|
- spec/vpsa/api/receipts_spec.rb
|
@@ -109,6 +115,8 @@ files:
|
|
109
115
|
- spec/vpsa/entity/commercial/credit_limit_spec.rb
|
110
116
|
- spec/vpsa/entity/commercial/installment_spec.rb
|
111
117
|
- spec/vpsa/entity/commercial/products_spec.rb
|
118
|
+
- spec/vpsa/entity/operational/category_level_spec.rb
|
119
|
+
- spec/vpsa/entity/operational/product_category_spec.rb
|
112
120
|
- spec/vpsa_spec.rb
|
113
121
|
- vpsa.gemspec
|
114
122
|
homepage: https://github.com/coyosoftware/vpsa
|
@@ -137,6 +145,7 @@ specification_version: 4
|
|
137
145
|
summary: This gem provides integration with VPSA APIs (http://www.vpsa.com.br/)
|
138
146
|
test_files:
|
139
147
|
- spec/spec_helper.rb
|
148
|
+
- spec/vpsa/api/category_levels_spec.rb
|
140
149
|
- spec/vpsa/api/client_classes_spec.rb
|
141
150
|
- spec/vpsa/api/companies_spec.rb
|
142
151
|
- spec/vpsa/api/credit_limits_spec.rb
|
@@ -144,6 +153,7 @@ test_files:
|
|
144
153
|
- spec/vpsa/api/entities_spec.rb
|
145
154
|
- spec/vpsa/api/installments_spec.rb
|
146
155
|
- spec/vpsa/api/orders_spec.rb
|
156
|
+
- spec/vpsa/api/product_categories_spec.rb
|
147
157
|
- spec/vpsa/api/products_spec.rb
|
148
158
|
- spec/vpsa/api/provisions_spec.rb
|
149
159
|
- spec/vpsa/api/receipts_spec.rb
|
@@ -158,4 +168,6 @@ test_files:
|
|
158
168
|
- spec/vpsa/entity/commercial/credit_limit_spec.rb
|
159
169
|
- spec/vpsa/entity/commercial/installment_spec.rb
|
160
170
|
- spec/vpsa/entity/commercial/products_spec.rb
|
171
|
+
- spec/vpsa/entity/operational/category_level_spec.rb
|
172
|
+
- spec/vpsa/entity/operational/product_category_spec.rb
|
161
173
|
- spec/vpsa_spec.rb
|