Class: Workarea::Pricing::CacheKey

Inherits:
Object
  • Object
show all
Defined in:
app/models/workarea/pricing/cache_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order, shippings, request) ⇒ CacheKey

Returns a new instance of CacheKey.



8
9
10
11
12
# File 'app/models/workarea/pricing/cache_key.rb', line 8

def initialize(order, shippings, request)
  @order = order
  @shippings = shippings
  @request = request
end

Instance Attribute Details

#orderObject

Returns the value of attribute order.



5
6
7
# File 'app/models/workarea/pricing/cache_key.rb', line 5

def order
  @order
end

#shippingsObject (readonly)

Returns the value of attribute shippings.



4
5
6
# File 'app/models/workarea/pricing/cache_key.rb', line 4

def shippings
  @shippings
end

Instance Method Details

#partsObject



14
15
16
17
18
19
20
21
22
# File 'app/models/workarea/pricing/cache_key.rb', line 14

def parts
  [
    pricing_key,
    discount_key,
    order_key,
    shipping_service_key,
    tax_key
  ]
end

#to_sObject



24
25
26
# File 'app/models/workarea/pricing/cache_key.rb', line 24

def to_s
  Digest::SHA1.hexdigest(parts.join('/'))
end