shopify-mock-new 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +1 -0
  5. data/CHANGELOG.md +4 -0
  6. data/Gemfile +4 -0
  7. data/README.rdoc +121 -0
  8. data/Rakefile +10 -0
  9. data/lib/shopify-mock.rb +136 -0
  10. data/lib/shopify-mock/errors.rb +6 -0
  11. data/lib/shopify-mock/fixture.rb +124 -0
  12. data/lib/shopify-mock/fixtures/json/application_charges.json +13 -0
  13. data/lib/shopify-mock/fixtures/json/articles.json +30 -0
  14. data/lib/shopify-mock/fixtures/json/assets.json +136 -0
  15. data/lib/shopify-mock/fixtures/json/blogs.json +15 -0
  16. data/lib/shopify-mock/fixtures/json/collect.json +11 -0
  17. data/lib/shopify-mock/fixtures/json/comments.json +19 -0
  18. data/lib/shopify-mock/fixtures/json/count.json +3 -0
  19. data/lib/shopify-mock/fixtures/json/countries.json +16 -0
  20. data/lib/shopify-mock/fixtures/json/custom_collections.json +14 -0
  21. data/lib/shopify-mock/fixtures/json/customer_groups.json +25 -0
  22. data/lib/shopify-mock/fixtures/json/customers.json +32 -0
  23. data/lib/shopify-mock/fixtures/json/events.json +13 -0
  24. data/lib/shopify-mock/fixtures/json/fulfillments.json +35 -0
  25. data/lib/shopify-mock/fixtures/json/images.json +12 -0
  26. data/lib/shopify-mock/fixtures/json/metafields.json +14 -0
  27. data/lib/shopify-mock/fixtures/json/orders.json +141 -0
  28. data/lib/shopify-mock/fixtures/json/pages.json +16 -0
  29. data/lib/shopify-mock/fixtures/json/product_search_engines.json +8 -0
  30. data/lib/shopify-mock/fixtures/json/products.json +114 -0
  31. data/lib/shopify-mock/fixtures/json/provinces.json +100 -0
  32. data/lib/shopify-mock/fixtures/json/recurring_application_charges.json +18 -0
  33. data/lib/shopify-mock/fixtures/json/redirects.json +19 -0
  34. data/lib/shopify-mock/fixtures/json/script_tags.json +11 -0
  35. data/lib/shopify-mock/fixtures/json/shop.json +26 -0
  36. data/lib/shopify-mock/fixtures/json/smart_collections.json +21 -0
  37. data/lib/shopify-mock/fixtures/json/themes.json +25 -0
  38. data/lib/shopify-mock/fixtures/json/transactions.json +13 -0
  39. data/lib/shopify-mock/fixtures/json/variant.json +23 -0
  40. data/lib/shopify-mock/fixtures/json/variants.json +88 -0
  41. data/lib/shopify-mock/fixtures/json/webhooks.json +12 -0
  42. data/lib/shopify-mock/fixtures/xml/application_charges.xml +12 -0
  43. data/lib/shopify-mock/fixtures/xml/articles.xml +29 -0
  44. data/lib/shopify-mock/fixtures/xml/assets.xml +135 -0
  45. data/lib/shopify-mock/fixtures/xml/blogs.xml +14 -0
  46. data/lib/shopify-mock/fixtures/xml/collect.xml +10 -0
  47. data/lib/shopify-mock/fixtures/xml/comments.xml +18 -0
  48. data/lib/shopify-mock/fixtures/xml/count.xml +2 -0
  49. data/lib/shopify-mock/fixtures/xml/countries.xml +15 -0
  50. data/lib/shopify-mock/fixtures/xml/custom_collections.xml +13 -0
  51. data/lib/shopify-mock/fixtures/xml/customer_groups.xml +24 -0
  52. data/lib/shopify-mock/fixtures/xml/customers.xml +31 -0
  53. data/lib/shopify-mock/fixtures/xml/events.xml +12 -0
  54. data/lib/shopify-mock/fixtures/xml/fulfillments.xml +34 -0
  55. data/lib/shopify-mock/fixtures/xml/images.xml +11 -0
  56. data/lib/shopify-mock/fixtures/xml/metafields.xml +13 -0
  57. data/lib/shopify-mock/fixtures/xml/orders.xml +140 -0
  58. data/lib/shopify-mock/fixtures/xml/pages.xml +15 -0
  59. data/lib/shopify-mock/fixtures/xml/product_search_engines.xml +7 -0
  60. data/lib/shopify-mock/fixtures/xml/products.xml +113 -0
  61. data/lib/shopify-mock/fixtures/xml/provinces.xml +99 -0
  62. data/lib/shopify-mock/fixtures/xml/recurring_application_charges.xml +17 -0
  63. data/lib/shopify-mock/fixtures/xml/redirects.xml +18 -0
  64. data/lib/shopify-mock/fixtures/xml/script_tags.xml +10 -0
  65. data/lib/shopify-mock/fixtures/xml/shop.xml +25 -0
  66. data/lib/shopify-mock/fixtures/xml/smart_collections.xml +20 -0
  67. data/lib/shopify-mock/fixtures/xml/themes.xml +24 -0
  68. data/lib/shopify-mock/fixtures/xml/transactions.xml +14 -0
  69. data/lib/shopify-mock/fixtures/xml/webhooks.xml +11 -0
  70. data/lib/shopify-mock/response.rb +45 -0
  71. data/lib/shopify-mock/urls.rb +2 -0
  72. data/shopify-mock-new.gemspec +31 -0
  73. data/spec/errors_spec.rb +5 -0
  74. data/spec/fixture_spec.rb +70 -0
  75. data/spec/mock_spec.rb +64 -0
  76. data/spec/response_spec.rb +32 -0
  77. data/spec/shopify_api_spec.rb +107 -0
  78. data/spec/spec_helper.rb +11 -0
  79. data/spec/support/fixture_support.rb +5 -0
  80. data/spec/support/http_support.rb +11 -0
  81. data/spec/support/url_support.rb +8 -0
  82. metadata +237 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "pages": [
3
+ {
4
+ "handle": "tos",
5
+ "created_at": "2008-07-15T20:00:00-04:00",
6
+ "body_html": "<p>We make <strong>perfect</strong> stuff, we don't need a warranty.</p>",
7
+ "title": "Terms of Services",
8
+ "template_suffix": null,
9
+ "author": "Dennis",
10
+ "updated_at": "2008-07-16T20:00:00-04:00",
11
+ "shop_id": 690933842,
12
+ "id": 131092082,
13
+ "published_at": "2008-07-15T20:00:00-04:00"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "product_search_engines": [
3
+ {
4
+ "name": "Google Product Search",
5
+ "created_at": "2011-09-06T11:50:04-04:00"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "products": [
3
+ {
4
+ "product_type": "Cult Products",
5
+ "handle": "ipod-nano",
6
+ "created_at": "2011-09-06T11:46:13-04:00",
7
+ "body_html": "<p>It's the small iPod with one very big idea: Video. Now the world's most popular music player, available in 4GB and 8GB models, lets you enjoy TV shows, movies, video podcasts, and more. The larger, brighter display means amazing picture quality. In six eye-catching colors, iPod nano is stunning all around. And with models starting at just $149, little speaks volumes.</p>",
8
+ "title": "IPod Nano - 8GB",
9
+ "template_suffix": null,
10
+ "updated_at": "2011-09-06T11:46:13-04:00",
11
+ "tags": "Emotive, Flash Memory, MP3, Music",
12
+ "id": 632910392,
13
+ "images": [
14
+ {
15
+ "position": 1,
16
+ "created_at": "2011-09-06T11:46:13-04:00",
17
+ "product_id": 632910392,
18
+ "updated_at": "2011-09-06T11:46:13-04:00",
19
+ "src": "http://static.shopify.com/s/files/1/6909/3384/products/ipod-nano.png?0",
20
+ "id": 850703190
21
+ }
22
+ ],
23
+ "variants": [
24
+ {
25
+ "position": 1,
26
+ "price": "199.00",
27
+ "created_at": "2011-09-06T11:46:13-04:00",
28
+ "requires_shipping": true,
29
+ "title": "Pink",
30
+ "inventory_quantity": 10,
31
+ "compare_at_price": null,
32
+ "inventory_policy": "continue",
33
+ "updated_at": "2011-09-06T11:46:13-04:00",
34
+ "inventory_management": "shopify",
35
+ "id": 808950810,
36
+ "taxable": true,
37
+ "grams": 200,
38
+ "sku": "IPOD2008PINK",
39
+ "option1": "Pink",
40
+ "fulfillment_service": "manual",
41
+ "option2": null,
42
+ "option3": null
43
+ },
44
+ {
45
+ "position": 2,
46
+ "price": "199.00",
47
+ "created_at": "2011-09-06T11:46:13-04:00",
48
+ "requires_shipping": true,
49
+ "title": "Red",
50
+ "inventory_quantity": 20,
51
+ "compare_at_price": null,
52
+ "inventory_policy": "continue",
53
+ "updated_at": "2011-09-06T11:46:13-04:00",
54
+ "inventory_management": "shopify",
55
+ "id": 49148385,
56
+ "taxable": true,
57
+ "grams": 200,
58
+ "sku": "IPOD2008RED",
59
+ "option1": "Red",
60
+ "fulfillment_service": "manual",
61
+ "option2": null,
62
+ "option3": null
63
+ },
64
+ {
65
+ "position": 3,
66
+ "price": "199.00",
67
+ "created_at": "2011-09-06T11:46:13-04:00",
68
+ "requires_shipping": true,
69
+ "title": "Green",
70
+ "inventory_quantity": 30,
71
+ "compare_at_price": null,
72
+ "inventory_policy": "continue",
73
+ "updated_at": "2011-09-06T11:46:13-04:00",
74
+ "inventory_management": "shopify",
75
+ "id": 39072856,
76
+ "taxable": true,
77
+ "grams": 200,
78
+ "sku": "IPOD2008GREEN",
79
+ "option1": "Green",
80
+ "fulfillment_service": "manual",
81
+ "option2": null,
82
+ "option3": null
83
+ },
84
+ {
85
+ "position": 4,
86
+ "price": "199.00",
87
+ "created_at": "2011-09-06T11:46:13-04:00",
88
+ "requires_shipping": true,
89
+ "title": "Black",
90
+ "inventory_quantity": 40,
91
+ "compare_at_price": null,
92
+ "inventory_policy": "continue",
93
+ "updated_at": "2011-09-06T11:46:13-04:00",
94
+ "inventory_management": "shopify",
95
+ "id": 457924702,
96
+ "taxable": true,
97
+ "grams": 200,
98
+ "sku": "IPOD2008BLACK",
99
+ "option1": "Black",
100
+ "fulfillment_service": "manual",
101
+ "option2": null,
102
+ "option3": null
103
+ }
104
+ ],
105
+ "vendor": "Apple",
106
+ "published_at": "2007-12-31T19:00:00-05:00",
107
+ "options": [
108
+ {
109
+ "name": "Title"
110
+ }
111
+ ]
112
+ }
113
+ ]
114
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "provinces": [
3
+ {
4
+ "tax": 0.08,
5
+ "name": "Alberta",
6
+ "tax_name": null,
7
+ "code": "AB",
8
+ "id": 205434194,
9
+ "tax_type": null
10
+ },
11
+ {
12
+ "tax": 0.07,
13
+ "name": "British Columbia",
14
+ "tax_name": null,
15
+ "code": "BC",
16
+ "id": 170405627,
17
+ "tax_type": null
18
+ },
19
+ {
20
+ "tax": 0.07,
21
+ "name": "Manitoba",
22
+ "tax_name": null,
23
+ "code": "MB",
24
+ "id": 342345110,
25
+ "tax_type": null
26
+ },
27
+ {
28
+ "tax": 0.15,
29
+ "name": "New Brunswick",
30
+ "tax_name": null,
31
+ "code": "NB",
32
+ "id": 92264567,
33
+ "tax_type": null
34
+ },
35
+ {
36
+ "tax": 0.15,
37
+ "name": "Newfoundland",
38
+ "tax_name": null,
39
+ "code": "NF",
40
+ "id": 243284171,
41
+ "tax_type": null
42
+ },
43
+ {
44
+ "tax": 0.0,
45
+ "name": "Northwest Territories",
46
+ "tax_name": null,
47
+ "code": "NT",
48
+ "id": 439598329,
49
+ "tax_type": null
50
+ },
51
+ {
52
+ "tax": 0.15,
53
+ "name": "Nova Scotia",
54
+ "tax_name": null,
55
+ "code": "NS",
56
+ "id": 448070559,
57
+ "tax_type": null
58
+ },
59
+ {
60
+ "tax": 0.0,
61
+ "name": "Nunavut",
62
+ "tax_name": null,
63
+ "code": "NU",
64
+ "id": 670206421,
65
+ "tax_type": null
66
+ },
67
+ {
68
+ "tax": 0.08,
69
+ "name": "Ontario",
70
+ "tax_name": null,
71
+ "code": "ON",
72
+ "id": 702530425,
73
+ "tax_type": null
74
+ },
75
+ {
76
+ "tax": 0.1,
77
+ "name": "Prince Edward Island",
78
+ "tax_name": null,
79
+ "code": "PE",
80
+ "id": 570891722,
81
+ "tax_type": null
82
+ },
83
+ {
84
+ "tax": 0.09,
85
+ "name": "Quebec",
86
+ "tax_name": null,
87
+ "code": "QC",
88
+ "id": 224293623,
89
+ "tax_type": null
90
+ },
91
+ {
92
+ "tax": 0.0,
93
+ "name": "Yukon",
94
+ "tax_name": null,
95
+ "code": "YT",
96
+ "id": 1005264686,
97
+ "tax_type": null
98
+ }
99
+ ]
100
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "recurring_application_charge": {
3
+ "price": "10.00",
4
+ "name": "Super Duper Plan",
5
+ "created_at": "2011-09-06T11:50:32-04:00",
6
+ "trial_days": 0,
7
+ "return_url": "http://super-duper.shopifyapps.com?charge_id=654381199",
8
+ "activated_on": null,
9
+ "updated_at": "2011-09-06T11:50:32-04:00",
10
+ "confirmation_url": "http://apple.myshopify.com/admin/subscriptions/confirm_recurring_application_charge/654381199?signature=BAhpBI8QASc%3D--2281aa5a8b56409b646a99312fdf3066c3e03b3e",
11
+ "id": 654381199,
12
+ "cancelled_on": null,
13
+ "trial_ends_on": null,
14
+ "billing_on": null,
15
+ "test": true,
16
+ "status": "pending"
17
+ }
18
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "redirects": [
3
+ {
4
+ "id": 304339089,
5
+ "path": "/products.php",
6
+ "target": "/products"
7
+ },
8
+ {
9
+ "id": 668809255,
10
+ "path": "/leopard",
11
+ "target": "/pages/macosx"
12
+ },
13
+ {
14
+ "id": 950115854,
15
+ "path": "/ibook",
16
+ "target": "/products/macbook"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "script_tags": [
3
+ {
4
+ "created_at": "2011-09-06T11:50:04-04:00",
5
+ "updated_at": "2011-09-06T11:50:04-04:00",
6
+ "src": "http://js-aplenty.com/foo.js",
7
+ "id": 596726825,
8
+ "event": "onload"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "shop": {
3
+ "name": "Apple Computers",
4
+ "city": "Cupertino",
5
+ "address1": "1 Infinite Loop",
6
+ "zip": "95014",
7
+ "created_at": "2007-12-31T19:00:00-05:00",
8
+ "plan_name": "enterprise",
9
+ "shop_owner": "Steve Jobs",
10
+ "public": false,
11
+ "country": "US",
12
+ "money_with_currency_format": "$ {{amount}} USD",
13
+ "money_format": "$ {{amount}}",
14
+ "taxes_included": null,
15
+ "domain": "shop.apple.com",
16
+ "id": 690933842,
17
+ "timezone": "(GMT-05:00) Eastern Time (US & Canada)",
18
+ "tax_shipping": null,
19
+ "phone": null,
20
+ "currency": "USD",
21
+ "source": null,
22
+ "province": "CA",
23
+ "myshopify_domain": "apple.myshopify.com",
24
+ "email": "steve@apple.com"
25
+ }
26
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "smart_collections": [
3
+ {
4
+ "handle": "smart-ipods",
5
+ "body_html": "<p>The best selling ipod ever</p>",
6
+ "title": "Smart iPods",
7
+ "template_suffix": null,
8
+ "rules": [
9
+ {
10
+ "relation": "equals",
11
+ "column": "type",
12
+ "condition": "Cult Products"
13
+ }
14
+ ],
15
+ "updated_at": "2008-02-01T19:00:00-05:00",
16
+ "sort_order": "manual",
17
+ "id": 482865238,
18
+ "published_at": "2008-02-01T19:00:00-05:00"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "themes": [
3
+ {
4
+ "name": "Comfort",
5
+ "created_at": "2011-09-06T11:50:04-04:00",
6
+ "updated_at": "2011-09-06T11:50:04-04:00",
7
+ "role": "main",
8
+ "id": 828155753
9
+ },
10
+ {
11
+ "name": "Speed",
12
+ "created_at": "2011-09-06T11:50:04-04:00",
13
+ "updated_at": "2011-09-06T11:50:04-04:00",
14
+ "role": "mobile",
15
+ "id": 976877075
16
+ },
17
+ {
18
+ "name": "Sandbox",
19
+ "created_at": "2011-09-06T11:50:04-04:00",
20
+ "updated_at": "2011-09-06T11:50:04-04:00",
21
+ "role": "unpublished",
22
+ "id": 752253240
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "transactions": [
3
+ {
4
+ "kind": "capture",
5
+ "created_at": "2011-09-06T11:51:33-04:00",
6
+ "order_id": 450789469,
7
+ "amount": "10.00",
8
+ "authorization": null,
9
+ "receipt": {},
10
+ "status": "success"
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "variant": {
3
+ "price": "199.00",
4
+ "position": 1,
5
+ "created_at": "2011-10-20T14:05:13-04:00",
6
+ "title": "Pink",
7
+ "requires_shipping": true,
8
+ "updated_at": "2011-10-20T14:05:13-04:00",
9
+ "inventory_policy": "continue",
10
+ "compare_at_price": null,
11
+ "inventory_quantity": 10,
12
+ "inventory_management": "shopify",
13
+ "taxable": true,
14
+ "id": 808950810,
15
+ "grams": 200,
16
+ "sku": "IPOD2008PINK",
17
+ "option1": "Pink",
18
+ "option2": null,
19
+ "fulfillment_service": "manual",
20
+ "option3": null,
21
+ "product_id": 632910392
22
+ }
23
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "variants": [
3
+ {
4
+ "price": "199.00",
5
+ "position": 1,
6
+ "created_at": "2011-10-20T14:05:13-04:00",
7
+ "title": "Pink",
8
+ "requires_shipping": true,
9
+ "updated_at": "2011-10-20T14:05:13-04:00",
10
+ "inventory_policy": "continue",
11
+ "compare_at_price": null,
12
+ "inventory_quantity": 10,
13
+ "inventory_management": "shopify",
14
+ "taxable": true,
15
+ "id": 808950810,
16
+ "grams": 200,
17
+ "sku": "IPOD2008PINK",
18
+ "option1": "Pink",
19
+ "option2": null,
20
+ "fulfillment_service": "manual",
21
+ "option3": null,
22
+ "product_id": 632910392
23
+ },
24
+ {
25
+ "price": "199.00",
26
+ "position": 2,
27
+ "created_at": "2011-10-20T14:05:13-04:00",
28
+ "title": "Red",
29
+ "requires_shipping": true,
30
+ "updated_at": "2011-10-20T14:05:13-04:00",
31
+ "inventory_policy": "continue",
32
+ "compare_at_price": null,
33
+ "inventory_quantity": 20,
34
+ "inventory_management": "shopify",
35
+ "taxable": true,
36
+ "id": 49148385,
37
+ "grams": 200,
38
+ "sku": "IPOD2008RED",
39
+ "option1": "Red",
40
+ "option2": null,
41
+ "fulfillment_service": "manual",
42
+ "option3": null,
43
+ "product_id": 632910392
44
+ },
45
+ {
46
+ "price": "199.00",
47
+ "position": 3,
48
+ "created_at": "2011-10-20T14:05:13-04:00",
49
+ "title": "Green",
50
+ "requires_shipping": true,
51
+ "updated_at": "2011-10-20T14:05:13-04:00",
52
+ "inventory_policy": "continue",
53
+ "compare_at_price": null,
54
+ "inventory_quantity": 30,
55
+ "inventory_management": "shopify",
56
+ "taxable": true,
57
+ "id": 39072856,
58
+ "grams": 200,
59
+ "sku": "IPOD2008GREEN",
60
+ "option1": "Green",
61
+ "option2": null,
62
+ "fulfillment_service": "manual",
63
+ "option3": null,
64
+ "product_id": 632910392
65
+ },
66
+ {
67
+ "price": "199.00",
68
+ "position": 4,
69
+ "created_at": "2011-10-20T14:05:13-04:00",
70
+ "title": "Black",
71
+ "requires_shipping": true,
72
+ "updated_at": "2011-10-20T14:05:13-04:00",
73
+ "inventory_policy": "continue",
74
+ "compare_at_price": null,
75
+ "inventory_quantity": 40,
76
+ "inventory_management": "shopify",
77
+ "taxable": true,
78
+ "id": 457924702,
79
+ "grams": 200,
80
+ "sku": "IPOD2008BLACK",
81
+ "option1": "Black",
82
+ "option2": null,
83
+ "fulfillment_service": "manual",
84
+ "option3": null,
85
+ "product_id": 632910392
86
+ }
87
+ ]
88
+ }