class Bliss::Client::Style

Public Instance Methods

discounted?(currency) click to toggle source

@return [Boolean] whether this style is sold for a reduced price for

the currency

@param [Symbol] currency either :eur or :chf, can also be strings

e.g. 'CHF'
# File lib/bliss/client/style.rb, line 66
def discounted?(currency)
  prices_for_currency(currency).fetch('current_price_rank').to_i > 1
end
original_purchase_price(currency) click to toggle source

@return [BigDecimal] the first unreduced price stores paid to purchase

this style from NILE

@param [Symbol] currency either :eur or :chf, can also be strings

e.g. 'CHF'
# File lib/bliss/client/style.rb, line 46
def original_purchase_price(currency)
  BigDecimal.new prices_for_currency(currency).
    fetch('first_purchase_price')
end
original_sales_price(currency) click to toggle source

@return [BigDecimal] the first unreduced price customers paid to purchase

this style from a store/webshop

@param [Symbol] currency either :eur or :chf, can also be strings

e.g. 'CHF'
# File lib/bliss/client/style.rb, line 56
def original_sales_price(currency)
  BigDecimal.new prices_for_currency(currency).
    fetch('first_sales_price')
end
purchase_price(currency) click to toggle source

@return [BigDecimal] the current purchase (aka wholesale) price, i.e.

the price the stores pay to buy this style from NILE

@param [Symbol] currency either :eur or :chf, can also be strings

e.g. 'CHF'
# File lib/bliss/client/style.rb, line 26
def purchase_price(currency)
  BigDecimal.new prices_for_currency(currency).
    fetch('current_purchase_price')
end
sales_price(currency) click to toggle source

@return [BigDecimal] the current sales (aka retail) price, i.e. the

price the customers pay to buy this style from a store/webshop

@param [Symbol] currency either :eur or :chf, can also be strings

e.g. 'CHF'
# File lib/bliss/client/style.rb, line 36
def sales_price(currency)
  BigDecimal.new prices_for_currency(currency).
    fetch('current_sales_price')
end

Private Instance Methods

prices_for_currency(currency) click to toggle source
# File lib/bliss/client/style.rb, line 72
def prices_for_currency(currency)
  prices.fetch(currency.to_s.upcase)
end