storesapp-rb 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -1,14 +1,21 @@
1
1
  lib/storesapp/base.rb
2
2
  lib/storesapp/stores_app_resource.rb
3
+ lib/storesapp/resources/cart.rb
4
+ lib/storesapp/resources/cart_item.rb
5
+ lib/storesapp/resources/cart_item_property.rb
3
6
  lib/storesapp/resources/collection.rb
4
7
  lib/storesapp/resources/collection_product.rb
8
+ lib/storesapp/resources/order.rb
9
+ lib/storesapp/resources/order_item.rb
10
+ lib/storesapp/resources/order_item_property.rb
5
11
  lib/storesapp/resources/page.rb
12
+ lib/storesapp/resources/payment.rb
6
13
  lib/storesapp/resources/product.rb
7
14
  lib/storesapp/resources/product_image.rb
8
15
  lib/storesapp/resources/product_property.rb
9
16
  lib/storesapp/resources/user.rb
10
- lib/storesapp/resources/variant_property.rb
11
17
  lib/storesapp/resources/variant.rb
18
+ lib/storesapp/resources/variant_property.rb
12
19
  lib/storesapp.rb
13
20
  LICENSE
14
21
  README.markdown
@@ -19,10 +19,6 @@ module StoresApp
19
19
  StoresApp::Resources::CollectionProduct.find(:all)
20
20
  end
21
21
 
22
- def pages
23
- StoresApp::Resources::Page.find(:all)
24
- end
25
-
26
22
  def products
27
23
  StoresApp::Resources::Product.find(:all)
28
24
  end
@@ -34,11 +30,7 @@ module StoresApp
34
30
  def product_properties
35
31
  StoresApp::Resources::ProductProperty.find(:all)
36
32
  end
37
-
38
- def users
39
- StoresApp::Resources::User.find(:all)
40
- end
41
-
33
+
42
34
  def variants
43
35
  StoresApp::Resources::Variant.find(:all)
44
36
  end
@@ -47,6 +39,22 @@ module StoresApp
47
39
  StoresApp::Resources::VariantProperty.find(:all)
48
40
  end
49
41
 
42
+ def pages
43
+ StoresApp::Resources::Page.find(:all)
44
+ end
45
+
46
+ def users
47
+ StoresApp::Resources::User.find(:all)
48
+ end
49
+
50
+ def carts
51
+ StoresApp::Resources::Cart.find(:all)
52
+ end
53
+
54
+ def orders
55
+ StoresApp::Resources::Order.find(:all)
56
+ end
57
+
50
58
  private
51
59
  # Configure resource base class so that
52
60
  # inherited classes can access the api.
@@ -1,9 +1,9 @@
1
1
  module StoresApp
2
2
  module Resources
3
3
  class Cart < StoresApp::StoresAppResource
4
- # def items
5
- # CartItem.find(:all, :from => "/api/v1/carts/#{self.id}/items.xml")
6
- # end
4
+ def items
5
+ CartItem.find(:all, :from => "/api/v1/cart_items.xml", :params => {'search[cart_id]' => self.id})
6
+ end
7
7
  end
8
8
  end
9
9
  end
@@ -1,9 +1,13 @@
1
1
  module StoresApp
2
2
  module Resources
3
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
4
+ def cart
5
+ Cart.find(:first, :from => "/api/v1/cart_items.xml", :params => {'search[cart_id_equals]' => self.cart_id})
6
+ end
7
+
8
+ def properties
9
+ CartItemProperty.find(:all, :from => "/api/v1/cart_item_properties.xml", :params => {'search[cart_item_id_equals]' => self.id})
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -1,6 +1,9 @@
1
1
  module StoresApp
2
2
  module Resources
3
3
  class CartItemProperty < StoresApp::StoresAppResource
4
+ def item
5
+ CartItem.find(:first, :from => "/api/v1/cart_items.xml", :params => {'search[cart_item_id_equals]' => self.cart_item_id})
6
+ end
4
7
  end
5
8
  end
6
9
  end
@@ -1,9 +1,13 @@
1
1
  module StoresApp
2
2
  module Resources
3
3
  class Order < StoresApp::StoresAppResource
4
- # def items
5
- # OrderItem.find(:all, :from => "/api/v1/orders/#{self.id}/items.xml")
6
- # end
4
+ def items
5
+ OrderItem.find(:all, :from => "/api/v1/order_items.xml", :params => {'search[order_id]' => self.id})
6
+ end
7
+
8
+ def payment
9
+ Payment.find(:first, :from => "/api/v1/payments.xml", :params => {'search[order_id]' => self.id})
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -1,9 +1,13 @@
1
1
  module StoresApp
2
2
  module Resources
3
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
4
+ def order
5
+ Order.find(:first, :from => "/api/v1/order_items.xml", :params => {'search[order_id_equals]' => self.order_id})
6
+ end
7
+
8
+ def properties
9
+ OrderItemProperty.find(:all, :from => "/api/v1/order_item_properties.xml", :params => {'search[order_item_id_equals]' => self.id})
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -1,6 +1,9 @@
1
1
  module StoresApp
2
2
  module Resources
3
3
  class OrderItemProperty < StoresApp::StoresAppResource
4
+ def item
5
+ OrderItem.find(:first, :from => "/api/v1/order_items.xml", :params => {'search[order_item_id_equals]' => self.order_item_id})
6
+ end
4
7
  end
5
8
  end
6
9
  end
@@ -0,0 +1,9 @@
1
+ module StoresApp
2
+ module Resources
3
+ class Payment < StoresApp::StoresAppResource
4
+ def order
5
+ Order.find(:first, :from => "/api/v1/orders.xml", :params => {'search[id]' => self.order_id})
6
+ end
7
+ end
8
+ end
9
+ end
data/lib/storesapp.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module StoresApp
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  ApiDomain = 'storesapp.com'
4
4
  DevelopmentApiDomain = 'storesapp-com.local'
5
5
 
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.6"
6
+ s.version = "0.1.7"
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
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-29 00:00:00 -04:00
18
+ date: 2010-08-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -77,6 +77,7 @@ files:
77
77
  - lib/storesapp/resources/order_item.rb
78
78
  - lib/storesapp/resources/order_item_property.rb
79
79
  - lib/storesapp/resources/page.rb
80
+ - lib/storesapp/resources/payment.rb
80
81
  - lib/storesapp/resources/product.rb
81
82
  - lib/storesapp/resources/product_image.rb
82
83
  - lib/storesapp/resources/product_property.rb