Class: Suitcase::Hotel::Surcharge
- Inherits:
-
Object
- Object
- Suitcase::Hotel::Surcharge
- Defined in:
- lib/suitcase/hotel/surcharge.rb
Overview
Public: A Surcharge represents a single surcharge on a Room.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
-
.parse(info) ⇒ Object
Internal: Parse a Surcharge from the room response.
Instance Method Summary collapse
-
#initialize(info) ⇒ Surcharge
constructor
Internal: Create a new Surcharge.
Constructor Details
#initialize(info) ⇒ Surcharge
Internal: Create a new Surcharge.
info - A Hash of parsed info from Surcharge.parse.
9 10 11 |
# File 'lib/suitcase/hotel/surcharge.rb', line 9 def initialize(info) @amount, @type = info[:amount], info[:type] end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/suitcase/hotel/surcharge.rb', line 5 def amount @amount end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/suitcase/hotel/surcharge.rb', line 5 def type @type end |
Class Method Details
.parse(info) ⇒ Object
Internal: Parse a Surcharge from the room response.
info - A Hash of the parsed JSON relevant to the surhcarge.
Returns a Surcharge representing the info.
18 19 20 |
# File 'lib/suitcase/hotel/surcharge.rb', line 18 def self.parse(info) new(amount: info["@amount"], type: info["@type"]) end |