Class: BookingApi::Images::Image
- Inherits:
-
Object
- Object
- BookingApi::Images::Image
- Defined in:
- lib/booking_api/images/image.rb
Instance Attribute Summary collapse
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #hotel_id ⇒ Object
-
#initialize(raw_data = {}) ⇒ Image
constructor
A new instance of Image.
- #is_default_image? ⇒ Boolean
-
#largest_file_url ⇒ Object
returns the largest file url for the image.
- #photo_id ⇒ Object
Constructor Details
#initialize(raw_data = {}) ⇒ Image
Returns a new instance of Image.
7 8 9 |
# File 'lib/booking_api/images/image.rb', line 7 def initialize(raw_data = {}) @raw_data = raw_data.with_indifferent_access end |
Instance Attribute Details
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
5 6 7 |
# File 'lib/booking_api/images/image.rb', line 5 def raw_data @raw_data end |
Instance Method Details
#hotel_id ⇒ Object
11 12 13 |
# File 'lib/booking_api/images/image.rb', line 11 def hotel_id @raw_data[:hotel_id].to_i end |
#is_default_image? ⇒ Boolean
26 27 28 |
# File 'lib/booking_api/images/image.rb', line 26 def is_default_image? @raw_data[:descriptiontype_id].to_i == 10 end |
#largest_file_url ⇒ Object
returns the largest file url for the image
available sizes include: 840x460 and 1280x900
22 23 24 |
# File 'lib/booking_api/images/image.rb', line 22 def largest_file_url @raw_data[:url_original].gsub("max500", "max1280x900") end |
#photo_id ⇒ Object
15 16 17 |
# File 'lib/booking_api/images/image.rb', line 15 def photo_id @raw_data[:photo_id].to_i end |