dnb-direct-ruby 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb5fbbbb28197765ad5c80d8160bad130bac6a6a
4
- data.tar.gz: 59b04fe198401ac3b031847ff5cdb144ccdd4002
3
+ metadata.gz: bd40e7f5776a186418daac09b2549442473f8159
4
+ data.tar.gz: fe3753e6b6321c44561cd162d55b7a5b88b7727c
5
5
  SHA512:
6
- metadata.gz: cb4bbd71743eebae48e0310b10463aba87b12f1d67d722709e82450f89c2af91fba631ef8e55b24cb5c4c10b625da92f7384a97408f98bbe0d6e72ab85ce6237
7
- data.tar.gz: d97e5863c2b4cfe9a7f704f881e6f0f0bfc699c58a739e23700d2a1a9d6392399eba0c4a148d42ff68756f892180472cd2f03df0fb2c22970eeb7d28ad6923d2
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
@@ -0,0 +1,13 @@
1
+ class DnB::Direct::One::Company < DnB::Direct::Model
2
+
3
+ attr_accessor :payload
4
+
5
+ attribute :duns
6
+ attribute :name
7
+ attribute :parentName
8
+ attribute :yearFounded
9
+ attribute :fein
10
+ attribute :companyType
11
+ attribute :legalStatus
12
+
13
+ end
@@ -4,7 +4,7 @@ require 'faraday'
4
4
  module DnB
5
5
  module Direct
6
6
  class One
7
- BASE_URL = 'http://dnbdirect-api.dnb.com/DnBAPI-17/rest'.freeze
7
+ BASE_URL = 'http://dnbdirect-api.dnb.com'.freeze
8
8
  class << self
9
9
  attr_accessor :api_key, :api_secret, :token, :api_base_url, :conn
10
10
 
@@ -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
 
@@ -1,5 +1,7 @@
1
1
  class DnB::Direct::Plus::Organization < DnB::Direct::Model
2
2
 
3
+ attr_accessor :payload
4
+
3
5
  attribute :duns
4
6
  attribute :primaryName
5
7
  attribute :tradeStyleNames
@@ -1,5 +1,5 @@
1
1
  module DnB
2
2
  module Direct
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
data/lib/dnb/direct.rb CHANGED
@@ -6,11 +6,13 @@ require 'kartograph'
6
6
  module DnB
7
7
  module Direct
8
8
 
9
- # Direct+
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.5
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-01-25 00:00:00.000000000 Z
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