Class: DiffbotSimple::V2::CrawlbotApi
- Inherits:
-
Object
- Object
- DiffbotSimple::V2::CrawlbotApi
show all
- Includes:
- ApiHelper
- Defined in:
- lib/diffbot_simple/v2/crawlbot_api.rb
Overview
Instance Method Summary
collapse
Methods included from ApiHelper
#initialize, #request, #to_api_url
Methods included from Symbolize
symbolize, y_combinator
Instance Method Details
#all ⇒ Object
8
9
10
|
# File 'lib/diffbot_simple/v2/crawlbot_api.rb', line 8
def all
execute_call()[:jobs].select { |e| e[:type] == @api.to_s }
end
|
#post_initialize ⇒ Object
5
6
7
|
# File 'lib/diffbot_simple/v2/crawlbot_api.rb', line 5
def post_initialize
@api = :crawl
end
|
#results(url: nil) ⇒ Object
16
17
18
19
20
|
# File 'lib/diffbot_simple/v2/crawlbot_api.rb', line 16
def results url: nil
return [] unless url
response = api_client.get url
symbolize response
end
|
#single(name: nil, **options) ⇒ Object
11
12
13
14
15
|
# File 'lib/diffbot_simple/v2/crawlbot_api.rb', line 11
def single name: nil, **options
response = execute_call options.merge(name: name)
return response[:jobs].select { |e| e[:type] == @api.to_s }.first if response.has_key?(:jobs)
response
end
|