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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb1c26681f76800caf68ea0946caa7b1cf496e95
4
- data.tar.gz: e65d458e8c37fc18ebd04b9ee255b3c12cfb0b05
3
+ metadata.gz: 136a0566424ca5f01edb2651888dc1711aad4264
4
+ data.tar.gz: e8e4272ea7d3313eb75e77405d3fd7ae1bf5e9c0
5
5
  SHA512:
6
- metadata.gz: 38e8654fb3bb74b85c8408bedd04478e11080a63a89f54bc1de8476caa44353b2f5b51a18bc3cf258766fa319884bb413e4525b3211e6688cdc4c6651338a3d0
7
- data.tar.gz: f1fc637538840f14ce31f87f9a53c1914ca935d4f92cca73b6077a7b569a4dc35f587d599ecf6a82e4a01f82a2176b2e9c9e0a8e4e8634d5eabf4455b671ca62
6
+ metadata.gz: c59ba5f12f8f7e664f2daec57bea63b26764a65bd2e0fff0bb1da364e1119683bb3b9fbec016c981dbb32c8bd8b7ab6da6222e071562e3b434090de3d2431e57
7
+ data.tar.gz: a0b6484a1ab24d9e42c2939d81c36868aa9ede3a2efd457638b717dfdc9c51800d328e23db55b335f8138f671eadb08f36d52ca4ad5e0c539fb28340de032f21
data/CHANGELOG.md CHANGED
@@ -209,3 +209,7 @@
209
209
  ## v0.5.2
210
210
 
211
211
  * Added method to update product price list
212
+
213
+ ## v0.6.0
214
+
215
+ * Fixed default api and relative paths
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("/api/background_jobs/#{code}")[:body])
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("/api/background_jobs/#{code}", params)[:body])
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("/api/background_jobs/#{code}/job_events", params)[:body])
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('/api/price_lists')[:body].map { |r| Model::PriceList.new(r) }
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('/api/products', filters)
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('/api/product_ids', filters)
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("/api/products/#{product_id}")[:body]
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('/api/product_providers', filters)
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("/api/product_providers/#{provider_id}")[:body])
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('/api/product_categories', filters)
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("/api/product_categories/#{category_id}")[:body])
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('/api/product_price_lists', filters)
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('/api/sellers')[:body].map { |r| Model::Seller.new(r) }
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('/api/shops')[:body].map { |r| Model::Shop.new(r) }
109
+ get_request('/shops')[:body].map { |r| Model::Shop.new(r) }
110
110
  elsif shop_kinds.include?(kind.to_sym)
111
- get_request("/api/shops/#{kind}")[:body].map { |r| Model::Shop.new(r) }
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('/api/cash_withdrawals', {
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('/api/cash_withdrawal_items', {
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("/api/sales/#{code}")[:body]
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
@@ -1,3 +1,3 @@
1
1
  module Xsys
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick