Class: LabelMe::Order::Recipient
- Inherits:
-
Object
- Object
- LabelMe::Order::Recipient
- Defined in:
- lib/label_me/order/recipient.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#kana ⇒ Object
Returns the value of attribute kana.
-
#labeling ⇒ Object
Returns the value of attribute labeling.
-
#line_items ⇒ Object
Returns the value of attribute line_items.
-
#message_card ⇒ Object
Returns the value of attribute message_card.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#number ⇒ Object
Returns the value of attribute number.
-
#phone_number ⇒ Object
Returns the value of attribute phone_number.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#wished_delivery_date ⇒ Object
Returns the value of attribute wished_delivery_date.
-
#wished_delivery_timezone ⇒ Object
Returns the value of attribute wished_delivery_timezone.
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(row) ⇒ Recipient
constructor
A new instance of Recipient.
- #to_hash ⇒ Object
Constructor Details
#initialize(row) ⇒ Recipient
Returns a new instance of Recipient.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# 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..to_s + " " + row..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 |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
24 25 26 |
# File 'lib/label_me/order/recipient.rb', line 24 def address @address end |
#kana ⇒ Object
Returns the value of attribute kana.
23 24 25 |
# File 'lib/label_me/order/recipient.rb', line 23 def kana @kana end |
#labeling ⇒ Object
Returns the value of attribute labeling.
27 28 29 |
# File 'lib/label_me/order/recipient.rb', line 27 def labeling @labeling end |
#line_items ⇒ Object
Returns the value of attribute line_items.
32 33 34 |
# File 'lib/label_me/order/recipient.rb', line 32 def line_items @line_items end |
#message_card ⇒ Object
Returns the value of attribute message_card.
28 29 30 |
# File 'lib/label_me/order/recipient.rb', line 28 def @message_card end |
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'lib/label_me/order/recipient.rb', line 22 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
29 30 31 |
# File 'lib/label_me/order/recipient.rb', line 29 def notes @notes end |
#number ⇒ Object
Returns the value of attribute number.
21 22 23 |
# File 'lib/label_me/order/recipient.rb', line 21 def number @number end |
#phone_number ⇒ Object
Returns the value of attribute phone_number.
25 26 27 |
# File 'lib/label_me/order/recipient.rb', line 25 def phone_number @phone_number end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
26 27 28 |
# File 'lib/label_me/order/recipient.rb', line 26 def postal_code @postal_code end |
#wished_delivery_date ⇒ Object
Returns the value of attribute wished_delivery_date.
30 31 32 |
# File 'lib/label_me/order/recipient.rb', line 30 def wished_delivery_date @wished_delivery_date end |
#wished_delivery_timezone ⇒ Object
Returns the value of attribute wished_delivery_timezone.
31 32 33 |
# File 'lib/label_me/order/recipient.rb', line 31 def wished_delivery_timezone @wished_delivery_timezone end |
Instance Method Details
#===(other) ⇒ Object
51 52 53 |
# File 'lib/label_me/order/recipient.rb', line 51 def ===(other) self.number == other.number end |
#to_hash ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# 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: , notes: notes, wished_delivery_date: wished_delivery_date, wished_delivery_timezone: wished_delivery_timezone, line_items_attributes: line_items.map(&:to_hash) } end |