Class: DiffbotSimple::V2::Custom
- Inherits:
-
Object
- Object
- DiffbotSimple::V2::Custom
- Includes:
- ApiHelper
- Defined in:
- lib/diffbot_simple/v2/custom.rb
Overview
Complies to www.diffbot.com/dev/docs/custom
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name: nil, **options) ⇒ Custom
constructor
A new instance of Custom.
- #post_initialize ⇒ Object
- #single_custom(url: nil, **options) ⇒ Object
Methods included from ApiHelper
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, ** raise ArgumentError.new "Must pass a name for the custom api" unless name @name = name super end |
Instance Attribute Details
#name ⇒ Object (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_initialize ⇒ Object
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, ** raise ArgumentError.new "Must pass an url for the custom api to fetch" unless url execute_call .merge(url: url) end |