Class: DnB::Direct::One::Content

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

Class Method Summary collapse

Class Method Details

.company(params = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/dnb/direct/one/content.rb', line 3

def self.company(params = {})
  start = Time.now
  puts "== Started company at #{start}" if $LOG_DNB
    response = DnB::Direct::One.connection.get do |req|
        req.url "/DnBAPI-17/rest/company/#{params[:duns]}"
    end
    puts "== Completed in #{Time.now - start}s" if $LOG_DNB
    company = DnB::Direct::One::Mappings::Company.extract_single(response.body, :read)
    company.payload = response.body if company.respond_to? :payload
    company
end