xsys 0.2.7 → 0.2.8
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/CHANGELOG.md +4 -0
- data/lib/xsys/api.rb +6 -6
- data/lib/xsys/model/price_list.rb +1 -1
- data/lib/xsys/model/product.rb +19 -9
- data/lib/xsys/model/product_category.rb +1 -1
- data/lib/xsys/model/product_price_list.rb +1 -1
- data/lib/xsys/model/product_provider.rb +1 -1
- data/lib/xsys/version.rb +1 -1
- metadata +2 -3
- data/lib/xsys/model/user.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1cde467a27a16527e89a57b0ff8d4c80366c6128
|
|
4
|
+
data.tar.gz: 0788677211a261ecf945b3bd61ec3c277c178536
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db341f31056282d1a739bf57928f69d244598c959a80a4c372ef32ba783647333ce2be4d7710e290c19e63868e8f76aa5f45f97390fddcd0251d07c23ae33988
|
|
7
|
+
data.tar.gz: 3cea83104970aa39cd52730ca35de29ec4efe2e180a28187ed211a237326ca88d3a922c80e620756e578968bd706ea35625b506c940a192bb1a3965058cefedf
|
data/CHANGELOG.md
CHANGED
data/lib/xsys/api.rb
CHANGED
|
@@ -35,8 +35,8 @@ module Xsys
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def self.get_product(
|
|
39
|
-
Model::Product.new(get_request("/api/products/#{
|
|
38
|
+
def self.get_product(product_id)
|
|
39
|
+
Model::Product.new(get_request("/api/products/#{product_id}")[:body])
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def self.get_product_providers(filters={})
|
|
@@ -52,8 +52,8 @@ module Xsys
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def self.get_product_provider(
|
|
56
|
-
Model::ProductProvider.new(get_request("/api/product_providers/#{
|
|
55
|
+
def self.get_product_provider(provider_id)
|
|
56
|
+
Model::ProductProvider.new(get_request("/api/product_providers/#{provider_id}")[:body])
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def self.get_product_categories(filters={})
|
|
@@ -69,8 +69,8 @@ module Xsys
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
def self.get_product_category(
|
|
73
|
-
Model::ProductCategory.new(get_request("/api/product_categories/#{
|
|
72
|
+
def self.get_product_category(category_id)
|
|
73
|
+
Model::ProductCategory.new(get_request("/api/product_categories/#{category_id}")[:body])
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def self.get_product_price_lists(filters={})
|
data/lib/xsys/model/product.rb
CHANGED
|
@@ -2,8 +2,8 @@ module Xsys
|
|
|
2
2
|
module Model
|
|
3
3
|
class Product
|
|
4
4
|
def self.attr_list
|
|
5
|
-
[:
|
|
6
|
-
:
|
|
5
|
+
[:id, :name, :cost_updated_at, :sellable, :product_category_id,
|
|
6
|
+
:product_provider_id, :vat_rate, :taxed_cost, :vat_cost, :total_cost,
|
|
7
7
|
:pending_ordered_quantity, :stocks, :prices, :category, :provider]
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -27,7 +27,17 @@ module Xsys
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def
|
|
30
|
+
def sellable_stocks_quantity
|
|
31
|
+
stocks.find_all { |s|
|
|
32
|
+
!['SER', 'EXT'].include?(s.shop_code)
|
|
33
|
+
}.map(&:quantity).sum
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def service_stocks_quantity
|
|
37
|
+
stocks_quantity - sellable_stocks_quantity
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def stocks_quantity
|
|
31
41
|
stocks.map(&:quantity).sum
|
|
32
42
|
end
|
|
33
43
|
|
|
@@ -45,21 +55,21 @@ module Xsys
|
|
|
45
55
|
}.try(:quantity).to_i
|
|
46
56
|
end
|
|
47
57
|
|
|
48
|
-
def price_date_for_list(
|
|
58
|
+
def price_date_for_list(price_list_id)
|
|
49
59
|
prices.find { |p|
|
|
50
|
-
p.
|
|
60
|
+
p.price_list_id.to_i == price_list_id.to_i
|
|
51
61
|
}.try(:price_updated_at)
|
|
52
62
|
end
|
|
53
63
|
|
|
54
|
-
def markup_with_list(
|
|
64
|
+
def markup_with_list(price_list_id)
|
|
55
65
|
prices.find { |p|
|
|
56
|
-
p.
|
|
66
|
+
p.price_list_id.to_i == price_list_id.to_i
|
|
57
67
|
}.try(:markup) || 0.0
|
|
58
68
|
end
|
|
59
69
|
|
|
60
|
-
def price_in_list(
|
|
70
|
+
def price_in_list(price_list_id)
|
|
61
71
|
prices.find { |p|
|
|
62
|
-
p.
|
|
72
|
+
p.price_list_id.to_i == price_list_id.to_i
|
|
63
73
|
}.try(:total_price) || 0.0
|
|
64
74
|
end
|
|
65
75
|
|
data/lib/xsys/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xsys
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matias Hick
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-05-
|
|
11
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -74,7 +74,6 @@ files:
|
|
|
74
74
|
- lib/xsys/model/seller.rb
|
|
75
75
|
- lib/xsys/model/shop.rb
|
|
76
76
|
- lib/xsys/model/stock.rb
|
|
77
|
-
- lib/xsys/model/user.rb
|
|
78
77
|
- lib/xsys/pagination.rb
|
|
79
78
|
- lib/xsys/version.rb
|
|
80
79
|
homepage: https://github.com/unformattmh/xsys
|
data/lib/xsys/model/user.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Xsys
|
|
2
|
-
module Model
|
|
3
|
-
class User
|
|
4
|
-
def self.attr_list
|
|
5
|
-
[:code, :name, :shop_code]
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
attr_reader *attr_list
|
|
9
|
-
|
|
10
|
-
def initialize(attributes={})
|
|
11
|
-
attributes.each do |k, v|
|
|
12
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
attr_writer *attr_list
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|