dugway 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff6d7b016361e10eae58787065d149c641ec6d903b43ab043ad63f5887f2839f
4
- data.tar.gz: d1837b869e9839a0e093ed5adba26ff154cba4fbc5560f11ca0ef0da6f1e328c
3
+ metadata.gz: c46df5b017cc39075c1f2d19590a5eb0e970bcf061adc03e92c59995d4fe8755
4
+ data.tar.gz: 22df3b32d09c165b465f3b2cde61843d5c5ee87e709b9ec7bc4b170d90769a76
5
5
  SHA512:
6
- metadata.gz: 394df0c94d22aea6e12bd142c316ec3622e5aae27cdb0f2f883b98bb53eac0652718770162e7891fe5a0ce3d68e638e830c01d68a8f3beaaa20f62baceac9047
7
- data.tar.gz: dcab3dd4a7db0ebf1a079e1f83f1a78f811da241abcccd2a4154bb5b2e017986022683e09f5ead00fdf5c0e45880ca5da34419fde32d91c65f09361a9be92230
6
+ metadata.gz: 9ba8e565450c1961bdde6512f23edb936bb3750c38dea596d3c2932777b935d6b5f5882797b8cb40690d35f7df210e04ce7d1450958e07b882c0bb13dcd2d200
7
+ data.tar.gz: 284359b7d153a8c92cb021c7e4211049201ac8626fe7e1a17c08cef4f574dcf603cfbd2c0abd3c0811956520d6af46fd27d1e4327d807024f4c42993b355183d
@@ -28,10 +28,19 @@ module Dugway
28
28
 
29
29
  get '/product/:product(.js)' do
30
30
  render_not_found unless product = store.product(params[:product])
31
- if request.html?
32
- set_page_name_and_render_page(product, :product)
33
- elsif request.js?
34
- render_json(product)
31
+
32
+ if product['has_password_protection']
33
+ if request.html?
34
+ render_password_protected_product_page(product)
35
+ elsif request.js?
36
+ render_json({ 'error' => 'This product is password protected' })
37
+ end
38
+ else
39
+ if request.html?
40
+ set_page_name_and_render_page(product, :product)
41
+ elsif request.js?
42
+ render_json(product)
43
+ end
35
44
  end
36
45
  end
37
46
 
@@ -111,5 +120,40 @@ module Dugway
111
120
  render_page(type => object, :page => page_copy)
112
121
  end
113
122
 
123
+ def self.render_password_protected_product_page(product)
124
+ # Create a simple page object for password protected products
125
+ password_page = {
126
+ 'name' => product['name'],
127
+ 'permalink' => 'password_protected_product',
128
+ 'url' => page['url'],
129
+ 'full_url' => page['full_url'],
130
+ 'full_path' => page['full_path'],
131
+ 'category' => 'theme',
132
+ 'content' => generate_password_protection_content(product)
133
+ }
134
+
135
+ render_page(:product => product, :page => password_page)
136
+ end
137
+
138
+ def self.generate_password_protection_content(product)
139
+ <<~HTML
140
+ <section class="password_protected_product">
141
+ <div class="password_protection_notice">
142
+ <h2>{{ product.name }}</h2>
143
+ <div class="message">
144
+ <p>This product is password protected in the production shop.</p>
145
+ </div>
146
+ </div>
147
+ </section>
148
+
149
+ <style>
150
+ .password_protected_product {
151
+ text-align: center;
152
+ padding: 2rem;
153
+ }
154
+ </style>
155
+ HTML
156
+ end
157
+
114
158
  end
115
159
  end
@@ -35,7 +35,7 @@ module Dugway
35
35
  end
36
36
 
37
37
  def options
38
- @options ||= source['options'].each_with_index.map { |o,i| ProductOptionDrop.new(o.update('position' => i+1, 'product' => self)) }
38
+ @options ||= (source['options'] || []).each_with_index.map { |o,i| ProductOptionDrop.new(o.update('position' => i+1, 'product' => self)) }
39
39
  end
40
40
 
41
41
  def options_in_stock
@@ -46,6 +46,10 @@ module Dugway
46
46
  source['has_option_groups']
47
47
  end
48
48
 
49
+ def has_password_protection
50
+ source && source['has_password_protection']
51
+ end
52
+
49
53
  def option_groups
50
54
  @option_groups ||= source['option_groups'].present? ?
51
55
  source['option_groups'].map { |group| OptionGroupDrop.new(group) } : []
@@ -92,11 +96,11 @@ module Dugway
92
96
  end
93
97
 
94
98
  def categories
95
- @categories ||= source['categories'].map { |c| CategoryDrop.new(c) } rescue []
99
+ @categories ||= (source['categories'] || []).map { |c| CategoryDrop.new(c) }
96
100
  end
97
101
 
98
102
  def artists
99
- @artists ||= source['artists'].map { |a| ArtistDrop.new(a) } rescue []
103
+ @artists ||= (source['artists'] || []).map { |a| ArtistDrop.new(a) }
100
104
  end
101
105
 
102
106
  def css_class
data/lib/dugway/store.rb CHANGED
@@ -82,6 +82,7 @@ module Dugway
82
82
 
83
83
  def product_and_option(option_id)
84
84
  products.each do |product|
85
+ next unless product['options']
85
86
  product['options'].each do |option|
86
87
  if option['id'] == option_id
87
88
  return product, option
@@ -113,7 +114,11 @@ module Dugway
113
114
  end
114
115
 
115
116
  def search_products(search_terms)
116
- products.select { |p| p['name'].downcase.include?(search_terms.downcase) || p['description'].downcase.include?(search_terms.downcase) }
117
+ return [] unless search_terms
118
+ products.select { |p|
119
+ (p['name'] && p['name'].downcase.include?(search_terms.downcase)) ||
120
+ (p['description'] && p['description'].downcase.include?(search_terms.downcase))
121
+ }
117
122
  end
118
123
 
119
124
  def country
@@ -185,7 +190,7 @@ module Dugway
185
190
  end
186
191
 
187
192
  def lookup_products(permalink, type)
188
- products.select { |p| p[type].any? { |c| c['permalink'] == permalink }}
193
+ products.select { |p| p[type]&.any? { |c| c['permalink'] == permalink }}
189
194
  end
190
195
  end
191
196
  end
data/lib/dugway/theme.rb CHANGED
@@ -178,7 +178,7 @@ module Dugway
178
178
  @errors << "layout.html must have exactly one `data-bc-hook=\"footer\"`" if footer_hooks != 1
179
179
  end
180
180
 
181
- VALID_SECTIONS = %w(global_navigation homepage product_page general messaging social translations).freeze
181
+ VALID_SECTIONS = %w(global_navigation homepage product_page general messaging social text_sizing translations).freeze
182
182
 
183
183
  def validate_options_settings
184
184
  return unless settings['options']
@@ -1,3 +1,3 @@
1
1
  module Dugway
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -38,7 +38,7 @@ de:
38
38
  home:
39
39
  all_products: "Alle Produkte"
40
40
  featured: "Empfohlen"
41
- featured_categories: "Empfohlene Kategorien"
41
+ featured_categories: "Kategorien"
42
42
  featured_products: "Empfohlene Produkte"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ de:
53
53
  low_inventory: "Begrenzte Menge"
54
54
  no_products: "Keine Produkte gefunden"
55
55
  on_sale: "Im Angebot"
56
+ product: "Produkt"
57
+ products: "Produkte"
56
58
  related_products: "Das gefällt dir vielleicht"
57
59
  reset: "Zurücksetzen"
58
60
  search_results: "Suchergebnisse"
@@ -38,7 +38,7 @@ en-CA:
38
38
  home:
39
39
  all_products: "All products"
40
40
  featured: "Featured"
41
- featured_categories: "Featured categories"
41
+ featured_categories: "Shop by Category"
42
42
  featured_products: "Featured products"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ en-CA:
53
53
  low_inventory: "Limited quantities available"
54
54
  no_products: "No products found"
55
55
  on_sale: "On sale"
56
+ product: "Product"
57
+ products: "Products"
56
58
  related_products: "You might also like"
57
59
  reset: "Reset"
58
60
  search_results: "Search results"
@@ -38,7 +38,7 @@ en-GB:
38
38
  home:
39
39
  all_products: "All products"
40
40
  featured: "Featured"
41
- featured_categories: "Featured categories"
41
+ featured_categories: "Browse by Category"
42
42
  featured_products: "Featured products"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ en-GB:
53
53
  low_inventory: "Limited quantities available"
54
54
  no_products: "No products found"
55
55
  on_sale: "On offer"
56
+ product: "Product"
57
+ products: "Products"
56
58
  related_products: "You might also like"
57
59
  reset: "Reset"
58
60
  search_results: "Search results"
@@ -38,7 +38,7 @@ en-US:
38
38
  home:
39
39
  all_products: "All products"
40
40
  featured: "Featured"
41
- featured_categories: "Featured categories"
41
+ featured_categories: "Shop by Category"
42
42
  featured_products: "Featured products"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ en-US:
53
53
  low_inventory: "Limited quantities available"
54
54
  no_products: "No products found"
55
55
  on_sale: "On sale"
56
+ product: "Product"
57
+ products: "Products"
56
58
  related_products: "You might also like"
57
59
  reset: "Reset"
58
60
  search_results: "Search results"
@@ -38,7 +38,7 @@ es-ES:
38
38
  home:
39
39
  all_products: "Todos los productos"
40
40
  featured: "Destacado"
41
- featured_categories: "Categorías destacadas"
41
+ featured_categories: "Categorías"
42
42
  featured_products: "Productos destacados"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ es-ES:
53
53
  low_inventory: "Cantidades limitadas"
54
54
  no_products: "No se encuentran productos"
55
55
  on_sale: "En oferta"
56
+ product: "Producto"
57
+ products: "Productos"
56
58
  related_products: "Te podría gustar"
57
59
  reset: "Restablecer"
58
60
  search_results: "Resultados de búsqueda"
@@ -38,7 +38,7 @@ es-MX:
38
38
  home:
39
39
  all_products: "Todos los productos"
40
40
  featured: "Destacado"
41
- featured_categories: "Categorías destacadas"
41
+ featured_categories: "Explorar por categoría"
42
42
  featured_products: "Productos destacados"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ es-MX:
53
53
  low_inventory: "Cantidades limitadas"
54
54
  no_products: "No se encuentran productos"
55
55
  on_sale: "En oferta"
56
+ product: "Producto"
57
+ products: "Productos"
56
58
  related_products: "Te podría gustar"
57
59
  reset: "Restablecer"
58
60
  search_results: "Resultados de búsqueda"
@@ -38,7 +38,7 @@ fr-CA:
38
38
  home:
39
39
  all_products: "Tous les produits"
40
40
  featured: "En vedette"
41
- featured_categories: "Catégories en vedette"
41
+ featured_categories: "Magasiner par catégorie"
42
42
  featured_products: "Produits en vedette"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ fr-CA:
53
53
  low_inventory: "Stock limité"
54
54
  no_products: "Aucun produit trouvé"
55
55
  on_sale: "En rabais"
56
+ product: "Produit"
57
+ products: "Produits"
56
58
  related_products: "Vous aimerez aussi"
57
59
  reset: "Réinitialiser"
58
60
  search_results: "Résultats de recherche"
@@ -38,7 +38,7 @@ fr-FR:
38
38
  home:
39
39
  all_products: "Tous les produits"
40
40
  featured: "En vedette"
41
- featured_categories: "Catégories en vedette"
41
+ featured_categories: "Acheter par catégorie"
42
42
  featured_products: "Produits en vedette"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ fr-FR:
53
53
  low_inventory: "Quantités limitées disponibles"
54
54
  no_products: "Aucun produit trouvé"
55
55
  on_sale: "En solde"
56
+ product: "Produit"
57
+ products: "Produits"
56
58
  related_products: "Vous aimerez aussi"
57
59
  reset: "Réinitialiser"
58
60
  search_results: "Résultats de recherche"
@@ -38,7 +38,7 @@ id:
38
38
  home:
39
39
  all_products: "Semua produk"
40
40
  featured: "Unggulan"
41
- featured_categories: "Kategori unggulan"
41
+ featured_categories: "Belanja Berdasarkan Kategori"
42
42
  featured_products: "Produk unggulan"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ id:
53
53
  low_inventory: "Stok terbatas"
54
54
  no_products: "Tidak ada produk ditemukan"
55
55
  on_sale: "Diskon"
56
+ product: "produk"
57
+ products: "produk"
56
58
  related_products: "Mungkin Anda suka"
57
59
  reset: "Atur ulang"
58
60
  search_results: "Hasil pencarian"
@@ -38,7 +38,7 @@ it:
38
38
  home:
39
39
  all_products: "Tutti i prodotti"
40
40
  featured: "In evidenza"
41
- featured_categories: "Categorie in evidenza"
41
+ featured_categories: "Acquista per categoria"
42
42
  featured_products: "Prodotti in evidenza"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ it:
53
53
  low_inventory: "Quantità limitate"
54
54
  no_products: "Nessun prodotto trovato"
55
55
  on_sale: "In saldo"
56
+ product: "Prodotto"
57
+ products: "Prodotti"
56
58
  related_products: "Ti potrebbe piacere"
57
59
  reset: "Reimposta"
58
60
  search_results: "Risultati di ricerca"
@@ -38,7 +38,7 @@ ja:
38
38
  home:
39
39
  all_products: "全ての商品"
40
40
  featured: "おすすめ"
41
- featured_categories: "おすすめのカテゴリー"
41
+ featured_categories: "カテゴリで探す"
42
42
  featured_products: "おすすめの商品"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ ja:
53
53
  low_inventory: "在庫限り"
54
54
  no_products: "商品が見つかりません"
55
55
  on_sale: "セール"
56
+ product: "商品"
57
+ products: "商品"
56
58
  related_products: "関連商品"
57
59
  reset: "リセット"
58
60
  search_results: "検索結果"
@@ -38,7 +38,7 @@ ko:
38
38
  home:
39
39
  all_products: "모든 제품"
40
40
  featured: "추천상품"
41
- featured_categories: "추천 카테고리"
41
+ featured_categories: "카테고리별 쇼핑"
42
42
  featured_products: "추천상품"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ ko:
53
53
  low_inventory: "재고 한정"
54
54
  no_products: "제품을 찾을 수 없습니다"
55
55
  on_sale: "할인중"
56
+ product: "상품"
57
+ products: "상품"
56
58
  related_products: "관련 제품"
57
59
  reset: "초기화"
58
60
  search_results: "검색 결과"
@@ -38,7 +38,7 @@ nl:
38
38
  home:
39
39
  all_products: "Alle producten"
40
40
  featured: "Uitgelicht"
41
- featured_categories: "Uitgelichte categorieën"
41
+ featured_categories: "Shop per categorie"
42
42
  featured_products: "Uitgelichte producten"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ nl:
53
53
  low_inventory: "Beperkte voorraad"
54
54
  no_products: "Geen producten gevonden"
55
55
  on_sale: "In de aanbieding"
56
+ product: "Product"
57
+ products: "Producten"
56
58
  related_products: "Ook interessant"
57
59
  reset: "Resetten"
58
60
  search_results: "Zoekresultaten"
@@ -38,7 +38,7 @@ pl:
38
38
  home:
39
39
  all_products: "Wszystkie produkty"
40
40
  featured: "Wyróżnione"
41
- featured_categories: "Wyróżnione kategorie"
41
+ featured_categories: "Kupuj według kategorii"
42
42
  featured_products: "Wyróżnione produkty"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ pl:
53
53
  low_inventory: "Ograniczona ilość"
54
54
  no_products: "Nie znaleziono produktów"
55
55
  on_sale: "W promocji"
56
+ product: "produkt"
57
+ products: "produkty"
56
58
  related_products: "Może Ci się spodobać"
57
59
  reset: "Resetuj"
58
60
  search_results: "Wyniki wyszukiwania"
@@ -38,7 +38,7 @@ pt-BR:
38
38
  home:
39
39
  all_products: "Todos os produtos"
40
40
  featured: "Destaque"
41
- featured_categories: "Categorias em destaque"
41
+ featured_categories: "Comprar por Categoria"
42
42
  featured_products: "Produtos em destaque"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ pt-BR:
53
53
  low_inventory: "Quantidades limitadas"
54
54
  no_products: "Nenhum produto encontrado"
55
55
  on_sale: "Em promoção"
56
+ product: "Produto"
57
+ products: "Produtos"
56
58
  related_products: "Você também pode gostar"
57
59
  reset: "Redefinir"
58
60
  search_results: "Resultados da busca"
@@ -38,7 +38,7 @@ pt-PT:
38
38
  home:
39
39
  all_products: "Todos os produtos"
40
40
  featured: "Em destaque"
41
- featured_categories: "Categorias em destaque"
41
+ featured_categories: "Ver por Categoria"
42
42
  featured_products: "Produtos em destaque"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ pt-PT:
53
53
  low_inventory: "Quantidades limitadas"
54
54
  no_products: "Nenhum produto encontrado"
55
55
  on_sale: "Em saldo"
56
+ product: "Produto"
57
+ products: "Produtos"
56
58
  related_products: "Poderá também gostar"
57
59
  reset: "Repor"
58
60
  search_results: "Resultados da pesquisa"
@@ -38,7 +38,7 @@ ro:
38
38
  home:
39
39
  all_products: "Toate produsele"
40
40
  featured: "Recomandate"
41
- featured_categories: "Categorii recomandate"
41
+ featured_categories: "Cumpărați după categorie"
42
42
  featured_products: "Produse recomandate"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ ro:
53
53
  low_inventory: "Stoc limitat"
54
54
  no_products: "Nu s-au găsit produse"
55
55
  on_sale: "La reducere"
56
+ product: "Produs"
57
+ products: "Produse"
56
58
  related_products: "V-ar putea interesa"
57
59
  reset: "Resetează"
58
60
  search_results: "Rezultatele căutării"
@@ -38,7 +38,7 @@ sv:
38
38
  home:
39
39
  all_products: "Alla produkter"
40
40
  featured: "Utvalda"
41
- featured_categories: "Utvalda kategorier"
41
+ featured_categories: "Handla efter kategori"
42
42
  featured_products: "Utvalda produkter"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ sv:
53
53
  low_inventory: "Begränsat antal"
54
54
  no_products: "Inga produkter hittades"
55
55
  on_sale: "På rea"
56
+ product: "Produkt"
57
+ products: "Produkter"
56
58
  related_products: "Du kanske också gillar"
57
59
  reset: "Återställ"
58
60
  search_results: "Sökresultat"
@@ -38,7 +38,7 @@ tr:
38
38
  home:
39
39
  all_products: "Tüm ürünler"
40
40
  featured: "Öne çıkan"
41
- featured_categories: "Öne çıkan kategoriler"
41
+ featured_categories: "Kategoriye göre alışveriş"
42
42
  featured_products: "Öne çıkan ürünler"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ tr:
53
53
  low_inventory: "Sınırlı sayıda"
54
54
  no_products: "Ürün bulunamadı"
55
55
  on_sale: "İndirimde"
56
+ product: "Ürün"
57
+ products: "Ürünler"
56
58
  related_products: "İlgili ürünler"
57
59
  reset: "Sıfırla"
58
60
  search_results: "Arama sonuçları"
@@ -38,7 +38,7 @@ zh-CN:
38
38
  home:
39
39
  all_products: "所有产品"
40
40
  featured: "精选"
41
- featured_categories: "精选分类"
41
+ featured_categories: "商品分类"
42
42
  featured_products: "精选产品"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ zh-CN:
53
53
  low_inventory: "库存有限"
54
54
  no_products: "未找到产品"
55
55
  on_sale: "特价"
56
+ product: "商品"
57
+ products: "商品"
56
58
  related_products: "相关产品"
57
59
  reset: "重置"
58
60
  search_results: "搜索结果"
@@ -38,7 +38,7 @@ zh-TW:
38
38
  home:
39
39
  all_products: "所有商品"
40
40
  featured: "精選"
41
- featured_categories: "精選分類"
41
+ featured_categories: "商品分類"
42
42
  featured_products: "精選商品"
43
43
  featured_video: ""
44
44
  products:
@@ -53,6 +53,8 @@ zh-TW:
53
53
  low_inventory: "庫存有限"
54
54
  no_products: "未找到商品"
55
55
  on_sale: "特價"
56
+ product: "商品"
57
+ products: "商品"
56
58
  related_products: "相關商品"
57
59
  reset: "重設"
58
60
  search_results: "搜尋結果"
@@ -39,6 +39,13 @@ feature 'Page rendering' do
39
39
  expect(page).to have_content('$10.00')
40
40
  end
41
41
 
42
+ scenario 'password_protected_product.html' do
43
+ visit '/product/password-protected-product'
44
+ expect(page).to have_content('Dugway') # layout.html
45
+ expect(page).to have_selector('[data-testid="page-name-test"]', text: 'Password Protected Product', visible: :all)
46
+ expect(page).to have_content('This product is password protected')
47
+ end
48
+
42
49
  scenario 'cart.html' do
43
50
  visit '/cart'
44
51
  expect(page).to have_content('Dugway') # layout.html
@@ -1 +1 @@
1
- [{"price":10.0,"status":"active","created_at":"2013-02-10T19:28:11-07:00","tax":0.0,"position":1,"artists":[{"permalink":"artist-one","name":"Artist One","id":176141,"url":"/artist/artist-one"}],"shipping":[{"amount_with_others":5.0,"country":{"name":"United States","id":43,"code":"US"},"amount_alone":10.0},{"amount_with_others":10.0,"amount_alone":20.0}],"images":[{"width":475,"height":500,"secure_url":"https://images.bigcartel.com/product_images/92599166/mens_tee_1.jpg","url":"http://images.bigcartel.com/product_images/92599166/mens_tee_1.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599178/mens_tee_2.jpg","url":"http://images.bigcartel.com/product_images/92599178/mens_tee_2.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599196/mens_tee_3.jpg","url":"http://images.bigcartel.com/product_images/92599196/mens_tee_3.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599214/mens_tee_4.jpg","url":"http://images.bigcartel.com/product_images/92599214/mens_tee_4.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599226/mens_tee_5.jpg","url":"http://images.bigcartel.com/product_images/92599226/mens_tee_5.jpg"}],"categories":[{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"on_sale":false,"permalink":"my-product","name":"My Product","default_price":10.0,"id":9422939,"description":"This is a description of my product.","options":[{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Small","id":29474321},{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Medium","id":29474324},{"price":10.0,"sold_out":true,"has_custom_price":false,"name":"Large","id":29474327},{"price":15.0,"sold_out":false,"has_custom_price":true,"name":"X-Large","id":29474330}],"url":"/product/my-product"},{"price":10.0,"status":"active","created_at":"2013-03-02T10:05:34-07:00","tax":0.0,"position":2,"artists":[{"permalink":"artist-two","name":"Artist Two","id":176144,"url":"/artist/artist-two"}],"images":[{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/95272745/mens_tee_8.jpg","url":"http://images.bigcartel.com/product_images/95272745/mens_tee_8.jpg"}],"categories":[{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"on_sale":false,"permalink":"my-tee","name":"My Tee","default_price":10.0,"id":9696017,"description":"This is my cool tee shirt.","options":[{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Small","id":30344519},{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Medium","id":30344522},{"price":15.0,"sold_out":false,"has_custom_price":true,"name":"Large","id":30344525}],"url":"/product/my-tee"},{"price":20.0,"status":"active","created_at":"2013-03-02T10:06:22-07:00","tax":0.0,"position":3,"artists":[],"categories":[{"permalink":"prints","name":"Prints","id":4615190,"url":"/category/prints"}],"on_sale":true,"permalink":"print","name":"Print","default_price":20.0,"id":9696032,"description":"This is my print.","options":[{"price":20.0,"sold_out":false,"has_custom_price":false,"name":"Default","id":30344567}],"url":"/product/print"}]
1
+ [{"price":10.0,"status":"active","created_at":"2013-02-10T19:28:11-07:00","tax":0.0,"position":1,"artists":[{"permalink":"artist-one","name":"Artist One","id":176141,"url":"/artist/artist-one"}],"shipping":[{"amount_with_others":5.0,"country":{"name":"United States","id":43,"code":"US"},"amount_alone":10.0},{"amount_with_others":10.0,"amount_alone":20.0}],"images":[{"width":475,"height":500,"secure_url":"https://images.bigcartel.com/product_images/92599166/mens_tee_1.jpg","url":"http://images.bigcartel.com/product_images/92599166/mens_tee_1.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599178/mens_tee_2.jpg","url":"http://images.bigcartel.com/product_images/92599178/mens_tee_2.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599196/mens_tee_3.jpg","url":"http://images.bigcartel.com/product_images/92599196/mens_tee_3.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599214/mens_tee_4.jpg","url":"http://images.bigcartel.com/product_images/92599214/mens_tee_4.jpg"},{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/92599226/mens_tee_5.jpg","url":"http://images.bigcartel.com/product_images/92599226/mens_tee_5.jpg"}],"categories":[{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"on_sale":false,"permalink":"my-product","name":"My Product","default_price":10.0,"id":9422939,"description":"This is a description of my product.","has_password_protection":false,"options":[{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Small","id":29474321},{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Medium","id":29474324},{"price":10.0,"sold_out":true,"has_custom_price":false,"name":"Large","id":29474327},{"price":15.0,"sold_out":false,"has_custom_price":true,"name":"X-Large","id":29474330}],"url":"/product/my-product"},{"price":10.0,"status":"active","created_at":"2013-03-02T10:05:34-07:00","tax":0.0,"position":2,"artists":[{"permalink":"artist-two","name":"Artist Two","id":176144,"url":"/artist/artist-two"}],"images":[{"width":475,"height":475,"secure_url":"https://images.bigcartel.com/product_images/95272745/mens_tee_8.jpg","url":"http://images.bigcartel.com/product_images/95272745/mens_tee_8.jpg"}],"categories":[{"permalink":"tees","name":"Tees","id":4615193,"url":"/category/tees"}],"on_sale":false,"permalink":"my-tee","name":"My Tee","default_price":10.0,"id":9696017,"description":"This is my cool tee shirt.","has_password_protection":false,"options":[{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Small","id":30344519},{"price":10.0,"sold_out":false,"has_custom_price":false,"name":"Medium","id":30344522},{"price":15.0,"sold_out":false,"has_custom_price":true,"name":"Large","id":30344525}],"url":"/product/my-tee"},{"price":20.0,"status":"active","created_at":"2013-03-02T10:06:22-07:00","tax":0.0,"position":3,"artists":[],"categories":[{"permalink":"prints","name":"Prints","id":4615190,"url":"/category/prints"}],"on_sale":true,"permalink":"print","name":"Print","default_price":20.0,"id":9696032,"description":"This is my print.","has_password_protection":false,"options":[{"price":20.0,"sold_out":false,"has_custom_price":false,"name":"Default","id":30344567}],"url":"/product/print"},{"id":112148040,"name":"Password Protected Product","permalink":"password-protected-product","position":4,"url":"/product/password-protected-product","status":"active","created_at":"2025-02-26T22:21:32.000-06:00","has_password_protection":true}]
@@ -7,7 +7,7 @@ describe Dugway::Cart do
7
7
  let(:product) { store.products.first }
8
8
  let(:product_option) { product['options'].first }
9
9
 
10
- let(:product_2) { store.products.last }
10
+ let(:product_2) { store.products[1] }
11
11
  let(:product_option_2) { product_2['options'].first }
12
12
 
13
13
  describe "#new" do
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Dugway::Drops::CartDrop do
4
- let(:cart) {
4
+ let(:cart) {
5
5
  Dugway::Drops::CartDrop.new(
6
6
  Dugway::Cart.new.tap { |cart|
7
7
  product_option = Dugway.store.products.first['options'].first
8
- product_option_2 = Dugway.store.products.last['options'].first
8
+ product_option_2 = Dugway.store.products[1]['options'].first
9
9
  cart.update(adds: [{ id: product_option['id'] }, { id: product_option_2['id'], quantity: 2 }])
10
10
  }
11
11
  )
@@ -25,13 +25,13 @@ describe Dugway::Drops::CartDrop do
25
25
 
26
26
  describe "#subtotal" do
27
27
  it "should the cart's subtotal" do
28
- cart.subtotal.should == 50.0
28
+ cart.subtotal.should == 30.0
29
29
  end
30
30
  end
31
31
 
32
32
  describe "#total" do
33
33
  it "should the cart's total" do
34
- cart.total.should == 50.0
34
+ cart.total.should == 30.0
35
35
  end
36
36
  end
37
37
 
@@ -259,7 +259,7 @@ describe Dugway::Drops::ProductDrop do
259
259
  it "should return the previous product" do
260
260
  previous_product = product.previous_product
261
261
  previous_product.should be_an_instance_of(Dugway::Drops::ProductDrop)
262
- previous_product.name.should == 'My Tee'
262
+ previous_product.name.should == 'Print'
263
263
  end
264
264
  end
265
265
  end
@@ -319,4 +319,21 @@ describe Dugway::Drops::ProductDrop do
319
319
  product.price_suffix.should == '+ HI'
320
320
  end
321
321
  end
322
+
323
+ describe "#has_password_protection" do
324
+ it "should return the product's has_password_protection value" do
325
+ allow(product.source).to receive(:[]).with('has_password_protection').and_return(true)
326
+ product.has_password_protection.should be(true)
327
+ end
328
+
329
+ it "should return false when has_password_protection is false" do
330
+ allow(product.source).to receive(:[]).with('has_password_protection').and_return(false)
331
+ product.has_password_protection.should be(false)
332
+ end
333
+
334
+ it "should return nil when has_password_protection is not present" do
335
+ allow(product.source).to receive(:[]).with('has_password_protection').and_return(nil)
336
+ product.has_password_protection.should be_nil
337
+ end
338
+ end
322
339
  end
@@ -15,7 +15,7 @@ describe Dugway::Drops::ProductsDrop do
15
15
  it "should return an array of all products" do
16
16
  all = products.all
17
17
  all.should be_an_instance_of(WillPaginate::Collection)
18
- all.size.should == 3
18
+ all.size.should == 4
19
19
 
20
20
  product = all.first
21
21
  product.should be_an_instance_of(Dugway::Drops::ProductDrop)
@@ -27,7 +27,7 @@ describe Dugway::Drops::ProductsDrop do
27
27
  it "should return an array of current products" do
28
28
  current = products.current
29
29
  current.should be_an_instance_of(WillPaginate::Collection)
30
- current.size.should == 3
30
+ current.size.should == 4
31
31
 
32
32
  product = current.first
33
33
  product.should be_an_instance_of(Dugway::Drops::ProductDrop)
@@ -113,7 +113,7 @@ describe Dugway::Store do
113
113
  describe "#products" do
114
114
  it "should return an array of the store's products" do
115
115
  store.products.should be_present
116
- store.products.size.should == 3
116
+ store.products.size.should == 4
117
117
  store.products.first['name'].should == 'My Product'
118
118
  end
119
119
  end
@@ -163,7 +163,7 @@ describe Dugway::Store do
163
163
  describe "#search_products" do
164
164
  it "should return an array of products for that search term" do
165
165
  products = store.search_products('product')
166
- products.size.should == 1
166
+ products.size.should == 2
167
167
  products.first['name'].should == 'My Product'
168
168
  end
169
169
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dugway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Big Cartel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-20 00:00:00.000000000 Z
11
+ date: 2025-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler