Class: Suitcase::Hotel::Surcharge

Inherits:
Object
  • Object
show all
Defined in:
lib/suitcase/hotel/surcharge.rb

Overview

Public: A Surcharge represents a single surcharge on a Room.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ Surcharge

Internal: Create a new Surcharge.

info - A Hash of parsed info from Surcharge.parse.



8
9
10
# File 'lib/suitcase/hotel/surcharge.rb', line 8

def initialize(info)
  @amount, @type = info[:amount], info[: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.



17
18
19
# File 'lib/suitcase/hotel/surcharge.rb', line 17

def self.parse(info)
  new(amount: info["@amount"], type: info["@type"])
end