Module: Diffbot

Defined in:
lib/diffbot.rb,
lib/diffbot/item.rb,
lib/diffbot/article.rb,
lib/diffbot/request.rb,
lib/diffbot/frontpage.rb,
lib/diffbot/coercible_hash.rb

Defined Under Namespace

Modules: CoercibleHash Classes: Article, Frontpage, Item, Request

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.instrumentorObject

Public: The object used for network instrumentation. Must match ActiveSupport::Notifications API.



52
53
54
# File 'lib/diffbot.rb', line 52

def instrumentor
  @instrumentor
end

.tokenObject

Public: Your Diffbot API token.



48
49
50
# File 'lib/diffbot.rb', line 48

def token
  @token
end

Class Method Details

.article_defaultsObject

Public: Configure the default request parameters for Article requests. See Article::RequestParams documentation for the specific configuration values you can set.

Yields the default Article::RequestParams object.

Returns the default Article::RequestParams object.



26
27
28
29
30
31
32
33
34
35
# File 'lib/diffbot.rb', line 26

def self.article_defaults
  if block_given?
    @article_defaults = Article::RequestParams.new
    yield @article_defaults
  else
    @article_defaults ||= Article::RequestParams.new
  end

  @article_defaults
end

.configure {|_self| ... } ⇒ Object

Public: Set global options. This is a nice API to group calls to the Diffbot module.

Yields the Diffbot module so you can set options on it.

Returns self.

Yields:

  • (_self)

Yield Parameters:

  • _self (Diffbot)

    the object that the method was called on



14
15
16
17
# File 'lib/diffbot.rb', line 14

def self.configure
  yield self
  self
end

.reset!Object

Public: Reset the configuration to the defaults. Useful for testing.

Returns nil.



40
41
42
43
44
# File 'lib/diffbot.rb', line 40

def self.reset!
  @article_defaults = nil
  @token = nil
  @instrumentor = nil
end