dnb-direct-ruby 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dnb/direct/one/content.rb +16 -0
- data/lib/dnb/direct/one/mappings/company.rb +22 -0
- data/lib/dnb/direct/one/models/company.rb +13 -0
- data/lib/dnb/direct/one.rb +1 -1
- data/lib/dnb/direct/plus/content.rb +4 -2
- data/lib/dnb/direct/plus/models/organization.rb +2 -0
- data/lib/dnb/direct/version.rb +1 -1
- data/lib/dnb/direct.rb +19 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd40e7f5776a186418daac09b2549442473f8159
|
4
|
+
data.tar.gz: fe3753e6b6321c44561cd162d55b7a5b88b7727c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5e649ac887c3932156b1c95ce0f53a4119bd1a30329b65efce86d1f09c91cb2a97e26b2ca8814fa57c26c8e95ae5436b110e4ccc228621a8c3f11585412a6e2
|
7
|
+
data.tar.gz: abc616c1743a9cdf9ae0b2cb90a6dc043cd8ab9618b004af09bf34750d01715b00300c9f576ff39d4de6a0fa8f067bb7dc7c1932bf9a2cf5ce319fb22c1dfe34
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class DnB::Direct::One::Content
|
2
|
+
|
3
|
+
def self.company(params = {})
|
4
|
+
start = Time.now
|
5
|
+
puts "== Started company at #{start}" if $LOG_DNB
|
6
|
+
response = DnB::Direct::One.connection.get do |req|
|
7
|
+
req.url "/DnBAPI-17/rest/company/#{params[:duns]}"
|
8
|
+
end
|
9
|
+
puts "== Completed in #{Time.now - start}s" if $LOG_DNB
|
10
|
+
company = DnB::Direct::One::Mappings::Company.extract_single(response.body, :read)
|
11
|
+
company.payload = response.body if company.respond_to? :payload
|
12
|
+
company
|
13
|
+
end # def self.profile_with_linkage
|
14
|
+
|
15
|
+
|
16
|
+
end # class
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class DnB::Direct::One::Mappings::Company < DnB::Direct::Mapping
|
2
|
+
|
3
|
+
kartograph do
|
4
|
+
mapping DnB::Direct::One::Company
|
5
|
+
|
6
|
+
scoped :read do
|
7
|
+
|
8
|
+
# fields
|
9
|
+
property :duns
|
10
|
+
property :name
|
11
|
+
property :parentName
|
12
|
+
property :yearFounded
|
13
|
+
property :fein
|
14
|
+
property :companyType
|
15
|
+
property :legalStatus
|
16
|
+
|
17
|
+
end # scoped :read
|
18
|
+
|
19
|
+
|
20
|
+
end # kartograph
|
21
|
+
|
22
|
+
end # class
|
data/lib/dnb/direct/one.rb
CHANGED
@@ -12,8 +12,10 @@ class DnB::Direct::Plus::Content
|
|
12
12
|
req.url "/v1/data/duns/#{params[:duns]}?productId=cmplnk&versionId=v1"
|
13
13
|
req.headers[:authorization] = "Bearer #{DnB::Direct::Plus.api_token}"
|
14
14
|
end
|
15
|
-
puts "== Completed in #{Time.now - start}s"
|
16
|
-
DnB::Direct::Plus::Mappings::Organization.extract_single(response.body, :read)
|
15
|
+
puts "== Completed in #{Time.now - start}s" if $LOG_DNB
|
16
|
+
org = DnB::Direct::Plus::Mappings::Organization.extract_single(response.body, :read)
|
17
|
+
org.payload = response.body if (!org.nil? && org.respond_to?(:payload))
|
18
|
+
org
|
17
19
|
end # def self.profile_with_linkage
|
18
20
|
|
19
21
|
|
data/lib/dnb/direct/version.rb
CHANGED
data/lib/dnb/direct.rb
CHANGED
@@ -6,11 +6,13 @@ require 'kartograph'
|
|
6
6
|
module DnB
|
7
7
|
module Direct
|
8
8
|
|
9
|
-
#
|
10
|
-
autoload :Plus, 'dnb/direct/plus'
|
9
|
+
# General
|
11
10
|
autoload :Model, 'dnb/direct/model'
|
12
11
|
autoload :Mapping, 'dnb/direct/mapping'
|
13
12
|
|
13
|
+
# Direct+, Direct 1.x, Direct 2.x
|
14
|
+
autoload :Plus, 'dnb/direct/plus'
|
15
|
+
autoload :One, 'dnb/direct/one'
|
14
16
|
class Plus
|
15
17
|
|
16
18
|
## Services
|
@@ -38,6 +40,21 @@ module DnB
|
|
38
40
|
|
39
41
|
end
|
40
42
|
|
43
|
+
|
44
|
+
class One
|
45
|
+
|
46
|
+
## Services
|
47
|
+
autoload :Content, 'dnb/direct/one/content'
|
48
|
+
|
49
|
+
## Models
|
50
|
+
autoload :Company, 'dnb/direct/one/models/company'
|
51
|
+
|
52
|
+
module Mappings
|
53
|
+
autoload :Company, 'dnb/direct/one/mappings/company'
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
41
58
|
# Direct 2.0
|
42
59
|
autoload :Two, 'dnb/direct/two'
|
43
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnb-direct-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Ihaia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -150,6 +150,9 @@ files:
|
|
150
150
|
- lib/dnb/direct/mapping.rb
|
151
151
|
- lib/dnb/direct/model.rb
|
152
152
|
- lib/dnb/direct/one.rb
|
153
|
+
- lib/dnb/direct/one/content.rb
|
154
|
+
- lib/dnb/direct/one/mappings/company.rb
|
155
|
+
- lib/dnb/direct/one/models/company.rb
|
153
156
|
- lib/dnb/direct/plus.rb
|
154
157
|
- lib/dnb/direct/plus/content.rb
|
155
158
|
- lib/dnb/direct/plus/mappings/address.rb
|