Module: Diffbot::Configurable

Included in:
Diffbot
Defined in:
lib/diffbot_api/configurable.rb

Overview

Configuration options for Diffbot

Constant Summary collapse

DEFAULT_API_ENDPOINT =

Default API endpoint

"http://api.diffbot.com"
DEFAULT_API_VERSION =

Default API version

"v2"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_endpointString

Returns Base URL for API requests. default: api.diffbot.com.

Returns:



18
19
20
# File 'lib/diffbot_api/configurable.rb', line 18

def api_endpoint
  @api_endpoint
end

#api_versionString

Returns Base URL for API requests. default: 2.

Returns:

  • (String)

    Base URL for API requests. default: 2



18
# File 'lib/diffbot_api/configurable.rb', line 18

attr_accessor :api_endpoint, :api_version, :token

#tokenString

Returns Access token for API requests.

Returns:

  • (String)

    Access token for API requests.



18
# File 'lib/diffbot_api/configurable.rb', line 18

attr_accessor :api_endpoint, :api_version, :token

Instance Method Details

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

Set configurable options using a block

Yields:

  • (_self)

Yield Parameters:



21
22
23
# File 'lib/diffbot_api/configurable.rb', line 21

def configure
  yield self
end

#setup!Object

Set configuration options to default values



26
27
28
29
# File 'lib/diffbot_api/configurable.rb', line 26

def setup!
  instance_variable_set(:@api_endpoint, DEFAULT_API_ENDPOINT)
  instance_variable_set(:@api_version, DEFAULT_API_VERSION)
end