Module: VtApi

Defined in:
lib/vt_api/api/config.rb,
lib/vt_api.rb,
lib/vt_api/api/v2.rb,
lib/vt_api/errors.rb,
lib/vt_api/version.rb,
lib/vt_api/api/v2/url.rb,
lib/vt_api/api/v2/file.rb,
lib/vt_api/api/v2/comments.rb,
lib/vt_api/api/v2/essentials.rb,
lib/vt_api/internal/endpoint.rb,
lib/vt_api/internal/api_version.rb,
lib/vt_api/internal/api_provider.rb,
lib/vt_api/internal/versions/api_v2.rb,
lib/vt_api/internal/versions/default.rb

Overview

Author:

  • Karl F. Meinkopf

Defined Under Namespace

Modules: ApiV2, Versions Classes: ApiError, ApiProvider, ApiVersion, Endpoint, MissingParametersError, UndefinedMethodError

Constant Summary collapse

VERSION =
'0.1.3'
DEFAULT_OPTIONS =

Default options for VT API, common for all versions

OpenStruct.new(
	token:   nil,
	adapter: :net_http
)

Class Method Summary collapse

Class Method Details

.configure {|opts| ... } ⇒ Object

Configure VtApi.

Yields:

  • (opts)

    Configuration block.

Yield Parameters:

  • opts

    Options object.

Returns:

  • (Object)

    Block result.



25
26
27
# File 'lib/vt_api/api/config.rb', line 25

def self.configure
	yield options
end

.optionsOpenStruct

Get current options

Returns:

  • (OpenStruct)


16
17
18
# File 'lib/vt_api/api/config.rb', line 16

def self.options
	@options ||= DEFAULT_OPTIONS
end

.token=(token) ⇒ String

Set VtApi token (apikey).

Parameters:

  • token (String)

Returns:

  • (String)

    Token.



33
34
35
# File 'lib/vt_api/api/config.rb', line 33

def self.token=(token)
	options[:token] = token
end