class LabelMe::Order

Attributes

customer[RW]
message_card_charge[RW]
number[RW]
order_date[RW]
recipients[RW]
shipping_charge[RW]

Public Class Methods

new(row) click to toggle source
# File lib/label_me/order.rb, line 6
def initialize(row)
  @number              = row.order_id.to_i
  @order_date          = row.order_date
  @paid                = row.paid?
  @shipping_charge     = row.total_shipping_charge
  @message_card_charge = row.total_message_card_charge
  @customer            = LabelMe::Order::Customer.new(row)
  @recipients          = [LabelMe::Order::Recipient.new(row)]
end

Public Instance Methods

===(other) click to toggle source
# File lib/label_me/order.rb, line 39
def ===(other)
  self.number == other.number
end
paid?() click to toggle source
to_hash() click to toggle source
# File lib/label_me/order.rb, line 27
def to_hash
  {
    number:                number,
    order_date:            order_date,
    paid:                 paid?,
    shipping_charge:       shipping_charge,
    message_card_charge:   message_card_charge,
    customer_attributes:   customer.to_hash,
    recipients_attributes: recipients.map(&:to_hash),
  }
end