contact-data 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2aaf71ac24016c2325d7e5b9397eaeb9387e0f60
4
+ data.tar.gz: 850e075960ac1bdc7f67751cd54c4a3e2e1bf05e
5
+ SHA512:
6
+ metadata.gz: d8ee8e2460d74d9de6f93f828e9b0b9b312f17747cafc5c57fc0d4112d3fd5a14be8d03c7a37613bb6145d60ef24902354e5889e62684983613cd346711d3527
7
+ data.tar.gz: 8bc93d0bd9ea6a5fce2779e88a6a5003c8c8829cfc1a75bd994d46bcb796b3d57e128971ad90a659b5beb2a0d56b2952b61c89e0b1398df13381b7288b8e080d
data/.env ADDED
@@ -0,0 +1 @@
1
+ PATH=/home/build/.rvm/gems/ruby-2.1.1/bin:/home/build/.rvm/gems/ruby-2.1.1@global/bin:/home/build/.rvm/rubies/ruby-2.1.1/bin:/home/build/.rvm/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/build/.rvm/gems/ruby-2.1.1@global/bin/bundle
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in foreplay.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ contact-data (0.0.1)
5
+ rest-client (~> 1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ coveralls (0.7.0)
11
+ multi_json (~> 1.3)
12
+ rest-client
13
+ simplecov (>= 0.7)
14
+ term-ansicolor
15
+ thor
16
+ diff-lcs (1.2.5)
17
+ gem-release (0.7.3)
18
+ mime-types (2.3)
19
+ multi_json (1.10.1)
20
+ rake (10.3.2)
21
+ rest-client (1.6.7)
22
+ mime-types (>= 1.16)
23
+ rspec (2.14.1)
24
+ rspec-core (~> 2.14.0)
25
+ rspec-expectations (~> 2.14.0)
26
+ rspec-mocks (~> 2.14.0)
27
+ rspec-core (2.14.8)
28
+ rspec-expectations (2.14.5)
29
+ diff-lcs (>= 1.1.3, < 2.0)
30
+ rspec-mocks (2.14.6)
31
+ simplecov (0.7.1)
32
+ multi_json (~> 1.0)
33
+ simplecov-html (~> 0.7.1)
34
+ simplecov-html (0.7.1)
35
+ term-ansicolor (1.3.0)
36
+ tins (~> 1.0)
37
+ thor (0.19.1)
38
+ tins (1.3.0)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ bundler (~> 1)
45
+ contact-data!
46
+ coveralls (~> 0)
47
+ gem-release (~> 0)
48
+ rake (~> 10)
49
+ rspec (~> 2)
50
+ simplecov (~> 0.7, >= 0.7.1)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Xenapto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # The contact-data gem
2
+
3
+ ![Gem Version](http://img.shields.io/gem/v/contact-data.svg?style=flat)&nbsp;[![Coverage Status](https://img.shields.io/coveralls/Xenapto/contact-data.svg?style=flat)](https://coveralls.io/r/Xenapto/contact-data?branch=master)
4
+ [![Developer status](http://img.shields.io/badge/developer-awesome-brightgreen.svg?style=flat)](http://xenapto.com)
5
+ ![build status](https://circleci.com/gh/Xenapto/contact-data.png?circle-token=2293f2a1d8463a948c2a2ce4bb3bd99786958c59)
6
+
7
+ Retrieves information about people and organizations from http://public.xenapto.com
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'contact-data'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install contact-data
22
+
23
+ ## Usage
24
+
25
+ Examples:
26
+
27
+ ```ruby
28
+ ContactData.search 'John Smith III'
29
+ ```
30
+
31
+ Or you can create an instance if you need to call it several times
32
+
33
+ ```ruby
34
+ contact_data = ContactData.new
35
+
36
+ ['John Smith', 'Example Inc.', 'Crazy Ventures LLC'].each do |name|
37
+ contact_data.search name
38
+ end
39
+ ```
40
+
41
+ ContactData will make an intelligent guess at the type of the name but it's not infallible. ContactData likes it if you tell it whether the name is a person or an organization:
42
+
43
+ ```ruby
44
+ contact_data = ContactData.new 'Di Doo Doo d.o.o.', contact_type: :organization
45
+ contact_data.search
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it
51
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 1. Push to the branch (`git push origin my-new-feature`)
54
+ 1. Create new Pull Request
55
+
56
+ ## Acknowledgements
57
+
58
+ 1. Thanks to Ryan Bigg for the guide to making your first gem https://github.com/radar/guides/blob/master/gem-development.md
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,28 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'contact-data/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'contact-data'
7
+ spec.version = ContactData::VERSION
8
+ spec.authors = ['Xenapto']
9
+ spec.email = ['developers@xenapto.com']
10
+ spec.description = %q{Useful methods for taming names}
11
+ spec.summary = %q{Example: ContactData.search('John Smith III')}
12
+ spec.homepage = 'https://github.com/Xenapto/contact-data'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features|coverage)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_runtime_dependency 'rest-client', '~> 1'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1'
23
+ spec.add_development_dependency 'rake', '~> 10'
24
+ spec.add_development_dependency 'rspec', '~> 2'
25
+ spec.add_development_dependency 'gem-release', '~> 0'
26
+ spec.add_development_dependency 'simplecov', '~> 0.7', '>= 0.7.1' # https://github.com/colszowka/simplecov/issues/281
27
+ spec.add_development_dependency 'coveralls', '~> 0'
28
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ class ContactData
3
+ class Deprecated
4
+ class << self
5
+ def search(name)
6
+ Fetcher.get("name/#{name}.json")
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ class ContactData
3
+ class Fetcher
4
+ URL = 'http://public.xenapto.com'
5
+ API = 'api/v2'
6
+
7
+ class << self
8
+ def get(api_method, options = {})
9
+ url = get_url_from(api_method, options)
10
+ puts url # debug
11
+ RestClient.get url, options[:params]
12
+ end
13
+
14
+ private
15
+
16
+ def get_url_from(api_method, options = {})
17
+ if api_method.is_a?(String)
18
+ URI.escape("#{URL}/#{api_method}")
19
+ elsif options[:base]
20
+ "#{URL}/#{API}/#{options[:base]}/#{api_method}"
21
+ else
22
+ "#{URL}/#{API}/#{api_method}"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ class ContactData
3
+ class Links
4
+ BASE = :links
5
+
6
+ class << self
7
+ def latest(params = {})
8
+ Fetcher.get(:latest, base: BASE, params: params)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ class ContactData
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ require 'contact-data/links'
3
+ require 'contact-data/fetcher'
4
+ require 'contact-data/deprecated'
5
+
6
+ class ContactData
7
+ class << self
8
+ def search(name)
9
+ Fetcher.get(:search, params: { name: name })
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'contact-data'
4
+
5
+ describe ContactData::Deprecated do
6
+ let(:name) { 'Derek Jones III' }
7
+
8
+ it 'searches for a contact by name' do
9
+ result = ContactData::Deprecated.search(name)
10
+ expect(result).to be_a(String)
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'contact-data'
4
+
5
+ describe ContactData::Links do
6
+ it 'gets latest links with related slug' do
7
+ result = ContactData::Links.latest
8
+ expect(result).to be_a(String)
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'contact-data'
4
+
5
+ describe ContactData do
6
+ let(:name) { 'Derek Jones III' }
7
+
8
+ it 'searches for a contact by name' do
9
+ expect{ ContactData.search(name) }.to raise_error(RestClient::ResourceNotFound)
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ # Initialize simplecov for coverage report.
2
+ require 'simplecov'
3
+ require 'coveralls'
4
+ SimpleCov.start
5
+ Coveralls.wear!('rails') if ENV['COVERALLS_REPO_TOKEN']
6
+
7
+
8
+ RSpec.configure do |config|
9
+ # Run specs in random order to surface order dependencies. If you find an
10
+ # order dependency and want to debug it, you can fix the order by providing
11
+ # the seed, which is printed after each run.
12
+ # --seed 1234
13
+ config.order = "random"
14
+
15
+ # Manually-added
16
+ config.color_enabled = true
17
+ config.tty = true
18
+ config.formatter = :documentation
19
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: contact-data
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Xenapto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: gem-release
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.7'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 0.7.1
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.7'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.7.1
103
+ - !ruby/object:Gem::Dependency
104
+ name: coveralls
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ description: Useful methods for taming names
118
+ email:
119
+ - developers@xenapto.com
120
+ executables: []
121
+ extensions: []
122
+ extra_rdoc_files: []
123
+ files:
124
+ - ".env"
125
+ - ".gitignore"
126
+ - ".ruby-version"
127
+ - Gemfile
128
+ - Gemfile.lock
129
+ - LICENSE
130
+ - README.md
131
+ - Rakefile
132
+ - contact-data.gemspec
133
+ - lib/contact-data.rb
134
+ - lib/contact-data/deprecated.rb
135
+ - lib/contact-data/fetcher.rb
136
+ - lib/contact-data/links.rb
137
+ - lib/contact-data/version.rb
138
+ - spec/contact-data_deprecated_spec.rb
139
+ - spec/contact-data_links_spec.rb
140
+ - spec/contact-data_spec.rb
141
+ - spec/spec_helper.rb
142
+ homepage: https://github.com/Xenapto/contact-data
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.2.2
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: 'Example: ContactData.search(''John Smith III'')'
166
+ test_files:
167
+ - spec/contact-data_deprecated_spec.rb
168
+ - spec/contact-data_links_spec.rb
169
+ - spec/contact-data_spec.rb
170
+ - spec/spec_helper.rb