storesapp-rb 0.1.9 → 0.2.0
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.
- data/lib/storesapp/resources/cart.rb +1 -1
- data/lib/storesapp/resources/cart_item.rb +2 -2
- data/lib/storesapp/resources/cart_item_property.rb +1 -1
- data/lib/storesapp/resources/collection.rb +2 -2
- data/lib/storesapp/resources/collection_product.rb +2 -2
- data/lib/storesapp/resources/order.rb +1 -1
- data/lib/storesapp/resources/order_item.rb +2 -2
- data/lib/storesapp/resources/order_item_property.rb +1 -1
- data/lib/storesapp/resources/product.rb +5 -5
- data/lib/storesapp/resources/product_image.rb +1 -1
- data/lib/storesapp/resources/product_property.rb +1 -1
- data/lib/storesapp/resources/variant.rb +2 -2
- data/lib/storesapp/resources/variant_property.rb +1 -1
- data/lib/storesapp.rb +1 -1
- data/storesapp.gemspec +1 -1
- metadata +4 -4
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class Cart < StoresApp::StoresAppResource
|
4
4
|
def items
|
5
|
-
CartItem.find(:all, :from => "/
|
5
|
+
CartItem.find(:all, :from => "/v1cart_items.xml", :params => {'search[cart_id]' => self.id})
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,11 +2,11 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class CartItem < StoresApp::StoresAppResource
|
4
4
|
def cart
|
5
|
-
Cart.find(:first, :from => "/
|
5
|
+
Cart.find(:first, :from => "/v1cart_items.xml", :params => {'search[cart_id_equals]' => self.cart_id})
|
6
6
|
end
|
7
7
|
|
8
8
|
def properties
|
9
|
-
CartItemProperty.find(:all, :from => "/
|
9
|
+
CartItemProperty.find(:all, :from => "/v1cart_item_properties.xml", :params => {'search[cart_item_id_equals]' => self.id})
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class CartItemProperty < StoresApp::StoresAppResource
|
4
4
|
def item
|
5
|
-
CartItem.find(:first, :from => "/
|
5
|
+
CartItem.find(:first, :from => "/v1cart_items.xml", :params => {'search[cart_item_id_equals]' => self.cart_item_id})
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class Collection < StoresApp::StoresAppResource
|
4
4
|
def products
|
5
|
-
collection_products = CollectionProduct.find(:all, :from => "/
|
5
|
+
collection_products = CollectionProduct.find(:all, :from => "/v1collection_products.xml?search[collection_id_equals]=#{self.id}")
|
6
6
|
product_ids = collection_products.collect {|cp| cp.product_id}
|
7
7
|
return Product.find(:all).select {|p| product_ids.include?(p.id)}
|
8
8
|
end
|
@@ -16,7 +16,7 @@ module StoresApp
|
|
16
16
|
def remove_product(options={})
|
17
17
|
options.assert_valid_keys(:product_id)
|
18
18
|
options.assert_required_keys(:product_id)
|
19
|
-
CollectionProduct.find(:first, :from => "/
|
19
|
+
CollectionProduct.find(:first, :from => "/v1collection_products.xml?search[collection_id_equals]=#{self.id}&search[product_id_equals]=#{options[:collection_id]}").destroy
|
20
20
|
end
|
21
21
|
|
22
22
|
# def enable
|
@@ -2,11 +2,11 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class CollectionProduct < StoresApp::StoresAppResource
|
4
4
|
def collection
|
5
|
-
return Collection.find(:first, :from => "/
|
5
|
+
return Collection.find(:first, :from => "/v1collections.xml?search[collection_id_equals]=#{self.collection_id}")
|
6
6
|
end
|
7
7
|
|
8
8
|
def products
|
9
|
-
return Product.find(:first, :from => "/
|
9
|
+
return Product.find(:first, :from => "/v1products.xml?search[product_id_equals]=#{self.product_id}")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class Order < StoresApp::StoresAppResource
|
4
4
|
def items
|
5
|
-
OrderItem.find(:all, :from => "/
|
5
|
+
OrderItem.find(:all, :from => "/v1order_items.xml", :params => {'search[order_id]' => self.id})
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,11 +2,11 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class OrderItem < StoresApp::StoresAppResource
|
4
4
|
def order
|
5
|
-
Order.find(:first, :from => "/
|
5
|
+
Order.find(:first, :from => "/v1order_items.xml", :params => {'search[order_id_equals]' => self.order_id})
|
6
6
|
end
|
7
7
|
|
8
8
|
def properties
|
9
|
-
OrderItemProperty.find(:all, :from => "/
|
9
|
+
OrderItemProperty.find(:all, :from => "/v1order_item_properties.xml", :params => {'search[order_item_id_equals]' => self.id})
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class OrderItemProperty < StoresApp::StoresAppResource
|
4
4
|
def item
|
5
|
-
OrderItem.find(:first, :from => "/
|
5
|
+
OrderItem.find(:first, :from => "/v1order_items.xml", :params => {'search[order_item_id_equals]' => self.order_item_id})
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,21 +2,21 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class Product < StoresApp::StoresAppResource
|
4
4
|
def collections
|
5
|
-
collection_products = CollectionProduct.find(:all, :from => "/
|
5
|
+
collection_products = CollectionProduct.find(:all, :from => "/v1collection_products.xml?search[product_id_equals]=#{self.id}")
|
6
6
|
collection_ids = collection_products.collect {|cp| cp.collection_id}
|
7
7
|
return Collection.find(:all).select {|c| collection_ids.include?(c.id)}
|
8
8
|
end
|
9
9
|
|
10
10
|
def images
|
11
|
-
ProductImage.find(:all, :from => "/
|
11
|
+
ProductImage.find(:all, :from => "/v1product_images.xml?search[product_id_equals]=#{self.id}")
|
12
12
|
end
|
13
13
|
|
14
14
|
def properties
|
15
|
-
ProductProperty.find(:all, :from => "/
|
15
|
+
ProductProperty.find(:all, :from => "/v1product_properties.xml?search[product_id_equals]=#{self.id}")
|
16
16
|
end
|
17
17
|
|
18
18
|
def variants
|
19
|
-
Variant.find(:all, :from => "/
|
19
|
+
Variant.find(:all, :from => "/v1variants.xml?search[product_id_equals]=#{self.id}")
|
20
20
|
end
|
21
21
|
|
22
22
|
def add_collection(options={})
|
@@ -28,7 +28,7 @@ module StoresApp
|
|
28
28
|
def remove_collection(options={})
|
29
29
|
options.assert_valid_keys(:collection_id)
|
30
30
|
options.assert_required_keys(:collection_id)
|
31
|
-
CollectionProduct.find(:first, :from => "/
|
31
|
+
CollectionProduct.find(:first, :from => "/v1collection_products.xml?search[product_id_equals]=#{self.id}&search[collection_id_equals]=#{options[:collection_id]}").destroy
|
32
32
|
end
|
33
33
|
|
34
34
|
# def enable
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class ProductImage < StoresApp::StoresAppResource
|
4
4
|
def product
|
5
|
-
Product.find(:first, :from => "/
|
5
|
+
Product.find(:first, :from => "/v1product.xml?search[product_id_equals]=#{self.product_id}")
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class ProductProperty < StoresApp::StoresAppResource
|
4
4
|
def product
|
5
|
-
Product.find(:first, :from => "/
|
5
|
+
Product.find(:first, :from => "/v1product.xml?search[product_id_equals]=#{self.product_id}")
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,11 +2,11 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class Variant < StoresApp::StoresAppResource
|
4
4
|
def product
|
5
|
-
Product.find(:first, :from => "/
|
5
|
+
Product.find(:first, :from => "/v1product.xml?search[product_id_equals]=#{self.product_id}")
|
6
6
|
end
|
7
7
|
|
8
8
|
def properties
|
9
|
-
VariantProperty.find(:all, :from => "/
|
9
|
+
VariantProperty.find(:all, :from => "/v1variant_properties.xml?search[product_variant_id_equals]=#{self.id}")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,7 +2,7 @@ module StoresApp
|
|
2
2
|
module Resources
|
3
3
|
class VariantProperty < StoresApp::StoresAppResource
|
4
4
|
def variant
|
5
|
-
Variant.find(:first, :from => "/
|
5
|
+
Variant.find(:first, :from => "/v1variants.xml?search[variant_id_equals]=#{self.variant_id}")
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/lib/storesapp.rb
CHANGED
data/storesapp.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storesapp-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Next Feature
|