Class: RussianPost::Parcel
- Inherits:
-
Object
- Object
- RussianPost::Parcel
- Defined in:
- lib/russianpost/parcel.rb
Instance Attribute Summary collapse
-
#barcode ⇒ Object
readonly
Returns the value of attribute barcode.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(barcode, opts = {}) ⇒ Parcel
constructor
A new instance of Parcel.
- #location ⇒ Object
- #mass ⇒ Object
- #operations ⇒ Object
- #rank ⇒ Object
- #recipient ⇒ Object
- #type ⇒ Object
Constructor Details
Instance Attribute Details
#barcode ⇒ Object (readonly)
Returns the value of attribute barcode.
7 8 9 |
# File 'lib/russianpost/parcel.rb', line 7 def @barcode end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/russianpost/parcel.rb', line 7 def client @client end |
Instance Method Details
#location ⇒ Object
18 19 20 |
# File 'lib/russianpost/parcel.rb', line 18 def location operations.last.operation_address unless operations.empty? end |
#mass ⇒ Object
22 23 24 |
# File 'lib/russianpost/parcel.rb', line 22 def mass operations.map{ |o| o.mass }.max end |
#operations ⇒ Object
14 15 16 |
# File 'lib/russianpost/parcel.rb', line 14 def operations @operations ||= fetch_operations end |
#rank ⇒ Object
26 27 28 |
# File 'lib/russianpost/parcel.rb', line 26 def rank operations.map{ |o| o.mail_rank }.compact.last end |
#recipient ⇒ Object
30 31 32 |
# File 'lib/russianpost/parcel.rb', line 30 def recipient operations.map{ |o| o.rcpn }.compact.last end |
#type ⇒ Object
34 35 36 |
# File 'lib/russianpost/parcel.rb', line 34 def type operations.last.mail_type unless operations.empty? end |