storesapp-rb 0.1.2 → 0.1.5
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/Manifest.txt +1 -0
- data/lib/storesapp/base.rb +26 -4
- data/lib/storesapp/resources/cart.rb +9 -0
- data/lib/storesapp/resources/cart_item.rb +9 -0
- data/lib/storesapp/resources/cart_item_property.rb +6 -0
- data/lib/storesapp/resources/collection.rb +2 -1
- data/lib/storesapp/resources/order.rb +9 -0
- data/lib/storesapp/resources/order_item.rb +9 -0
- data/lib/storesapp/resources/order_item_property.rb +6 -0
- data/lib/storesapp/resources/product.rb +4 -4
- data/lib/storesapp/resources/user.rb +6 -0
- data/lib/storesapp.rb +3 -2
- data/storesapp.gemspec +1 -1
- metadata +11 -4
data/Manifest.txt
CHANGED
|
@@ -6,6 +6,7 @@ lib/storesapp/resources/page.rb
|
|
|
6
6
|
lib/storesapp/resources/product.rb
|
|
7
7
|
lib/storesapp/resources/product_image.rb
|
|
8
8
|
lib/storesapp/resources/product_property.rb
|
|
9
|
+
lib/storesapp/resources/user.rb
|
|
9
10
|
lib/storesapp/resources/variant_property.rb
|
|
10
11
|
lib/storesapp/resources/variant.rb
|
|
11
12
|
lib/storesapp.rb
|
data/lib/storesapp/base.rb
CHANGED
|
@@ -4,7 +4,7 @@ module StoresApp
|
|
|
4
4
|
# Specifying headers is optional, but useful for setting a user agent.
|
|
5
5
|
def initialize(options={})
|
|
6
6
|
options.assert_valid_keys(:api_key, :sub_domain, :headers)
|
|
7
|
-
options.assert_required_keys(:
|
|
7
|
+
options.assert_required_keys(:sub_domain)
|
|
8
8
|
@api_key = options[:api_key]
|
|
9
9
|
@sub_domain = options[:sub_domain]
|
|
10
10
|
@headers = options[:headers]
|
|
@@ -15,6 +15,10 @@ module StoresApp
|
|
|
15
15
|
StoresApp::Resources::Collection
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def collection_products
|
|
19
|
+
StoresApp::Resources::CollectionProduct
|
|
20
|
+
end
|
|
21
|
+
|
|
18
22
|
def pages
|
|
19
23
|
StoresApp::Resources::Page
|
|
20
24
|
end
|
|
@@ -23,18 +27,36 @@ module StoresApp
|
|
|
23
27
|
StoresApp::Resources::Product
|
|
24
28
|
end
|
|
25
29
|
|
|
26
|
-
def
|
|
27
|
-
StoresApp::Resources::
|
|
30
|
+
def product_images
|
|
31
|
+
StoresApp::Resources::ProductImage
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def product_properties
|
|
35
|
+
StoresApp::Resources::ProductProperty
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def users
|
|
39
|
+
StoresApp::Resources::User
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def variants
|
|
43
|
+
StoresApp::Resources::Variant
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def variant_properties
|
|
47
|
+
StoresApp::Resources::VariantProperty
|
|
28
48
|
end
|
|
29
49
|
|
|
30
50
|
private
|
|
31
51
|
# Configure resource base class so that
|
|
32
52
|
# inherited classes can access the api.
|
|
33
53
|
def configure_base_resource
|
|
34
|
-
StoresAppResource.site = "http://#{@sub_domain}.#{StoresApp::ApiDomain}/api/v1"
|
|
35
54
|
if @api_key
|
|
55
|
+
StoresAppResource.site = "http://#{@sub_domain}.#{StoresApp::ApiDomain}/api/v1"
|
|
36
56
|
StoresAppResource.user = @api_key
|
|
37
57
|
StoresAppResource.password = 'x'
|
|
58
|
+
else
|
|
59
|
+
StoresAppResource.site = "http://#{@sub_domain}.#{StoresApp::DevelopmentApiDomain}/api/v1"
|
|
38
60
|
end
|
|
39
61
|
StoresAppResource.headers.update(@headers) if @headers.is_a?(Hash)
|
|
40
62
|
load_resources
|
|
@@ -2,7 +2,8 @@ module StoresApp
|
|
|
2
2
|
module Resources
|
|
3
3
|
class Collection < StoresApp::StoresAppResource
|
|
4
4
|
# def products
|
|
5
|
-
#
|
|
5
|
+
# CollectionProduct.find(:all, :from => "/api/v1/collection_products.xml?search[product_id]=#{self.id}")
|
|
6
|
+
# Product.find(:all, :from => "/api/v1/products.xml?search[collection_id_equals]=#{self.id}")
|
|
6
7
|
# end
|
|
7
8
|
|
|
8
9
|
# def add_product(options={})
|
|
@@ -2,17 +2,17 @@ module StoresApp
|
|
|
2
2
|
module Resources
|
|
3
3
|
class Product < StoresApp::StoresAppResource
|
|
4
4
|
# def collections
|
|
5
|
-
# Collection.find(:all, :from => "/api/v1/
|
|
5
|
+
# Collection.find(:all, :from => "/api/v1/collections.xml?search[product_id_equals]=#{self.id}")
|
|
6
6
|
# end
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# def images
|
|
9
9
|
# ProductImage.find(:all, :from => "/api/v1/products/#{self.id}/images.xml")
|
|
10
10
|
# end
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
# def properties
|
|
13
13
|
# ProductProperty.find(:all, :from => "/api/v1/products/#{self.id}/properties.xml")
|
|
14
14
|
# end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
# def variants
|
|
17
17
|
# ProductVariant.find(:all, :from => "/api/v1/products/#{self.id}/variants.xml")
|
|
18
18
|
# end
|
data/lib/storesapp.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module StoresApp
|
|
2
|
-
VERSION
|
|
3
|
-
ApiDomain
|
|
2
|
+
VERSION = '0.1.5'
|
|
3
|
+
ApiDomain = 'storesapp.com'
|
|
4
|
+
DevelopmentApiDomain = 'storesapp-com.local'
|
|
4
5
|
|
|
5
6
|
# Class method to load all ruby files from a given path.
|
|
6
7
|
def self.load_all_ruby_files_from_path(path)
|
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: 17
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 0.1.
|
|
9
|
+
- 5
|
|
10
|
+
version: 0.1.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Next Feature
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-07-
|
|
18
|
+
date: 2010-07-25 00:00:00 -04:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -68,12 +68,19 @@ files:
|
|
|
68
68
|
- lib/storesapp/base.rb
|
|
69
69
|
- lib/storesapp/plugins/active_resource_inheritable_headers.rb
|
|
70
70
|
- lib/storesapp/plugins/hash_ext.rb
|
|
71
|
+
- lib/storesapp/resources/cart.rb
|
|
72
|
+
- lib/storesapp/resources/cart_item.rb
|
|
73
|
+
- lib/storesapp/resources/cart_item_property.rb
|
|
71
74
|
- lib/storesapp/resources/collection.rb
|
|
72
75
|
- lib/storesapp/resources/collection_product.rb
|
|
76
|
+
- lib/storesapp/resources/order.rb
|
|
77
|
+
- lib/storesapp/resources/order_item.rb
|
|
78
|
+
- lib/storesapp/resources/order_item_property.rb
|
|
73
79
|
- lib/storesapp/resources/page.rb
|
|
74
80
|
- lib/storesapp/resources/product.rb
|
|
75
81
|
- lib/storesapp/resources/product_image.rb
|
|
76
82
|
- lib/storesapp/resources/product_property.rb
|
|
83
|
+
- lib/storesapp/resources/user.rb
|
|
77
84
|
- lib/storesapp/resources/variant.rb
|
|
78
85
|
- lib/storesapp/resources/variant_property.rb
|
|
79
86
|
- lib/storesapp/stores_app_resource.rb
|