class Airbnb::Base

Constants

URL

Public Class Methods

get(endpoint, params = {params: {}}) click to toggle source
# File lib/airbnb/base.rb, line 9
def get(endpoint, params = {params: {}})
  params[:params][:client_id] = client_id
  HTTP.get(endpoint, params)
end
post(endpoint, params) click to toggle source
# File lib/airbnb/base.rb, line 14
def post(endpoint, params)
  params[:form][:client_id] = client_id
  HTTP.post(endpoint, params)
end

Private Class Methods

client_id() click to toggle source
# File lib/airbnb/base.rb, line 21
def client_id
  @@client_id ||= JSON.parse(
    Mechanize.new.get("https://www.airbnb.com").search(:meta).select{|e| e['id'] == '_bootstrap-layout-init'}.first.get_attribute(:content)
  )['api_config']['key']
end