Class: PostalApp::Package
- Inherits:
-
Object
- Object
- PostalApp::Package
- Includes:
- HTTParty
- Defined in:
- lib/postal-app/package.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(number) ⇒ Package
constructor
A new instance of Package.
- #method_missing(name, *args, &blk) ⇒ Object
- #profile(force = false) ⇒ Object
Constructor Details
#initialize(number) ⇒ Package
Returns a new instance of Package.
6 7 8 |
# File 'lib/postal-app/package.rb', line 6 def initialize(number) self.number = number end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &blk) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/postal-app/package.rb', line 13 def method_missing(name, *args, &blk) if profile.has_key?(name.to_s) profile[name.to_s] else super end end |
Instance Attribute Details
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/postal-app/package.rb', line 3 def number @number end |
Instance Method Details
#profile(force = false) ⇒ Object
9 10 11 |
# File 'lib/postal-app/package.rb', line 9 def profile(force = false) force ? @profile = get_profile : @profile ||= get_profile end |