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

#request, #to_api_url

Methods included from Symbolize

symbolize, y_combinator

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.to_s
  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