Class: Locomotive::Ecommerce::PurchaseDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
app/models/locomotive/ecommerce/purchase.rb

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ PurchaseDrop

Returns a new instance of PurchaseDrop.



151
152
153
# File 'app/models/locomotive/ecommerce/purchase.rb', line 151

def initialize(source)
  @source = source
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



171
172
173
174
175
176
177
# File 'app/models/locomotive/ecommerce/purchase.rb', line 171

def method_missing(meth, *args, &block)
  if @source.shipping_info.key?(meth)
    @source.shipping_info[meth]
  else
    super
  end
end

Instance Method Details

#dateObject



159
160
161
# File 'app/models/locomotive/ecommerce/purchase.rb', line 159

def date
  @source.updated_at
end

#idObject



155
156
157
# File 'app/models/locomotive/ecommerce/purchase.rb', line 155

def id
  @source.id.to_s
end