infoconnect_wrapper 0.0.0
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 +7 -0
- data/lib/infoconnect_wrapper/find_company.rb +34 -0
- data/lib/infoconnect_wrapper/response.rb +16 -0
- data/lib/infoconnect_wrapper.rb +12 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e701d89affd926da8a5081d284a27184e1fe292
|
4
|
+
data.tar.gz: 00ec928989589b9f7dfdbc1448bd46f2c6ee23f3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad4652ce9b41fcd992da7a6d4a45aa803d05ee303d33815eedf1611c13afabce5aae62b0f9c68e0947511746e44ca8643dbf30cbd27a001ec9503cded3108827
|
7
|
+
data.tar.gz: 39ca514099ffec89cb0b1b9ba4c4ca7740a7383460534d29bcaafa653a5faa27a7493ca9fab90edebfa40fb8a601bd8e09e53884404db06e88024671510b151b
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module InfoconnectWrapper
|
2
|
+
require 'rest-client'
|
3
|
+
class FindCompany
|
4
|
+
attr_accessor :api_key
|
5
|
+
def init(apikey)
|
6
|
+
self.api_key = apikey
|
7
|
+
end
|
8
|
+
|
9
|
+
##example InfoConnectWrapper::FindCompany.find_by_name('Infogroup', 'Papillion, 'NE', 'Enhanced')
|
10
|
+
def find_by_name(name, city, state, resource_type)
|
11
|
+
url = "https://api.infoconnect.com/v3/match?apikey=#{self.api_key}"
|
12
|
+
company = Company.new
|
13
|
+
begin
|
14
|
+
response = RestClient.post url,
|
15
|
+
{
|
16
|
+
:ResourceType => resource_type,
|
17
|
+
:CompanyName => name,
|
18
|
+
:RequestType => "Company",
|
19
|
+
:Limit => "1",
|
20
|
+
:City => city,
|
21
|
+
:StateProvince => state
|
22
|
+
}, :content_type => :json, :accept => :json
|
23
|
+
r = JSON.parse response
|
24
|
+
if r["MatchCount"] > 0
|
25
|
+
company_to_parse = r["Matches"]["Companies"][0]
|
26
|
+
company.init(company_to_parse)
|
27
|
+
end
|
28
|
+
rescue => e
|
29
|
+
puts e
|
30
|
+
end
|
31
|
+
company
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: infoconnect_wrapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Schwartz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A Ruby wrapper for Infoconnect's API. Currently supporting http://developer.infoconnect.com/company-object
|
14
|
+
email: bschwartz@creativereason.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/infoconnect_wrapper.rb
|
20
|
+
- lib/infoconnect_wrapper/find_company.rb
|
21
|
+
- lib/infoconnect_wrapper/response.rb
|
22
|
+
homepage: https://github.com/creativereason/infoconnect_wrapper
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.2.2
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Wrapper around infoconnect's wrapper for Ruby.
|
46
|
+
test_files: []
|