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.

Instance Attribute Summary collapse

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.



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

def initialize(info)
  @amount, @type = info[:amount], info[:type]
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



5
6
7
# File 'lib/suitcase/hotel/surcharge.rb', line 5

def amount
  @amount
end

#typeObject

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