Class: AwesomeUsps::InternationalItem
- Inherits:
-
Object
- Object
- AwesomeUsps::InternationalItem
- Defined in:
- lib/awesome_usps/international_item.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
(also: #from_country)
readonly
Returns the value of attribute country.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#ounces ⇒ Object
readonly
Returns the value of attribute ounces.
-
#pounds ⇒ Object
readonly
Returns the value of attribute pounds.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#tariff_number ⇒ Object
readonly
Returns the value of attribute tariff_number.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ InternationalItem
constructor
A new instance of InternationalItem.
- #inspect ⇒ Object
- #prettyprint ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ InternationalItem
Returns a new instance of InternationalItem.
16 17 18 19 20 21 22 23 24 |
# File 'lib/awesome_usps/international_item.rb', line 16 def initialize( = {}) @description = [:description] @quantity= [:quantity] @value = [:value] @pounds = [:pounds] @ounces = [:ounces] @tariff_number = [:tariff_number] @country = [:country] end |
Instance Attribute Details
#country ⇒ Object (readonly) Also known as: from_country
Returns the value of attribute country.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def country @country end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def description @description end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def @options end |
#ounces ⇒ Object (readonly)
Returns the value of attribute ounces.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def ounces @ounces end |
#pounds ⇒ Object (readonly)
Returns the value of attribute pounds.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def pounds @pounds end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def quantity @quantity end |
#tariff_number ⇒ Object (readonly)
Returns the value of attribute tariff_number.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def tariff_number @tariff_number end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/awesome_usps/international_item.rb', line 4 def value @value end |
Instance Method Details
#inspect ⇒ Object
37 38 39 40 |
# File 'lib/awesome_usps/international_item.rb', line 37 def inspect string = prettyprint string end |
#prettyprint ⇒ Object
30 31 32 33 34 35 |
# File 'lib/awesome_usps/international_item.rb', line 30 def prettyprint chunks = [] chunks << [@description,@quantity,@value, @tariff_number, @country].reject {|e| e.blank?}.join("\n") chunks << [@pounds,@ounces].reject {|e| e.blank?}.join(', ') chunks.reject {|e| e.blank?}.join("\n") end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/awesome_usps/international_item.rb', line 26 def to_s prettyprint.gsub(/\n/, ' ') end |