xsys 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1128f66cb7ed55f5d26677e8f7ce9e7a18c514fc
4
- data.tar.gz: 5fa0b025e8ae3a856d01531759597afcc49f03d3
3
+ metadata.gz: e8c0eaa3c9d7a5cd0b06ce49c1a8fe1f7c4d9cec
4
+ data.tar.gz: 5186d207fc4420490d482d7e885ee6cc93863ce7
5
5
  SHA512:
6
- metadata.gz: b99c4c71bd2b4a045154a4c29aa8a12509c704f97afb4c5c8f30feceab0d936da984e7b5ddcdc7b6487d5b328d836423eea3b8b52e1b3591c96bc18ef600a219
7
- data.tar.gz: be2b19a8a869426d6ba3b8179c75184e29554d97500fab27c461277e2f5e9ec82e0e9527658285e909b89038ca6361876529ec344388b57ac947b441765a7d03
6
+ metadata.gz: d24c4a4896a06f29caa5a4bca1cccf9cdcd90d95cb9430e7a0d35e0bcc8172e3ee0221630d72e6d021c9a88a00a920b91f9f74cd2d06a1d82709a00f70715aa6
7
+ data.tar.gz: a49c57b1702323cb296b52b57c40adb3f56c93d6e874c9990a65eb03c02e9cf7684ddba98f9d4da8b6b626f3039da2494bbf11820d71965c9cded23c2eda8cd8
data/CHANGELOG.md CHANGED
@@ -20,4 +20,8 @@
20
20
 
21
21
  ## v0.0.6
22
22
 
23
- * Api class turned into singleton class
23
+ * Bugfixes
24
+
25
+ ## v0.0.7
26
+
27
+ * All api methods are static
data/lib/xsys/api.rb CHANGED
@@ -1,68 +1,64 @@
1
1
  module Xsys
2
2
  class Api
3
- include Singleton
4
-
5
- attr_accessor :endpoint, :access_token
6
-
7
3
  def self.configure(args={})
8
- instance.endpoint = (args[:endpoint] || 'https://xsys.lhconfort.com.ar')
9
- instance.access_token = args[:access_token]
4
+ @endpoint = (args[:endpoint] || 'https://xsys.lhconfort.com.ar')
5
+ @access_token = args[:access_token]
10
6
  end
11
7
 
12
- def get_price_lists(filters={})
8
+ def self.get_price_lists(filters={})
13
9
  get_request('/price_lists').map { |r| Model::PriceList.new(r) }
14
10
  end
15
11
 
16
- def get_provider_kinds(filters={})
12
+ def self.get_provider_kinds(filters={})
17
13
  request = get_request('/provider_kinds', filters)
18
14
  request[:results] = request[:results].map { |r| Model::ProviderKind.new(r) }
19
15
  request
20
16
  end
21
17
 
22
- def get_provider_kind(id)
18
+ def self.get_provider_kind(id)
23
19
  Model::ProviderKind.new(get_request("/provider_kinds/#{id}"))
24
20
  end
25
21
 
26
- def get_product_providers(filters={})
22
+ def self.get_product_providers(filters={})
27
23
  request = get_request('/product_providers', filters)
28
24
  request[:results] = request[:results].map { |r| Model::ProductProvider.new(r) }
29
25
  request
30
26
  end
31
27
 
32
- def get_product_provider(id)
28
+ def self.get_product_provider(id)
33
29
  Model::ProductProvider.new(get_request("/product_providers/#{id}"))
34
30
  end
35
31
 
36
- def get_product_categories(filters={})
32
+ def self.get_product_categories(filters={})
37
33
  request = get_request('/product_categories', filters)
38
34
  request[:results] = request[:results].map { |r| Model::ProductCategory.new(r) }
39
35
  request
40
36
  end
41
37
 
42
- def get_product_category(id)
38
+ def self.get_product_category(id)
43
39
  Model::ProductCategory.new(get_request("/product_categories/#{id}"))
44
40
  end
45
41
 
46
- def get_products(filters={})
42
+ def self.get_products(filters={})
47
43
  request = get_request('/products', filters)
48
44
  request[:results] = request[:results].map { |r| Model::Product.new(r) }
49
45
  request
50
46
  end
51
47
 
52
- def get_product(id)
48
+ def self.get_product(id)
53
49
  Model::Product.new(get_request("/products/#{id}"))
54
50
  end
55
51
 
56
- def get_shops(kind=nil)
52
+ def self.get_shops(kind=nil)
57
53
  shops_url = (kind.nil? ? '/shops' : "/shops/#{kind}")
58
54
  get_request(shops_url).map { |r| Model::Shop.new(r) }
59
55
  end
60
56
 
61
- def get_sellers
57
+ def self.get_sellers
62
58
  get_request('/sellers').map { |r| Model::Seller.new(r) }
63
59
  end
64
60
 
65
- def get_sales_period(period, from, to, shop_code=nil)
61
+ def self.get_sales_period(period, from, to, shop_code=nil)
66
62
  get_request("/sales_periods/#{period}", {
67
63
  date_from: from,
68
64
  date_to: to,
@@ -70,25 +66,25 @@ module Xsys
70
66
  }).map { |r| Model::SalesPeriod.new(r) }
71
67
  end
72
68
 
73
- def get_purchase_order_items(filters={})
69
+ def self.get_purchase_order_items(filters={})
74
70
  request = get_request('/purchase_order_items', filters)
75
71
  request[:results] = request[:results].map { |r| Model::PurchaseOrderItem.new(r) }
76
72
  request
77
73
  end
78
74
 
79
- def get_grouped_purchase_order_items(filters={})
75
+ def self.get_grouped_purchase_order_items(filters={})
80
76
  request = get_request('/purchase_order_items/grouped', filters)
81
77
  request[:results] = request[:results].map { |r| Model::GroupedPurchaseOrderItem.new(r) }
82
78
  request
83
79
  end
84
80
 
85
- def get_sale_items(filters={})
81
+ def self.get_sale_items(filters={})
86
82
  request = get_request('/sale_items', filters)
87
83
  request[:results] = request[:results].map { |r| Model::SaleItem.new(r) }
88
84
  request
89
85
  end
90
86
 
91
- def get_grouped_sale_items(filters={})
87
+ def self.get_grouped_sale_items(filters={})
92
88
  request = get_request('/sale_items/grouped', filters)
93
89
  request[:results] = request[:results].map { |r| Model::GroupedSaleItem.new(r) }
94
90
  request
@@ -96,7 +92,7 @@ module Xsys
96
92
 
97
93
  private
98
94
 
99
- def get_request(action, params={})
95
+ def self.get_request(action, params={})
100
96
  response = ::RestClient.get("#{@endpoint}#{action}", {params: params}.merge({
101
97
  authorization: "Token token=\"#{@access_token}\""
102
98
  }))
data/lib/xsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-18 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler