Class: Nineflats::Booking
Instance Attribute Summary collapse
-
#checkin_date ⇒ Object
Returns the value of attribute checkin_date.
-
#checkout_date ⇒ Object
Returns the value of attribute checkout_date.
-
#host ⇒ Object
Returns the value of attribute host.
-
#links ⇒ Object
Returns the value of attribute links.
-
#nights ⇒ Object
Returns the value of attribute nights.
-
#number_of_guests ⇒ Object
Returns the value of attribute number_of_guests.
-
#place ⇒ Object
Returns the value of attribute place.
-
#status ⇒ Object
Returns the value of attribute status.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(json) ⇒ Booking
constructor
A new instance of Booking.
Methods inherited from Base
client_app_key, client_app_key=, object_link
Constructor Details
#initialize(json) ⇒ Booking
Returns a new instance of Booking.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nineflats-api/booking.rb', line 7 def initialize(json) @raw_data = json booking = json.first[1] @checkin_date = booking["checkin_date"] @checkout_date = booking["checkout_date"] @nights = booking["nights"] @number_of_guests = booking["number_of_guests"] @status = booking["status"] @host = User.new({"user" => booking["host"]}) @place = Place.new({"place" => booking["place"]}) @links = {} booking['links'].each do |link| @links[link['rel']] = link['href'] end end |
Instance Attribute Details
#checkin_date ⇒ Object
Returns the value of attribute checkin_date.
4 5 6 |
# File 'lib/nineflats-api/booking.rb', line 4 def checkin_date @checkin_date end |
#checkout_date ⇒ Object
Returns the value of attribute checkout_date.
4 5 6 |
# File 'lib/nineflats-api/booking.rb', line 4 def checkout_date @checkout_date end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/nineflats-api/booking.rb', line 5 def host @host end |
#links ⇒ Object
Returns the value of attribute links.
5 6 7 |
# File 'lib/nineflats-api/booking.rb', line 5 def links @links end |
#nights ⇒ Object
Returns the value of attribute nights.
4 5 6 |
# File 'lib/nineflats-api/booking.rb', line 4 def nights @nights end |
#number_of_guests ⇒ Object
Returns the value of attribute number_of_guests.
4 5 6 |
# File 'lib/nineflats-api/booking.rb', line 4 def number_of_guests @number_of_guests end |
#place ⇒ Object
Returns the value of attribute place.
5 6 7 |
# File 'lib/nineflats-api/booking.rb', line 5 def place @place end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/nineflats-api/booking.rb', line 4 def status @status end |