mad_cart 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8622d8d7b39dc467815b5b059ba9d21e79d6b513
4
- data.tar.gz: bb1548cbf6dcc3f92c83e13de23a2fd11594687e
3
+ metadata.gz: 8b654cd78298e2634901fbc20f1a7584b3a8ad64
4
+ data.tar.gz: d7b9143821eb8f3a0911603c6ae4f28634d00c89
5
5
  SHA512:
6
- metadata.gz: a00f3e214aa1e70b390998b928d4a93e384618064f93658c49d0d1418984ddcc10a11c1255408756922920d4256eabdb5159e3a8aba2252396d140b466ee3176
7
- data.tar.gz: 8a8325c9390eb75a863eb3af25886a03e76c1bd15474637862a923c7d220484fdea41ed2e4c65711c218cd4befbf5ae3cc9c4e1db3b47a7a00041ea40ac89513
6
+ metadata.gz: 296d0739324d4ba16643e82945fc39241d7c0647d511f6d566949238e105110e72bfd816b22bf0b68daac8fa8a23040bbfa80953d70ed14dbf89edcf5e3cfc3f
7
+ data.tar.gz: 1c5b53aad81a85475a3e5ac8c4fcbaf3e38d4b506a24541fd2c24cf9e8b195a2f11c060a54b1b0f13fde9487ebd3121a5054f1037859056f3f424dd4fe683e88
@@ -43,16 +43,26 @@ module MadCart
43
43
  end
44
44
 
45
45
  product_hashes.map do |product|
46
- if product["master"]["images"]
47
- image = product["master"]["images"].first
46
+ master = product.try(:[], "master")
47
+ master_variant = product.try(:[], "variants").try{ |variants| variants.find{ |variant| variant['is_master'] } }
48
+ images = (master || master_variant).try(:[], "images")
49
+
50
+ if images.present?
51
+ image = images.first
52
+
48
53
  product = product.merge({
49
- :url => connection.build_url("/products/#{ product["slug"] }").to_s,
50
- :image_square_url => connection.build_url(image["product_url"]).to_s,
51
- :image_url => connection.build_url(image["large_url"]).to_s
54
+ :image_square_url => connection.build_url(image["product_url"] || image["attachment_url"]).to_s,
55
+ :image_url => connection.build_url(image["large_url"] || image["attachment_url"]).to_s
52
56
  })
53
57
  end
54
58
 
59
+ product = product.merge({
60
+ :url => connection.build_url("/products/#{ product["slug"] || product['permalink'] }").to_s,
61
+ })
62
+
55
63
  product
64
+ end.select do |product|
65
+ product[:image_url].present?
56
66
  end
57
67
  end
58
68
 
@@ -1,3 +1,3 @@
1
1
  module MadCart
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -2263,4 +2263,92 @@ http_interactions:
2263
2263
  21 Sep 2012 05:31:01 +0000","is_sample":false}]'
2264
2264
  http_version:
2265
2265
  recorded_at: Wed, 11 Feb 2015 14:07:53 GMT
2266
+ - request:
2267
+ method: get
2268
+ uri: https://support%40madmimi.com:0ff0e3939f5f160f36047cf0caa6f699fe24bdeb@store-cr4wsh4.mybigcommerce.com/api/v2/products/39/images.json
2269
+ body:
2270
+ encoding: UTF-8
2271
+ string: '[{"id":144,"product_id":39,"image_file":"sample_images\/GF_luv2shop_6625__63295.jpg","zoom_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.1280.1280.jpg?c=2","thumbnail_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.386.513.jpg?c=2","standard_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.220.290.jpg?c=2","tiny_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.44.58.jpg?c=2","is_thumbnail":true,"sort_order":0,"description":null,"date_created":"Fri,
2272
+ 21 Sep 2012 04:35:58 +0000","is_sample":false}]'
2273
+ headers:
2274
+ User-Agent:
2275
+ - Faraday v0.9.1
2276
+ Accept-Encoding:
2277
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
2278
+ Accept:
2279
+ - "*/*"
2280
+ response:
2281
+ status:
2282
+ code: 200
2283
+ message: OK
2284
+ headers:
2285
+ Server:
2286
+ - nginx
2287
+ Date:
2288
+ - Fri, 20 Feb 2015 12:53:26 GMT
2289
+ Content-Type:
2290
+ - application/json
2291
+ Transfer-Encoding:
2292
+ - chunked
2293
+ Connection:
2294
+ - keep-alive
2295
+ Set-Cookie:
2296
+ - fornax_anonymousId=31d238f5-d980-4606-87b6-2168962d6164; path=/; domain=.store-cr4wsh4.mybigcommerce.com
2297
+ X-Bc-Apilimit-Remaining:
2298
+ - '19999'
2299
+ X-Bc-Store-Version:
2300
+ - 7.6.0
2301
+ X-Bc-Is-Ha:
2302
+ - '1'
2303
+ body:
2304
+ encoding: UTF-8
2305
+ string: '[{"id":144,"product_id":39,"image_file":"sample_images\/GF_luv2shop_6625__63295.jpg","zoom_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.1280.1280.jpg?c=2","thumbnail_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.386.513.jpg?c=2","standard_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.220.290.jpg?c=2","tiny_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/39\/images\/144\/GF_luv2shop_6625__63295.1405299805.44.58.jpg?c=2","is_thumbnail":true,"sort_order":0,"description":null,"date_created":"Fri,
2306
+ 21 Sep 2012 04:35:58 +0000","is_sample":false}]'
2307
+ http_version:
2308
+ recorded_at: Fri, 20 Feb 2015 12:54:05 GMT
2309
+ - request:
2310
+ method: get
2311
+ uri: https://support%40madmimi.com:0ff0e3939f5f160f36047cf0caa6f699fe24bdeb@store-cr4wsh4.mybigcommerce.com/api/v2/products/37/images.json
2312
+ body:
2313
+ encoding: UTF-8
2314
+ string: '[{"id":141,"product_id":37,"image_file":"sample_images\/gf-l2s-80022__72789.jpg","zoom_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.1280.1280.jpg?c=2","thumbnail_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.386.513.jpg?c=2","standard_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.220.290.jpg?c=2","tiny_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.44.58.jpg?c=2","is_thumbnail":false,"sort_order":0,"description":null,"date_created":"Fri,
2315
+ 21 Sep 2012 04:28:29 +0000","is_sample":false},{"id":142,"product_id":37,"image_file":"sample_images\/hero-gf-l2s-80031__63154.jpg","zoom_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.1280.1280.jpg?c=2","thumbnail_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.386.513.jpg?c=2","standard_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.220.290.jpg?c=2","tiny_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.44.58.jpg?c=2","is_thumbnail":true,"sort_order":1,"description":null,"date_created":"Fri,
2316
+ 21 Sep 2012 04:28:30 +0000","is_sample":false}]'
2317
+ headers:
2318
+ User-Agent:
2319
+ - Faraday v0.9.1
2320
+ Accept-Encoding:
2321
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
2322
+ Accept:
2323
+ - "*/*"
2324
+ response:
2325
+ status:
2326
+ code: 200
2327
+ message: OK
2328
+ headers:
2329
+ Server:
2330
+ - nginx
2331
+ Date:
2332
+ - Fri, 20 Feb 2015 12:55:41 GMT
2333
+ Content-Type:
2334
+ - application/json
2335
+ Transfer-Encoding:
2336
+ - chunked
2337
+ Connection:
2338
+ - keep-alive
2339
+ Set-Cookie:
2340
+ - fornax_anonymousId=c3d2326d-1b2e-47ce-8012-e14e27967d7f; path=/; domain=.store-cr4wsh4.mybigcommerce.com
2341
+ X-Bc-Apilimit-Remaining:
2342
+ - '19998'
2343
+ X-Bc-Store-Version:
2344
+ - 7.6.0
2345
+ X-Bc-Is-Ha:
2346
+ - '1'
2347
+ body:
2348
+ encoding: UTF-8
2349
+ string: '[{"id":141,"product_id":37,"image_file":"sample_images\/gf-l2s-80022__72789.jpg","zoom_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.1280.1280.jpg?c=2","thumbnail_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.386.513.jpg?c=2","standard_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.220.290.jpg?c=2","tiny_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/141\/gf-l2s-80022__72789.1405299820.44.58.jpg?c=2","is_thumbnail":false,"sort_order":0,"description":null,"date_created":"Fri,
2350
+ 21 Sep 2012 04:28:29 +0000","is_sample":false},{"id":142,"product_id":37,"image_file":"sample_images\/hero-gf-l2s-80031__63154.jpg","zoom_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.1280.1280.jpg?c=2","thumbnail_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.386.513.jpg?c=2","standard_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.220.290.jpg?c=2","tiny_url":"https:\/\/cdn2.bigcommerce.com\/server3700\/cr4wsh4\/products\/37\/images\/142\/hero-gf-l2s-80031__63154.1405299821.44.58.jpg?c=2","is_thumbnail":true,"sort_order":1,"description":null,"date_created":"Fri,
2351
+ 21 Sep 2012 04:28:30 +0000","is_sample":false}]'
2352
+ http_version:
2353
+ recorded_at: Fri, 20 Feb 2015 12:56:19 GMT
2266
2354
  recorded_with: VCR 2.5.0