Module: SearchApi

Defined in:
lib/searchapi.rb,
lib/searchapi/error.rb,
lib/searchapi/client.rb,
lib/searchapi/version.rb,
lib/searchapi/resource.rb,
lib/searchapi/response.rb,
lib/searchapi/configuration.rb,
lib/searchapi/resources/bing.rb,
lib/searchapi/resources/baidu.rb,
lib/searchapi/resources/naver.rb,
lib/searchapi/resources/yahoo.rb,
lib/searchapi/resources/airbnb.rb,
lib/searchapi/resources/google.rb,
lib/searchapi/resources/yandex.rb,
lib/searchapi/resources/youtube.rb,
lib/searchapi/resources/duckduckgo.rb,
lib/searchapi/resources/bing_images.rb,
lib/searchapi/resources/bing_videos.rb,
lib/searchapi/resources/ebay_search.rb,
lib/searchapi/resources/google_jobs.rb,
lib/searchapi/resources/google_lens.rb,
lib/searchapi/resources/google_maps.rb,
lib/searchapi/resources/google_news.rb,
lib/searchapi/resources/tripadvisor.rb,
lib/searchapi/resources/google_local.rb,
lib/searchapi/resources/shein_search.rb,
lib/searchapi/resources/amazon_search.rb,
lib/searchapi/resources/google_events.rb,
lib/searchapi/resources/google_forums.rb,
lib/searchapi/resources/google_hotels.rb,
lib/searchapi/resources/google_images.rb,
lib/searchapi/resources/google_shorts.rb,
lib/searchapi/resources/google_trends.rb,
lib/searchapi/resources/google_videos.rb,
lib/searchapi/resources/youtube_video.rb,
lib/searchapi/resources/google_ai_mode.rb,
lib/searchapi/resources/google_finance.rb,
lib/searchapi/resources/google_flights.rb,
lib/searchapi/resources/google_patents.rb,
lib/searchapi/resources/google_scholar.rb,
lib/searchapi/resources/tiktok_profile.rb,
lib/searchapi/resources/walmart_search.rb,
lib/searchapi/resources/airbnb_property.rb,
lib/searchapi/resources/apple_app_store.rb,
lib/searchapi/resources/google_shopping.rb,
lib/searchapi/resources/meta_ad_library.rb,
lib/searchapi/resources/youtube_channel.rb,
lib/searchapi/resources/google_locations.rb,
lib/searchapi/resources/youtube_comments.rb,
lib/searchapi/resources/google_maps_place.rb,
lib/searchapi/resources/google_play_store.rb,
lib/searchapi/resources/instagram_profile.rb,
lib/searchapi/resources/reddit_ad_library.rb,
lib/searchapi/resources/google_ai_overview.rb,
lib/searchapi/resources/tiktok_ads_library.rb,
lib/searchapi/resources/google_autocomplete.rb,
lib/searchapi/resources/google_maps_reviews.rb,
lib/searchapi/resources/linkedin_ad_library.rb,
lib/searchapi/resources/youtube_transcripts.rb,
lib/searchapi/resources/google_rank_tracking.rb,
lib/searchapi/resources/yandex_reverse_image.rb,
lib/searchapi/resources/facebook_business_page.rb,
lib/searchapi/resources/youtube_channel_videos.rb,
lib/searchapi/resources/airbnb_property_reviews.rb,
lib/searchapi/resources/google_about_this_domain.rb,
lib/searchapi/resources/meta_ad_library_page_info.rb,
lib/searchapi/resources/meta_ad_library_ad_details.rb,
lib/searchapi/resources/meta_ad_library_page_search.rb,
lib/searchapi/resources/google_ads_transparency_center.rb,
lib/searchapi/resources/tiktok_ads_library_advertiser_search.rb

Defined Under Namespace

Modules: Resources Classes: AuthenticationError, Client, Configuration, Error, NotFoundError, RateLimitError, Resource, Response, ServerError, TimeoutError, ValidationError

Constant Summary collapse

RESOURCES =

Registry mapping accessor names to resource classes.

{
  # Google engines
  google: Resources::Google,
  google_rank_tracking: Resources::GoogleRankTracking,
  google_events: Resources::GoogleEvents,
  google_maps: Resources::GoogleMaps,
  google_maps_place: Resources::GoogleMapsPlace,
  google_maps_reviews: Resources::GoogleMapsReviews,
  google_scholar: Resources::GoogleScholar,
  google_news: Resources::GoogleNews,
  google_jobs: Resources::GoogleJobs,
  google_shopping: Resources::GoogleShopping,
  google_flights: Resources::GoogleFlights,
  google_images: Resources::GoogleImages,
  google_videos: Resources::GoogleVideos,
  google_trends: Resources::GoogleTrends,
  google_autocomplete: Resources::GoogleAutocomplete,
  google_finance: Resources::GoogleFinance,
  google_hotels: Resources::GoogleHotels,
  google_about_this_domain: Resources::GoogleAboutThisDomain,
  google_ai_mode: Resources::GoogleAiMode,
  google_ads_transparency_center: Resources::GoogleAdsTransparencyCenter,
  google_local: Resources::GoogleLocal,
  google_shorts: Resources::GoogleShorts,
  google_lens: Resources::GoogleLens,
  google_forums: Resources::GoogleForums,
  google_patents: Resources::GooglePatents,
  google_ai_overview: Resources::GoogleAiOverview,
  google_play_store: Resources::GooglePlayStore,
  google_locations: Resources::GoogleLocations,

  # Other search engines
  amazon_search: Resources::AmazonSearch,
  bing: Resources::Bing,
  bing_images: Resources::BingImages,
  bing_videos: Resources::BingVideos,
  baidu: Resources::Baidu,
  yandex: Resources::Yandex,
  yandex_reverse_image: Resources::YandexReverseImage,
  duckduckgo: Resources::DuckDuckGo,
  yahoo: Resources::Yahoo,
  naver: Resources::Naver,
  youtube: Resources::YouTube,
  youtube_transcripts: Resources::YouTubeTranscripts,
  youtube_video: Resources::YouTubeVideo,
  youtube_comments: Resources::YouTubeComments,
  youtube_channel: Resources::YouTubeChannel,
  youtube_channel_videos: Resources::YouTubeChannelVideos,

  # App stores
  apple_app_store: Resources::AppleAppStore,

  # E-commerce
  walmart_search: Resources::WalmartSearch,
  shein_search: Resources::SheinSearch,
  ebay_search: Resources::EbaySearch,

  # Travel & hospitality
  airbnb: Resources::Airbnb,
  airbnb_property: Resources::AirbnbProperty,
  airbnb_property_reviews: Resources::AirbnbPropertyReviews,
  tripadvisor: Resources::TripAdvisor,

  # Social media profiles
  instagram_profile: Resources::InstagramProfile,
  tiktok_profile: Resources::TiktokProfile,
  facebook_business_page: Resources::FacebookBusinessPage,

  # Ad libraries
  linkedin_ad_library: Resources::LinkedinAdLibrary,
  reddit_ad_library: Resources::RedditAdLibrary,
  meta_ad_library: Resources::MetaAdLibrary,
  meta_ad_library_page_search: Resources::MetaAdLibraryPageSearch,
  meta_ad_library_ad_details: Resources::MetaAdLibraryAdDetails,
  meta_ad_library_page_info: Resources::MetaAdLibraryPageInfo,
  tiktok_ads_library: Resources::TiktokAdsLibrary,
  tiktok_ads_library_advertiser_search: Resources::TiktokAdsLibraryAdvertiserSearch
}.freeze
VERSION =
"1.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configuration ⇒ Object



171
172
173
# File 'lib/searchapi.rb', line 171

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.client ⇒ Object



179
180
181
# File 'lib/searchapi.rb', line 179

def client
  @client ||= Client.new(configuration)
end

.configure {|configuration| ... } ⇒ Object

Yields:



175
176
177
# File 'lib/searchapi.rb', line 175

def configure
  yield(configuration)
end

.method_missing(name, *args, &block) ⇒ Object



193
194
195
196
197
198
199
# File 'lib/searchapi.rb', line 193

def method_missing(name, *args, &block)
  if RESOURCES.key?(name)
    resources[name] ||= RESOURCES[name].new(client)
  else
    super
  end
end

.reset! ⇒ Object



183
184
185
186
187
# File 'lib/searchapi.rb', line 183

def reset!
  @configuration = nil
  @client = nil
  @resources = nil
end

.resources ⇒ Object



189
190
191
# File 'lib/searchapi.rb', line 189

def resources
  @resources ||= {}
end

.respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


201
202
203
# File 'lib/searchapi.rb', line 201

def respond_to_missing?(name, include_private = false)
  RESOURCES.key?(name) || super
end