xsys 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/xsys/api.rb +19 -19
- data/lib/xsys/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 136a0566424ca5f01edb2651888dc1711aad4264
|
4
|
+
data.tar.gz: e8e4272ea7d3313eb75e77405d3fd7ae1bf5e9c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c59ba5f12f8f7e664f2daec57bea63b26764a65bd2e0fff0bb1da364e1119683bb3b9fbec016c981dbb32c8bd8b7ab6da6222e071562e3b434090de3d2431e57
|
7
|
+
data.tar.gz: a0b6484a1ab24d9e42c2939d81c36868aa9ede3a2efd457638b717dfdc9c51800d328e23db55b335f8138f671eadb08f36d52ca4ad5e0c539fb28340de032f21
|
data/CHANGELOG.md
CHANGED
data/lib/xsys/api.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
module Xsys
|
2
2
|
class Api
|
3
3
|
def self.configure(args={})
|
4
|
-
@endpoint = (args[:endpoint] || 'https://gestion.lhconfort.com.ar')
|
4
|
+
@endpoint = (args[:endpoint] || 'https://gestion.lhconfort.com.ar/api')
|
5
5
|
@access_token = args[:access_token]
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.get_background_job(code)
|
9
|
-
Model::BackgroundJob.new(get_request("/
|
9
|
+
Model::BackgroundJob.new(get_request("/background_jobs/#{code}")[:body])
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.update_background_job(code, params)
|
13
|
-
Model::BackgroundJob.new(put_request("/
|
13
|
+
Model::BackgroundJob.new(put_request("/background_jobs/#{code}", params)[:body])
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.add_background_job_event(code, event_description)
|
17
17
|
params = { description: event_description }
|
18
|
-
Model::JobEvent.new(post_request("/
|
18
|
+
Model::JobEvent.new(post_request("/background_jobs/#{code}/job_events", params)[:body])
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.get_price_lists(filters={})
|
22
|
-
get_request('/
|
22
|
+
get_request('/price_lists')[:body].map { |r| Model::PriceList.new(r) }
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.search_products(filters={})
|
26
|
-
response = get_request('/
|
26
|
+
response = get_request('/products', filters)
|
27
27
|
|
28
28
|
if response[:headers][:link]
|
29
29
|
{
|
@@ -36,13 +36,13 @@ module Xsys
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.search_product_ids(filters={})
|
39
|
-
response = get_request('/
|
39
|
+
response = get_request('/product_ids', filters)
|
40
40
|
|
41
41
|
response[:body]['product_ids']
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.get_product(product_id)
|
45
|
-
response_body = get_request("/
|
45
|
+
response_body = get_request("/products/#{product_id}")[:body]
|
46
46
|
|
47
47
|
if response_body == 'null'
|
48
48
|
nil
|
@@ -52,7 +52,7 @@ module Xsys
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.get_product_providers(filters={})
|
55
|
-
response = get_request('/
|
55
|
+
response = get_request('/product_providers', filters)
|
56
56
|
|
57
57
|
if response[:headers][:link]
|
58
58
|
{
|
@@ -65,11 +65,11 @@ module Xsys
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def self.get_product_provider(provider_id)
|
68
|
-
Model::ProductProvider.new(get_request("/
|
68
|
+
Model::ProductProvider.new(get_request("/product_providers/#{provider_id}")[:body])
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.get_product_categories(filters={})
|
72
|
-
response = get_request('/
|
72
|
+
response = get_request('/product_categories', filters)
|
73
73
|
|
74
74
|
if response[:headers][:link]
|
75
75
|
{
|
@@ -82,11 +82,11 @@ module Xsys
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def self.get_product_category(category_id)
|
85
|
-
Model::ProductCategory.new(get_request("/
|
85
|
+
Model::ProductCategory.new(get_request("/product_categories/#{category_id}")[:body])
|
86
86
|
end
|
87
87
|
|
88
88
|
def self.get_product_price_lists(filters={})
|
89
|
-
response = get_request('/
|
89
|
+
response = get_request('/product_price_lists', filters)
|
90
90
|
|
91
91
|
if response[:headers][:link]
|
92
92
|
{
|
@@ -99,37 +99,37 @@ module Xsys
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def self.get_sellers
|
102
|
-
get_request('/
|
102
|
+
get_request('/sellers')[:body].map { |r| Model::Seller.new(r) }
|
103
103
|
end
|
104
104
|
|
105
105
|
def self.get_shops(kind=nil)
|
106
106
|
shop_kinds = [:commercial, :virtual, :physical, :stockable, :service, :with_target]
|
107
107
|
|
108
108
|
if kind.nil?
|
109
|
-
get_request('/
|
109
|
+
get_request('/shops')[:body].map { |r| Model::Shop.new(r) }
|
110
110
|
elsif shop_kinds.include?(kind.to_sym)
|
111
|
-
get_request("/
|
111
|
+
get_request("/shops/#{kind}")[:body].map { |r| Model::Shop.new(r) }
|
112
112
|
else
|
113
113
|
[]
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
def self.update_cash_withdrawals(shop_code, cash_withdrawals)
|
118
|
-
post_request('/
|
118
|
+
post_request('/cash_withdrawals', {
|
119
119
|
shop_code: shop_code,
|
120
120
|
cash_withdrawals: cash_withdrawals
|
121
121
|
})[:body]
|
122
122
|
end
|
123
123
|
|
124
124
|
def self.update_cash_withdrawal_items(shop_code, cash_withdrawal_items)
|
125
|
-
post_request('/
|
125
|
+
post_request('/cash_withdrawal_items', {
|
126
126
|
shop_code: shop_code,
|
127
127
|
cash_withdrawal_items: cash_withdrawal_items
|
128
128
|
})[:body]
|
129
129
|
end
|
130
130
|
|
131
131
|
def self.get_sale(code)
|
132
|
-
response_body = get_request("/
|
132
|
+
response_body = get_request("/sales/#{code}")[:body]
|
133
133
|
|
134
134
|
if response_body == 'null'
|
135
135
|
nil
|
data/lib/xsys/version.rb
CHANGED