zaui_zapi 0.1.14 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/version.rb +1 -1
  3. data/lib/zapi_xml.rb +9 -4
  4. data/lib/zaui.rb +31 -0
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85e12c0ad6c84cabea654f5a3748fdc994547bd5
4
- data.tar.gz: 12e3f4144c321ce5efa0ae1dc1042156cb16be66
3
+ metadata.gz: e1c55e97c9b82124a4a1896e1202ecd3eaaa2909
4
+ data.tar.gz: 0baa0021e9a0fc6355e642ab39862ed871ea03c6
5
5
  SHA512:
6
- metadata.gz: a1d7115c1acc9086dee1efa076f793438955b202fa78ad273c0c913beaabb3694aae74a94915f9670a4ed963ed4c2d66407e246b7d89932ee33605de93d91e4c
7
- data.tar.gz: 54653e26aa61bedc0d918abe126edc12670ab991f0d9a7f52aa65ae871b0fd9ad2464eeeb94649e5b11a006d7ea96e4c4400756fd3050341e4b835847850a62f
6
+ metadata.gz: 6b8331dc6fa6cdb14cf3dc15ac2a276f4fc7f339588b4fd13f771a3ece0078e7653059c237303ea88113112bd7eaabae190b907815e85e34d61c0d1287951ddf
7
+ data.tar.gz: 773c3e3d4903bfd70b9900e04d741a9114e1217e07c7a873a4a6a4ad86d667fe4a80d6917c4045facc4f661baeaf01c7a86cd6c88fb789d8c2a7035c825bf0a1
data/lib/version.rb CHANGED
@@ -1 +1 @@
1
- VERSION = '0.1.14'
1
+ VERSION = '0.2.1'
data/lib/zapi_xml.rb CHANGED
@@ -20,6 +20,12 @@ class ZapiXML
20
20
  )
21
21
  end
22
22
 
23
+ def get_activity_and_product_catalog
24
+ _wrap_xml_request({
25
+ "methodName" => 'zapiGetActivityAndProductCatalog'
26
+ })
27
+ end
28
+
23
29
  def get_package_categories
24
30
  _wrap_xml_request({
25
31
  "methodName" => 'zapiGetPackageCategories'
@@ -125,7 +131,7 @@ class ZapiXML
125
131
 
126
132
  def remove_product_cart_item product_id:
127
133
  _wrap_xml_request({
128
- "methodName" => 'zapiAddRemoveProductCartItem',
134
+ "methodName" => 'zapiRemoveProductCartItem',
129
135
  "cartId" => session.cart_id,
130
136
  "productId" => product_id
131
137
  })
@@ -218,10 +224,10 @@ class ZapiXML
218
224
  _wrap_xml_request(hash)
219
225
  end
220
226
 
221
- def get_product_details_by_product_id product_id:
227
+ def get_product_details_by_product_id id
222
228
  _wrap_xml_request({
223
229
  "methodName" => 'zapiGetProductDetailsByProductId',
224
- "productId" => product_id
230
+ "productId" => id
225
231
  })
226
232
  end
227
233
 
@@ -331,7 +337,6 @@ class ZapiXML
331
337
  })
332
338
  end
333
339
 
334
-
335
340
  def _wrap_xml_request method, params = {}
336
341
  if session
337
342
  request = params.merge({
data/lib/zaui.rb CHANGED
@@ -8,6 +8,26 @@ class Zaui
8
8
  @responder = responder || ZapiObject
9
9
  end
10
10
 
11
+ def get_products
12
+ raw = _zapi(xml.get_activity_and_product_catalog).try(:[],'products').try(:[],'product')
13
+ end
14
+
15
+ def get_merchandise_categories
16
+ raw = _zapi(xml.get_merchandise_categories).try(:[],'categories').try(:[],'category')
17
+ end
18
+
19
+ def get_merchandise_by_category_id id
20
+ raw = _zapi(xml.get_merchandise_by_category_id(id)).try(:[],'products').try(:[],'product')
21
+ end
22
+
23
+ def add_product_to_cart product_id:, quantity:
24
+ raw = _zapi(xml.add_product_to_cart(product_id: product_id, quantity: quantity))
25
+ end
26
+
27
+ def get_product_details_by_product_id id
28
+ raw = _zapi(xml.get_product_details_by_product_id(id)).try(:[],'product')
29
+ end
30
+
11
31
  def get_activity_categories
12
32
  raw = _zapi(xml.get_activity_categories).try(:[],'categories').try(:[],'category')
13
33
  end
@@ -36,12 +56,23 @@ class Zaui
36
56
  raw = _zapi(xml.remove_activity_cart_item(activity_id: id, date: date))
37
57
  end
38
58
 
59
+ def remove_product_cart_item id:
60
+ raw = _zapi(xml.remove_product_cart_item(product_id: id))
61
+ end
62
+
63
+ def check_product_inventory product_id:, quantity:
64
+ raw = _zapi(xml.check_product_inventory(product_id: product_id, quantity: quantity))
65
+ end
66
+
39
67
  def get_cart_contents
40
68
  raw = _zapi(xml.get_cart_contents)
41
69
  activities = raw.try(:[],'cart').try(:[],'activities').try(:[],'activity')
42
70
  activities = activities.is_a?(Array) ? activities : [activities]
71
+ products = raw.try(:[],'cart').try(:[],'products').try(:[],'product')
72
+ products = products.is_a?(Array) ? products : [products]
43
73
  {
44
74
  :activities => activities,
75
+ :products => products,
45
76
  :total => raw['cart']['remainingBalance']['balance']
46
77
  }
47
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaui_zapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Kretzmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-29 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest