Class: DnB::Direct::One

Inherits:
Object
  • Object
show all
Defined in:
lib/dnb/direct.rb,
lib/dnb/direct/one.rb

Defined Under Namespace

Modules: Mappings Classes: Company, Content

Constant Summary collapse

BASE_URL =
'http://dnbdirect-api.dnb.com'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_base_urlObject

Returns the value of attribute api_base_url.



9
10
11
# File 'lib/dnb/direct/one.rb', line 9

def api_base_url
  @api_base_url
end

.api_keyObject

Returns the value of attribute api_key.



9
10
11
# File 'lib/dnb/direct/one.rb', line 9

def api_key
  @api_key
end

.api_secretObject

Returns the value of attribute api_secret.



9
10
11
# File 'lib/dnb/direct/one.rb', line 9

def api_secret
  @api_secret
end

.connObject

Returns the value of attribute conn.



9
10
11
# File 'lib/dnb/direct/one.rb', line 9

def conn
  @conn
end

.tokenObject

Returns the value of attribute token.



9
10
11
# File 'lib/dnb/direct/one.rb', line 9

def token
  @token
end

Class Method Details

.connectionObject



18
19
20
21
22
23
24
# File 'lib/dnb/direct/one.rb', line 18

def connection
    @conn ||= Faraday.new(connection_options) do |faraday|
        faraday.request :url_encoded # form-encode POST params
        faraday.response(:logger) if $LOG_DNB
        faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
    end
end

.use_credentials(username, password, key) ⇒ Object



11
12
13
14
15
# File 'lib/dnb/direct/one.rb', line 11

def use_credentials username, password, key
  @api_username = username
  @api_password = password
  @api_key = key
end