Class: DnB::Direct::Plus::Content

Inherits:
Object
  • Object
show all
Defined in:
lib/dnb/direct/plus/content.rb

Class Method Summary collapse

Class Method Details

.plus_executives(params = {}) ⇒ Object

Converts the object into textual markup given a specific ‘format` (defaults to `:html`)

Parameters:

format

A Symbol declaring the format to convert the object to. This can be ‘:text` or `:html`.

Returns:

A string representing the object in a specified format.



32
33
34
35
36
37
38
39
# File 'lib/dnb/direct/plus/content.rb', line 32

def self.plus_executives(params = {})
    response = DnB::Direct::Plus.connection.get do |req|
        req.url "/v1/data/duns/#{params[:duns]}?productId=cmpelk&versionId=v1"
        req.headers[:authorization] = "Bearer #{DnB::Direct::Plus.api_token}"
    end

    JSON.parse(response.body)
end

.profile_with_linkage(params = {}) ⇒ Object

This service is the most efficient way to gain basic marketing information about an existing customer or potential prospect such as business name, address, D&B® D-U-N-S® Number, phone and trade style. Includes business intelligence such as senior executive name, activities, sales, number of employees and owners.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dnb/direct/plus/content.rb', line 7

def self.profile_with_linkage(params = {})
    start = Time.now
    puts "== Started profile_with_linkage at #{start}" if $LOG_DNB
    response = DnB::Direct::Plus.connection.get do |req|
        req.url "/v1/data/duns/#{params[:duns]}?productId=cmplnk&versionId=v1"
        req.headers[:authorization] = "Bearer #{DnB::Direct::Plus.api_token}"
    end
    puts "== Completed in #{Time.now - start}s" if $LOG_DNB
    org = DnB::Direct::Plus::Mappings::Organization.extract_single(response.body, :read)
    org.payload = response.body if !org.nil? && org.respond_to?(:payload)
    org
end