Sha256: f326ea5f21a658b50cc1e99133c32972a9619302b52aa9455bced9ebe51d8e0a
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require_relative 'airbnb_api' module Airbnb class RentInfo attr_reader :location attr_reader :infos def initialize(rooms,info) @infos = rooms.map { |item| rooms = room(item) } searchVal(info) end def infos @infos end def self.find(location:) @search_info = {api:ENV['AIRBNB_API'],locate:location} rooms_data = AirbnbApi.rooms_info(location) new(rooms_data,@search_info) end private def room(item) #item = item['listing'] room_id = item['listing']['id'] room = { id: room_id, name: item['listing']['name'], # need to get price from airbnbAPI # Basic Sample Request: # https://api.airbnb.com/v2/listings/5116458?client_id=3092nxybyb0otqw18e8nh5nty&_format=v1_legacy_for_p3 address: item['listing']['public_address'], airbnb_link: "https://www.airbnb.com.tw/rooms/" + room_id.to_s, roomImg: item['listing']['picture_url'], bed: item['listing']['beds'], roomRank: item['listing']['star_rating'] } end def searchVal(oriSearch) @location = oriSearch['locate'] @airbnbapi = oriSearch['api'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
VIAJERO-0.1.74 | lib/VIAJERO/rentInfo.rb |