Skip to content

Commit

Permalink
Added cart resource to the api
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis O'Connor committed Feb 13, 2012
1 parent b25e7a3 commit c7a8ca2
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/shopify_api/resources.rb
Expand Up @@ -5,6 +5,7 @@
require 'shopify_api/resources/asset'
require 'shopify_api/resources/billing_address'
require 'shopify_api/resources/blog'
require 'shopify_api/resources/cart'
require 'shopify_api/resources/collect'
require 'shopify_api/resources/comment'
require 'shopify_api/resources/country'
Expand Down
4 changes: 4 additions & 0 deletions lib/shopify_api/resources/cart.rb
@@ -0,0 +1,4 @@
module ShopifyAPI
class Cart < Base
end
end
13 changes: 13 additions & 0 deletions test/cart_test.rb
@@ -0,0 +1,13 @@
require 'test_helper'

class CartTest < Test::Unit::TestCase
test 'all should return all carts' do
fake 'carts'
carts = ShopifyAPI::Cart.all
assert_equal carts.size, 2
assert_equal 2, carts.first.id
assert_equal "3eed8183d4281db6ea82ee2b8f23e9cc", carts.first.token
assert_equal 1, carts.first.line_items.size
assert_equal 'test', carts.first.line_items.first.title
end
end
43 changes: 43 additions & 0 deletions test/fixtures/carts.json
@@ -0,0 +1,43 @@
{
"carts": [
{
"id": 2,
"note": null,
"token": "3eed8183d4281db6ea82ee2b8f23e9cc",
"updated_at": "2012-02-13T14:39:37-05:00",
"line_items":
[
{
"id": 1,
"title": "test",
"price": "1.00",
"line_price": "1.00",
"quantity": 1,
"sku": "",
"grams": 1000,
"vendor": "test",
"variant_id": 1
}
]
},
{
"id": 1,
"note": "",
"token": "49801807939c296be1e9a4bf6783a705",
"updated_at": "2012-02-13T14:39:12-05:00",
"line_items":[
{
"id": 1,
"title": "test",
"price": "1.00",
"line_price": "1.00",
"quantity": 1,
"sku": "",
"grams": 1000,
"vendor": "test",
"variant_id": 1
}
]
}
]
}

0 comments on commit c7a8ca2

Please sign in to comment.