class Omniorder::ImportStrategy::Base

Attributes

import[RW]
options[W]

Public Class Methods

after_build_order(&block) click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 24
def after_build_order(&block)
  if block_given?
    @after_build_order_block = block
  end
end
after_build_order_block() click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 30
def after_build_order_block
  @after_build_order_block
end
clear_options() click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 16
def clear_options
  @options = nil
end
from_name(name) click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 20
def from_name(name)
  Utils.constantize "Omniorder::ImportStrategy::#{Utils.camelize name}"
end
new(import, options = {}) click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 35
def initialize(import, options = {})
  self.import = import
  self.options = options
end
options(options = nil) click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 8
def options(options = nil)
  if options
    @options = options
  else
    @options || {}
  end
end

Public Instance Methods

after_import() click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 49
def after_import

end
before_import() click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 45
def before_import

end
options() click to toggle source

Combines global and local options

# File lib/omniorder/import_strategy/base.rb, line 41
def options
  self.class.options.merge(@options)
end

Private Instance Methods

after_build_order(order, order_info) click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 63
def after_build_order(order, order_info)
  if self.class.after_build_order_block
    self.class.after_build_order_block.call(order, order_info)
  end

  order
end
customer_country_or_default(country) click to toggle source
# File lib/omniorder/import_strategy/base.rb, line 55
def customer_country_or_default(country)
  if country.nil? || country.empty?
    Omniorder.default_customer_country
  else
    country
  end
end