Class: Workarea::Shipping::Address

Inherits:
Address
  • Object
show all
Defined in:
app/models/workarea/shipping/address.rb

Constant Summary

Constants inherited from Address

Address::ATTRIBUTES_FOR_LENGTH_VALIDATION

Instance Method Summary collapse

Methods inherited from Address

#address_eql?, #as_json, #country=, #phone_number=, #po_box?, #region_name

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list

Methods included from Mongoid::Document

#embedded_children

Instance Method Details

#allow_po_box?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/workarea/shipping/address.rb', line 17

def allow_po_box?
  Workarea.config.allow_shipping_address_po_box
end

#resetObject



4
5
6
# File 'app/models/workarea/shipping/address.rb', line 4

def reset
  Workarea.config.address_attributes.each { |name| send("#{name}=", nil) }
end

#to_active_shippingObject



8
9
10
11
12
13
14
15
# File 'app/models/workarea/shipping/address.rb', line 8

def to_active_shipping
  ActiveShipping::Location.new(
    country: country.alpha2,
    state: region,
    city: city,
    zip: postal_code
  )
end