storesapp-rb 0.1.2 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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(:api_key, :sub_domain)
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 orders
27
- StoresApp::Resources::Order
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
@@ -0,0 +1,9 @@
1
+ module StoresApp
2
+ module Resources
3
+ class Cart < StoresApp::StoresAppResource
4
+ # def items
5
+ # CartItem.find(:all, :from => "/api/v1/carts/#{self.id}/items.xml")
6
+ # end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module StoresApp
2
+ module Resources
3
+ class CartItem < StoresApp::StoresAppResource
4
+ # def properties
5
+ # CartItemProperty.find(:all, :from => "/api/v1/cart_items/#{self.id}/properties.xml", :params => {:cart_id => self.cart_id})
6
+ # end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module StoresApp
2
+ module Resources
3
+ class CartItemProperty < StoresApp::StoresAppResource
4
+ end
5
+ end
6
+ end
@@ -2,7 +2,8 @@ module StoresApp
2
2
  module Resources
3
3
  class Collection < StoresApp::StoresAppResource
4
4
  # def products
5
- # Product.find(:all, :from => "/api/v1/collections/#{self.id}/products.xml")
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={})
@@ -0,0 +1,9 @@
1
+ module StoresApp
2
+ module Resources
3
+ class Order < StoresApp::StoresAppResource
4
+ # def items
5
+ # OrderItem.find(:all, :from => "/api/v1/orders/#{self.id}/items.xml")
6
+ # end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module StoresApp
2
+ module Resources
3
+ class OrderItem < StoresApp::StoresAppResource
4
+ # def properties
5
+ # OrderItemProperty.find(:all, :from => "/api/v1/order_items/#{self.id}/properties.xml", :params => {:order_id => self.order_id})
6
+ # end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module StoresApp
2
+ module Resources
3
+ class OrderItemProperty < StoresApp::StoresAppResource
4
+ end
5
+ end
6
+ end
@@ -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/products/#{self.id}/collections.xml")
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
@@ -0,0 +1,6 @@
1
+ module StoresApp
2
+ module Resources
3
+ class User < StoresApp::StoresAppResource
4
+ end
5
+ end
6
+ end
data/lib/storesapp.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  module StoresApp
2
- VERSION = "0.1.1"
3
- ApiDomain = "storesapp.com"
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
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "storesapp-rb"
6
- s.version = "0.1.2"
6
+ s.version = "0.1.5"
7
7
  s.authors = ["Next Feature"]
8
8
  s.summary = "A wrapper for the StoresApp Api. See http://api.storesapp.com for details."
9
9
  s.date = Date.today.to_s
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: 31
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
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-24 00:00:00 -04:00
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