Module: Shoppe::Easypost

Defined in:
lib/shoppe/easypost.rb,
lib/shoppe/easypost/engine.rb,
lib/shoppe/easypost/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.api_keyObject



26
27
28
# File 'lib/shoppe/easypost.rb', line 26

def api_key
  Shoppe.settings.easypost_api_key
end

.create_shipment(to_address, parcel) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/shoppe/easypost.rb', line 30

def create_shipment(to_address, parcel)
  EasyPost.api_key = self.api_key

  EasyPost::Shipment.create(
    {
      to_address: to_address,
      from_address: {company: Shoppe.settings.store_name,
                     street1: Shoppe.settings.from_street_1,
                     street2: Shoppe.settings.from_street_2,
                     city: Shoppe.settings.from_city,
                     state: Shoppe.settings.from_state,
                     zip: Shoppe.settings.from_zipcode,
                     phone: Shoppe.settings.from_phone},
      parcel: parcel
    }
  )
end

.setupObject

def easypost_delivery_service_prices(shipment)

if delivery_required?
end

end



79
80
81
82
83
84
85
86
# File 'lib/shoppe/easypost.rb', line 79

def setup
  # Setup configuration with API key. Shipping options separated by commas.
  Shoppe.add_settings_group :easypost, [:easypost_api_key, :handling_cost, :from_street_1, :from_street_2, :from_city, :from_state, :from_zipcode, :from_phone]

  Shoppe::Order.before_confirmation do

  end
end