Class: DiffbotSimple::V2::Custom

Inherits:
Object
  • Object
show all
Includes:
ApiHelper
Defined in:
lib/diffbot_simple/v2/custom.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ApiHelper

#to_crawl_api_url

Constructor Details

#initialize(name: nil, **options) ⇒ Custom

Returns a new instance of Custom.



6
7
8
9
10
# File 'lib/diffbot_simple/v2/custom.rb', line 6

def initialize name: nil, **options
  raise ArgumentError.new "Must pass a name for the custom api" unless name
  @name = name
  super options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/diffbot_simple/v2/custom.rb', line 5

def name
  @name
end

Instance Method Details

#post_initializeObject



11
12
13
# File 'lib/diffbot_simple/v2/custom.rb', line 11

def post_initialize
  @api = "api/#{CGI::escape(name)}"
end

#single_custom(url: nil, **options) ⇒ Object



14
15
16
17
# File 'lib/diffbot_simple/v2/custom.rb', line 14

def single_custom url: nil, **options
  raise ArgumentError.new "Must pass an url for the custom api to fetch" unless url
  execute_call options.merge(url: url)
end