Class: VNCPostAPI::Order

Inherits:
Base
  • Object
show all
Defined in:
lib/vncpost_api/resources/order.rb

Constant Summary collapse

DEFAULT_ATTRS =
{
  code: nil,
  product_name: "Fashion Apparel",
  collect_amount: 0,
  journey_type: 1,
  service_id: 12490,
  weight: 0,
  width: 0,
  height: 0,
  length: 0,
  note: nil,
  source_address: nil,
  source_city: nil,
  source_district: nil,
  source_ward: nil,
  source_name: nil,
  source_phone_number: nil,
  dest_address: nil,
  dest_city: nil,
  dest_district: nil,
  dest_ward: nil,
  dest_name: nil,
  dest_phone_number: nil,
  return_address: nil,
  return_city: nil,
  return_district: nil,
  return_ward: nil,
  return_name: nil,
  return_phone_number: nil
}

Instance Method Summary collapse

Methods inherited from Base

#build, #create, #update

Constructor Details

#initialize(attributes = {}, persisted = false) ⇒ Order

Returns a new instance of Order.



50
51
52
53
# File 'lib/vncpost_api/resources/order.rb', line 50

def initialize(attributes = {}, persisted = false)
  attributes = DEFAULT_ATTRS.merge(attributes)
  super
end

Instance Method Details

#trackObject



55
56
57
58
# File 'lib/vncpost_api/resources/order.rb', line 55

def track
  tracking_number = @attributes[:returned_code] || @attributes[:code]
  Tracking.find(tracking_number)
end