mad_cart 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mad_cart/configuration.rb +2 -9
- data/lib/mad_cart/store/big_commerce.rb +3 -3
- data/lib/mad_cart/version.rb +1 -1
- data/mad_cart.gemspec +1 -1
- data/spec/fixtures/vcr_cassettes/big_commerce_products_no_images.yml +201 -0
- data/spec/lib/store/big_commerce_spec.rb +7 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7f1f057e22f04e430441709ffc543c76e96374e
|
4
|
+
data.tar.gz: 17922368b33cf7c9b6d94ec522e90acf520fbb95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24c11629ff7a2d6cb6f75dfef75ce80b7ca434ffdb9d35a6b872f272d479144459d53230098a4215826f60cc85260bdc4c46175f989996ae1be196a2c8107a65
|
7
|
+
data.tar.gz: 00119daa25d5acb85c5ec6a5079e07c2910bff615ebe3d14cb5dfc3d9c2b477959134722fe918b330cc590bc86669dedef0d2ed2b63a70469527518487edfcb9
|
@@ -12,7 +12,7 @@ module MadCart
|
|
12
12
|
return MadCart::Configuration.instance.data
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
class Configuration
|
17
17
|
include Singleton
|
18
18
|
|
@@ -47,13 +47,6 @@ module MadCart
|
|
47
47
|
@data[:included_attributes] ||= {}
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
class ConfigurationError < NoMethodError; end
|
52
|
-
|
53
|
-
def method_missing(meth, *args)
|
54
|
-
return nil
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
50
|
+
Data = Class.new(OpenStruct)
|
58
51
|
end
|
59
52
|
end
|
@@ -44,16 +44,16 @@ module MadCart
|
|
44
44
|
threads.each { |t| t.join }
|
45
45
|
|
46
46
|
product_hashes.map do |p|
|
47
|
-
|
48
|
-
product_images = images.find { |i| i.first['product_id'] == p['id'] }
|
47
|
+
product_images = images.find { |i| i.first.try(:[], 'product_id') == p['id'] } || []
|
49
48
|
image = product_images.sort_by{|i| i["sort_order"] }.find { |i| i["is_thumbnail"] }
|
49
|
+
next if image.nil?
|
50
50
|
|
51
51
|
p.merge({
|
52
52
|
:url => connection.build_url("#{p['custom_url']}").to_s,
|
53
53
|
:image_square_url => image.try(:[], "thumbnail_url"),
|
54
54
|
:image_url => image.try(:[], "standard_url")
|
55
55
|
})
|
56
|
-
end
|
56
|
+
end.compact
|
57
57
|
end
|
58
58
|
|
59
59
|
def get_customer_hashes
|
data/lib/mad_cart/version.rb
CHANGED
data/mad_cart.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
29
|
spec.add_development_dependency "rake"
|
30
|
-
spec.add_development_dependency
|
30
|
+
spec.add_development_dependency "json"
|
31
31
|
spec.add_development_dependency "rspec"
|
32
32
|
spec.add_development_dependency "vcr", '2.5.0'
|
33
33
|
spec.add_development_dependency "webmock", '~> 1.11.0'
|
@@ -0,0 +1,201 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://support%40madmimi.com:0ff0e3939f5f160f36047cf0caa6f699fe24bdeb@store-cr4wsh4.mybigcommerce.com/api/v2/products.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Thu, 21 Aug 2014 21:10:22 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Last-Modified:
|
32
|
+
- Wed, 26 Sep 2012 00:06:10 +0000
|
33
|
+
X-Bc-Apilimit-Remaining:
|
34
|
+
- '19992'
|
35
|
+
X-Bc-Store-Version:
|
36
|
+
- 7.6.0
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '[{
|
40
|
+
"id": 32,
|
41
|
+
"keyword_filter": null,
|
42
|
+
"name": "[Sample] Tomorrow is today, Red printed scarf",
|
43
|
+
"type": "physical",
|
44
|
+
"sku": "",
|
45
|
+
"description": "<p><strong>How to write product descriptions that sell<\/strong><br \/>One of the best things you can do to make your store successful is invest some time in writing great product descriptions. You want to provide detailed yet concise information that will entice potential customers to buy.<br \/><br \/>Keep three things in mind:<br \/><br \/><strong>Think like a consumer<\/strong><br \/>Think about what you as a consumer would want to know, then include those features in your description. For clothes: materials and fit. For food: ingredients and how it was prepared. Bullets are your friends when listing features — try to limit each one to 5-8 words.<br \/><br \/><strong>Find differentiators<\/strong><br \/>Pepper your features with details that show how the product stands out against similar offerings. For clothes: is it vintage or hard to find? For art: is the artist well known? For home décor: is it a certain style like mid-century modern? Unique product descriptions not only help you stand out, they improve your SEO.<br \/><br \/><strong>Keep it simple<\/strong><br \/>Provide enough detail to help consumers make an informed decision, but don’t overwhelm with a laundry list of features or flowery language. Densely pack your descriptions with useful information and watch products fly off the shelf.<\/p>",
|
46
|
+
"search_keywords": null,
|
47
|
+
"availability_description": "",
|
48
|
+
"price": "89.0000",
|
49
|
+
"cost_price": "0.0000",
|
50
|
+
"retail_price": "0.0000",
|
51
|
+
"sale_price": "0.0000",
|
52
|
+
"calculated_price": "89.0000",
|
53
|
+
"sort_order": 0,
|
54
|
+
"is_visible": true,
|
55
|
+
"is_featured": true,
|
56
|
+
"related_products": "-1",
|
57
|
+
"inventory_level": 0,
|
58
|
+
"inventory_warning_level": 0,
|
59
|
+
"warranty": null,
|
60
|
+
"weight": "0.3000",
|
61
|
+
"width": "0.0000",
|
62
|
+
"height": "0.0000",
|
63
|
+
"depth": "0.0000",
|
64
|
+
"fixed_cost_shipping_price": "10.0000",
|
65
|
+
"is_free_shipping": false,
|
66
|
+
"inventory_tracking": "none",
|
67
|
+
"rating_total": 0,
|
68
|
+
"rating_count": 0,
|
69
|
+
"total_sold": 0,
|
70
|
+
"date_created": "Fri, 21 Sep 2012 02:31:01 +0000",
|
71
|
+
"brand_id": 17,
|
72
|
+
"view_count": 7,
|
73
|
+
"page_title": "",
|
74
|
+
"meta_keywords": null,
|
75
|
+
"meta_description": null,
|
76
|
+
"layout_file": "product.html",
|
77
|
+
"is_price_hidden": false,
|
78
|
+
"price_hidden_label": "",
|
79
|
+
"categories": [14],
|
80
|
+
"date_modified": "Mon, 24 Sep 2012 01:34:57 +0000",
|
81
|
+
"event_date_field_name": "Delivery Date",
|
82
|
+
"event_date_type": "none",
|
83
|
+
"event_date_start": "",
|
84
|
+
"event_date_end": "",
|
85
|
+
"myob_asset_account": "",
|
86
|
+
"myob_income_account": "",
|
87
|
+
"myob_expense_account": "",
|
88
|
+
"peachtree_gl_account": "",
|
89
|
+
"condition": "New",
|
90
|
+
"is_condition_shown": false,
|
91
|
+
"preorder_release_date": "",
|
92
|
+
"is_preorder_only": false,
|
93
|
+
"preorder_message": "",
|
94
|
+
"order_quantity_minimum": 0,
|
95
|
+
"order_quantity_maximum": 0,
|
96
|
+
"open_graph_type": "product",
|
97
|
+
"open_graph_title": "",
|
98
|
+
"open_graph_description": null,
|
99
|
+
"is_open_graph_thumbnail": true,
|
100
|
+
"upc": null,
|
101
|
+
"date_last_imported": "",
|
102
|
+
"option_set_id": null,
|
103
|
+
"tax_class_id": 0,
|
104
|
+
"option_set_display": "right",
|
105
|
+
"bin_picking_number": "",
|
106
|
+
"custom_url": "\/tomorrow-is-today-red-printed-scarf\/",
|
107
|
+
"primary_image": {
|
108
|
+
"id": 247,
|
109
|
+
"zoom_url": "https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/32\/images\/247\/in_123__14581.1405299822.1280.1280.jpg?c=2",
|
110
|
+
"thumbnail_url": "https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/32\/images\/247\/in_123__14581.1405299822.220.290.jpg?c=2",
|
111
|
+
"standard_url": "https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/32\/images\/247\/in_123__14581.1405299822.386.513.jpg?c=2",
|
112
|
+
"tiny_url": "https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/32\/images\/247\/in_123__14581.1405299822.44.58.jpg?c=2"
|
113
|
+
},
|
114
|
+
"availability": "available",
|
115
|
+
"brand": {
|
116
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/brands\/17.json",
|
117
|
+
"resource": "\/brands\/17"
|
118
|
+
},
|
119
|
+
"downloads": {
|
120
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/downloads.json",
|
121
|
+
"resource": "\/products\/32\/downloads"
|
122
|
+
},
|
123
|
+
"images": {
|
124
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/images.json",
|
125
|
+
"resource": "\/products\/32\/images"
|
126
|
+
},
|
127
|
+
"discount_rules": {
|
128
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/discountrules.json",
|
129
|
+
"resource": "\/products\/32\/discountrules"
|
130
|
+
},
|
131
|
+
"configurable_fields": {
|
132
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/configurablefields.json",
|
133
|
+
"resource": "\/products\/32\/configurablefields"
|
134
|
+
},
|
135
|
+
"custom_fields": {
|
136
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/customfields.json",
|
137
|
+
"resource": "\/products\/32\/customfields"
|
138
|
+
},
|
139
|
+
"videos": {
|
140
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/videos.json",
|
141
|
+
"resource": "\/products\/32\/videos"
|
142
|
+
},
|
143
|
+
"skus": {
|
144
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/skus.json",
|
145
|
+
"resource": "\/products\/32\/skus"
|
146
|
+
},
|
147
|
+
"rules": {
|
148
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/rules.json",
|
149
|
+
"resource": "\/products\/32\/rules"
|
150
|
+
},
|
151
|
+
"option_set": null,
|
152
|
+
"options": {
|
153
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/products\/32\/options.json",
|
154
|
+
"resource": "\/products\/32\/options"
|
155
|
+
},
|
156
|
+
"tax_class": {
|
157
|
+
"url": "https:\/\/store-cr4wsh4.mybigcommerce.com\/api\/v2\/taxclasses\/0.json",
|
158
|
+
"resource": "\/taxclasses\/0"
|
159
|
+
}
|
160
|
+
}]'
|
161
|
+
http_version:
|
162
|
+
recorded_at: Thu, 21 Aug 2014 21:10:23 GMT
|
163
|
+
- request:
|
164
|
+
method: get
|
165
|
+
uri: https://support%40madmimi.com:0ff0e3939f5f160f36047cf0caa6f699fe24bdeb@store-cr4wsh4.mybigcommerce.com/api/v2/products/32/images.json
|
166
|
+
headers:
|
167
|
+
User-Agent:
|
168
|
+
- Faraday v0.9.1
|
169
|
+
Accept-Encoding:
|
170
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
171
|
+
Accept:
|
172
|
+
- "*/*"
|
173
|
+
response:
|
174
|
+
status:
|
175
|
+
code: 200
|
176
|
+
message: OK
|
177
|
+
headers:
|
178
|
+
Server:
|
179
|
+
- nginx
|
180
|
+
Date:
|
181
|
+
- Fri, 20 Feb 2015 12:55:41 GMT
|
182
|
+
Content-Type:
|
183
|
+
- application/json
|
184
|
+
Transfer-Encoding:
|
185
|
+
- chunked
|
186
|
+
Connection:
|
187
|
+
- keep-alive
|
188
|
+
Set-Cookie:
|
189
|
+
- fornax_anonymousId=c3d2326d-1b2e-47ce-8012-e14e27967d7f; path=/; domain=.store-cr4wsh4.mybigcommerce.com
|
190
|
+
X-Bc-Apilimit-Remaining:
|
191
|
+
- '19998'
|
192
|
+
X-Bc-Store-Version:
|
193
|
+
- 7.6.0
|
194
|
+
X-Bc-Is-Ha:
|
195
|
+
- '1'
|
196
|
+
body:
|
197
|
+
encoding: UTF-8
|
198
|
+
string: '[]'
|
199
|
+
http_version:
|
200
|
+
recorded_at: Fri, 20 Feb 2015 12:56:19 GMT
|
201
|
+
recorded_with: VCR 2.5.0
|
@@ -51,6 +51,13 @@ describe MadCart::Store::BigCommerce do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
|
55
|
+
it "returns an empty array when there are no images for any products" do
|
56
|
+
VCR.use_cassette('big_commerce_products_no_images') do
|
57
|
+
subject.products.should == []
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
54
61
|
end
|
55
62
|
|
56
63
|
context "count" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mad_cart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Heiligers
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -128,16 +128,16 @@ dependencies:
|
|
128
128
|
name: json
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- - "
|
131
|
+
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- - "
|
138
|
+
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: '0'
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: rspec
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- spec/fixtures/vcr_cassettes/big_commerce_no_records.yml
|
228
228
|
- spec/fixtures/vcr_cassettes/big_commerce_products.yml
|
229
229
|
- spec/fixtures/vcr_cassettes/big_commerce_products_count.yml
|
230
|
+
- spec/fixtures/vcr_cassettes/big_commerce_products_no_images.yml
|
230
231
|
- spec/fixtures/vcr_cassettes/big_commerce_store.yml
|
231
232
|
- spec/fixtures/vcr_cassettes/big_commerce_time.yml
|
232
233
|
- spec/fixtures/vcr_cassettes/etsy_store_does_not_exist.yml
|
@@ -267,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
268
|
version: '0'
|
268
269
|
requirements: []
|
269
270
|
rubyforge_project:
|
270
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.5.1
|
271
272
|
signing_key:
|
272
273
|
specification_version: 4
|
273
274
|
summary: Allows communication with various e-commerce merchants such as BigCommerce
|
@@ -279,6 +280,7 @@ test_files:
|
|
279
280
|
- spec/fixtures/vcr_cassettes/big_commerce_no_records.yml
|
280
281
|
- spec/fixtures/vcr_cassettes/big_commerce_products.yml
|
281
282
|
- spec/fixtures/vcr_cassettes/big_commerce_products_count.yml
|
283
|
+
- spec/fixtures/vcr_cassettes/big_commerce_products_no_images.yml
|
282
284
|
- spec/fixtures/vcr_cassettes/big_commerce_store.yml
|
283
285
|
- spec/fixtures/vcr_cassettes/big_commerce_time.yml
|
284
286
|
- spec/fixtures/vcr_cassettes/etsy_store_does_not_exist.yml
|