Class: BookingApi::Images::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/booking_api/images/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dataObject (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_idObject



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

Returns:

  • (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_urlObject

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_idObject



15
16
17
# File 'lib/booking_api/images/image.rb', line 15

def photo_id
  @raw_data[:photo_id].to_i
end