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, payment, request) ⇒ CacheKey

Returns a new instance of CacheKey.



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

def initialize(order, shippings, payment, request)
  @order = order
  @shippings = shippings
  @payment = payment
  @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

#paymentObject (readonly)

Returns the value of attribute payment.



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

def payment
  @payment
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



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

def parts
  [
    pricing_key,
    discount_key,
    order_key,
    shipping_service_key,
    payment_key,
    tax_key
  ].compact
end

#to_sObject



26
27
28
# File 'app/models/workarea/pricing/cache_key.rb', line 26

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