class Airbnb::AirbnbApi
Service for all Airbnb
API calls
Constants
- API_VER
- Airbnb_API_URL
- Airbnb_URL
Setting the URL and parameters
- Price_URL
- Search_URL
Public Class Methods
config()
click to toggle source
# File lib/Time_Traveler/airbnb_api.rb, line 17 def self.config return @config if @config @config = { airbnb_id: ENV['AIRBNB_API'] } end
config=(credentials)
click to toggle source
# File lib/Time_Traveler/airbnb_api.rb, line 13 def self.config=(credentials) @config ? @config.update(credentials) : @config = credentials end
rooms_info(location)
click to toggle source
# File lib/Time_Traveler/airbnb_api.rb, line 22 def self.rooms_info(location) rooms_response = HTTP.get(Search_URL, params: { client_id: config[:airbnb_id], location: location }) roomsinfo = JSON.load(rooms_response.to_s)['search_results'] end