class LabelMe::Order::Recipient

Attributes

address[RW]
kana[RW]
labeling[RW]
line_items[RW]
message_card[RW]
name[RW]
notes[RW]
number[RW]
phone_number[RW]
postal_code[RW]
wished_delivery_date[RW]
wished_delivery_timezone[RW]

Public Class Methods

new(row) click to toggle source
# File lib/label_me/order/recipient.rb, line 6
def initialize(row)
  @number       = row.recipient_id.to_i
  @name         = row.recipient_name
  @kana         = row.recipient_kana
  @address      = row.recipient_address
  @phone_number = row.recipient_phone_number
  @postal_code  = row.recipient_postal_code
  @labeling     = row.recipient_labeling
  @message_card = row.recipient_message_card_type.to_s +  " " + row.recipient_message_card_body.to_s
  @notes        = row.recipient_notes
  @wished_delivery_date     = row.wished_delivery_date
  @wished_delivery_timezone = row.wished_delivery_timezone
  @line_items   = [LabelMe::Order::LineItem.new(row)]
end

Public Instance Methods

===(other) click to toggle source
# File lib/label_me/order/recipient.rb, line 51
def ===(other)
  self.number == other.number
end
to_hash() click to toggle source
# File lib/label_me/order/recipient.rb, line 34
def to_hash
  {
    number:       number,
    name:         name,
    kana:         kana,
    address:      address,
    phone_number: phone_number,
    postal_code:  postal_code,
    labeling:     labeling,
    message_card: message_card,
    notes:        notes,
    wished_delivery_date:     wished_delivery_date,
    wished_delivery_timezone: wished_delivery_timezone,
    line_items_attributes: line_items.map(&:to_hash)
  }
end