Skip to content

Instantly share code, notes, and snippets.

@joevandyk
Created April 26, 2016 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joevandyk/85ccdc88a2052795513e8eef202a6e9f to your computer and use it in GitHub Desktop.
Save joevandyk/85ccdc88a2052795513e8eef202a6e9f to your computer and use it in GitHub Desktop.
module Dino
# Returns true or false on if this sku should be auto tanga expressed.
class ShouldAutoTangaExpress
delegate(:product_id, :tanga_item_id, :product, :tanga_express?, to: :@sku)
def call(sku)
@sku = sku
return development_check? if Rails.env.development?
return true if diamond_studs?
return true if bellechic_products?
return true if brads_deals?
false
end
private
def development_check?
product_id == 40 || product_id == 5
end
def diamond_studs?
# https://app.asana.com/0/181867889056/117163479959037
tanga_item_id == 'UVR8933' && Time.zone.today < Date.new(2016, 4, 28)
end
def bellechic_products?
hardcoded_bellechic_ids = [185880, 185884, 185886, 185885, 185887, 185883, 185888, 185878,
185882, 185881, 185877, 185864, 185863, 185855, 80264]
hardcoded_bellechic_ids.include?(product_id)
end
def brads_deals?
brads_deals_channel_id = 11222
tanga_express? && product.channel_ids.include?(brads_deals_channel_id)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment