fullcontact 0.7.0 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
1
  --color
2
- --format=nested
2
+ --format=documentation
3
3
  --backtrace
data/LICENSE.md CHANGED
@@ -1,20 +1,21 @@
1
- Copyright (c) 2011 Brandon West
1
+ The MIT License (MIT)
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2014 FullContact Inc. and contributors
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
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:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -2,10 +2,20 @@ FullContact Ruby Gem
2
2
  ====================
3
3
  A Ruby wrapper for the [FullContact API](http://www.fullcontact.com/)
4
4
 
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/fullcontact.svg)](http://badge.fury.io/rb/fullcontact)
7
+ [![Code Climate](https://codeclimate.com/github/fullcontact/fullcontact-api-ruby/badges/gpa.svg)](https://codeclimate.com/github/fullcontact/fullcontact-api-ruby)
8
+ [![Test Coverage](https://codeclimate.com/github/fullcontact/fullcontact-api-ruby/badges/coverage.svg)](https://codeclimate.com/github/fullcontact/fullcontact-api-ruby)
9
+
5
10
  Changes
6
11
  -------
7
- 0.7.0 - Faraday 0.9.0
8
- 0.6.0 - Removal of timeoutSeconds parameter. This parameter is automatically stripped from your request if included.
12
+ - 0.8.0
13
+ - Hashie now allowed from [2.2, 4.0) to support a wide range of other applications
14
+ - Default useragent includes version number for our own information
15
+ - Useless XML mode and dep on `multi_xml` removed
16
+ - Code reformatting & basic code hygiene, prep for new features in 0.9.0
17
+ - 0.7.0 - Faraday 0.9.0
18
+ - 0.6.0 - Removal of timeoutSeconds parameter. This parameter is automatically stripped from your request if included.
9
19
 
10
20
  Installation
11
21
  ------------
@@ -54,13 +64,16 @@ Usage Examples
54
64
  Contributions
55
65
  -------------
56
66
  - Michael Rose (Xorlev)
67
+ - Brandon West (bwest)
57
68
  - Ian Fisher (i-taptera)
58
69
  - Scott Watermasysk (scottwater)
59
70
  - Stefano Fontanelli (stefanofontanelli)
60
71
  - John Bachir (jjb)
61
72
 
62
- Copyright
73
+ License
63
74
  ---------
64
- Copyright (c) 2014 FullContact, Brandon West
75
+ Copyright (c) 2014 FullContact Inc. and contributors
76
+
77
+
65
78
 
66
- See [LICENSE](https://github.com/brandonmwest/rainmaker/blob/master/LICENSE.md) for details.
79
+ See [LICENSE](https://github.com/fullcontact/fullcontact-api-ruby/blob/master/LICENSE.md) for details.
data/fullcontact.gemspec CHANGED
@@ -1,24 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "fullcontact/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'fullcontact/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.add_development_dependency 'maruku', '~> 0.6'
7
7
  s.add_development_dependency 'nokogiri', '~> 1.4'
8
8
  s.add_development_dependency 'rake', '~> 0.9'
9
- s.add_development_dependency 'rspec', '~> 2.6'
9
+ s.add_development_dependency 'rspec', '~> 3.1'
10
10
  s.add_development_dependency 'simplecov', '~> 0.4'
11
11
  s.add_development_dependency 'webmock', '~> 1.6'
12
12
  s.add_development_dependency 'yard', '~> 0.7'
13
13
  s.add_runtime_dependency 'hashie', '>= 2.0'
14
14
  s.add_runtime_dependency 'faraday', '~> 0.9.0'
15
15
  s.add_runtime_dependency 'faraday_middleware', '>= 0.9'
16
- s.add_runtime_dependency 'multi_xml', '>= 0.5'
17
16
  s.add_runtime_dependency 'rash', '>= 0.4'
18
17
 
19
- s.author = "FullContact, Inc."
18
+ s.author = 'FullContact, Inc.'
20
19
  s.description = %q{A Ruby wrapper for the FullContact API}
21
20
  s.email = ['support@fullcontact.com']
21
+ s.license = 'MIT'
22
22
 
23
23
  s.post_install_message = ''
24
24
 
@@ -1,27 +1,30 @@
1
1
  module Faraday
2
2
  class Response::FullContactErrors < Response::Middleware
3
- def on_complete(env)
4
- case env[:status]
5
- when 400
6
- raise FullContact::BadRequest.new(error_message(env), env[:response_headers])
7
- when 401
8
- raise FullContact::Unauthorized.new(error_message(env), env[:response_headers])
9
- when 403
10
- raise FullContact::Forbidden.new(error_message(env), env[:response_headers])
11
- when 404
12
- raise FullContact::NotFound.new(error_message(env), env[:response_headers])
13
- when 422
14
- raise FullContact::Invalid.new(error_message(env), env[:response_headers])
15
- when 500
16
- raise FullContact::InternalServerError.new(error_message(env), env[:response_headers])
17
- when 502
18
- raise FullContact::BadGateway.new(error_message(env), env[:response_headers])
19
- when 503
20
- raise FullContact::ServiceUnavailable.new(error_message(env), env[:response_headers])
3
+ def on_complete(env)
4
+ case env[:status]
5
+ when 400
6
+ raise FullContact::BadRequest.new(error_message(env), env[:response_headers])
7
+ when 401
8
+ raise FullContact::Unauthorized.new(error_message(env), env[:response_headers])
9
+ when 403
10
+ raise FullContact::Forbidden.new(error_message(env), env[:response_headers])
11
+ when 404
12
+ raise FullContact::NotFound.new(error_message(env), env[:response_headers])
13
+ when 422
14
+ raise FullContact::Invalid.new(error_message(env), env[:response_headers])
15
+ when 429
16
+ # Note: not currently in use
17
+ raise FullContact::RateLimited.new(error_message(env), env[:response_headers])
18
+ when 500
19
+ raise FullContact::InternalServerError.new(error_message(env), env[:response_headers])
20
+ when 502
21
+ raise FullContact::BadGateway.new(error_message(env), env[:response_headers])
22
+ when 503
23
+ raise FullContact::ServiceUnavailable.new(error_message(env), env[:response_headers])
21
24
  end
22
- end
25
+ end
23
26
 
24
- def error_message(env)
27
+ def error_message(env)
25
28
  "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{env[:status]}"
26
29
  end
27
30
 
data/lib/fullcontact.rb CHANGED
@@ -4,6 +4,7 @@ require 'fullcontact/error'
4
4
  require 'fullcontact/configuration'
5
5
  require 'fullcontact/api'
6
6
  require 'fullcontact/client'
7
+ require 'fullcontact/version'
7
8
 
8
9
  module FullContact
9
10
  extend Configuration
@@ -3,20 +3,20 @@ module FullContact
3
3
  module Person
4
4
  # Returns extended information for a given person (email, phone, twitter or facebook)
5
5
  #
6
- def person(options={}, faraday_options={})
7
- if options.is_a?(String)
8
- warn "[DEPRECATION] supplying an email address directly is deprecated. Please use {email: #{options}} instead."
9
- options = {:email => options}
10
- end
6
+ def person(options={}, faraday_options={})
7
+ if options.is_a?(String)
8
+ warn "[DEPRECATION] supplying an email address directly is deprecated. Please use {email: #{options}} instead. This will be removed in 0.9.0."
9
+ options = {:email => options}
10
+ end
11
11
 
12
- if options.has_key?(:timeoutSeconds)
13
- options.delete(:timeoutSeconds)
14
- warn '[DEPRECATION] timeoutSeconds is no longer a supported parameter. It has been removed from your request.'
15
- end
12
+ if options.has_key?(:timeoutSeconds)
13
+ options.delete(:timeoutSeconds)
14
+ warn '[DEPRECATION] timeoutSeconds is no longer a supported parameter. It has been removed from your request.'
15
+ end
16
16
 
17
17
  response = get('person', options, false, faraday_options)
18
18
  format.to_s.downcase == 'xml' ? response['person'] : response
19
19
  end
20
- end
20
+ end
21
21
  end
22
22
  end
@@ -1,24 +1,21 @@
1
1
  require 'faraday'
2
+ require 'fullcontact/version'
2
3
 
3
4
  module FullContact
4
5
  # Defines constants and methods related to configuration
5
6
  module Configuration
6
7
  # An array of valid keys in the options hash when configuring a {FullContact::API}
7
8
  VALID_OPTIONS_KEYS = [
8
- :adapter,
9
- :api_key,
10
- :endpoint,
11
- :format,
12
- :gateway,
13
- :proxy,
14
- :user_agent].freeze
9
+ :adapter,
10
+ :api_key,
11
+ :endpoint,
12
+ :format,
13
+ :gateway,
14
+ :proxy,
15
+ :user_agent].freeze
15
16
 
16
17
  # An array of valid request/response formats
17
- #
18
- # @note Not all methods support the XML format.
19
- VALID_FORMATS = [
20
- :json,
21
- :xml].freeze
18
+ VALID_FORMATS = [:json].freeze
22
19
 
23
20
  # The adapter that will be used to connect if none is set
24
21
  #
@@ -37,11 +34,11 @@ module FullContact
37
34
  # @note JSON is preferred over XML because it is more concise and faster to parse.
38
35
  DEFAULT_FORMAT = :json
39
36
 
40
- # By default, don't use a proxy server
37
+ # By default, don't use a proxy server
41
38
  DEFAULT_PROXY = nil
42
39
 
43
40
  # The user agent that will be sent to the API endpoint if none is set
44
- DEFAULT_USER_AGENT = 'FullContact Ruby Gem'.freeze
41
+ DEFAULT_USER_AGENT = "FullContact Ruby Client/#{FullContact::VERSION}".freeze
45
42
 
46
43
  DEFAULT_GATEWAY = nil
47
44
 
@@ -61,19 +58,19 @@ module FullContact
61
58
  # Create a hash of options and their values
62
59
  def options
63
60
  options = {}
64
- VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }
61
+ VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
65
62
  options
66
63
  end
67
64
 
68
65
  # Reset all configuration options to defaults
69
66
  def reset
70
- self.adapter = DEFAULT_ADAPTER
71
- self.api_key = DEFAULT_API_KEY
72
- self.endpoint = DEFAULT_ENDPOINT
73
- self.format = DEFAULT_FORMAT
74
- self.proxy = DEFAULT_PROXY
75
- self.user_agent = DEFAULT_USER_AGENT
76
- self.gateway = DEFAULT_GATEWAY
67
+ self.adapter = DEFAULT_ADAPTER
68
+ self.api_key = DEFAULT_API_KEY
69
+ self.endpoint = DEFAULT_ENDPOINT
70
+ self.format = DEFAULT_FORMAT
71
+ self.proxy = DEFAULT_PROXY
72
+ self.user_agent = DEFAULT_USER_AGENT
73
+ self.gateway = DEFAULT_GATEWAY
77
74
  self
78
75
  end
79
76
  end
@@ -10,10 +10,10 @@ module FullContact
10
10
 
11
11
  def connection(raw=false, faraday_options={})
12
12
  options = {
13
- :headers => {'Accept' => "application/#{format}", 'User-Agent' => user_agent},
14
- :proxy => proxy,
15
- :ssl => {:verify => false},
16
- :url => api_endpoint,
13
+ :headers => {'Accept' => "application/#{format}", 'User-Agent' => user_agent},
14
+ :proxy => proxy,
15
+ :ssl => {:verify => false},
16
+ :url => api_endpoint,
17
17
  }.merge(faraday_options)
18
18
 
19
19
  Faraday.new(options) do |builder|
@@ -22,10 +22,8 @@ module FullContact
22
22
  builder.use Faraday::Response::Rashify unless raw
23
23
  unless raw
24
24
  case format.to_s.downcase
25
- when 'json'
26
- builder.use Faraday::Response::ParseJson
27
- when 'xml'
28
- builder.use Faraday::Response::ParseXml
25
+ when 'json'
26
+ builder.use Faraday::Response::ParseJson
29
27
  end
30
28
  end
31
29
  builder.use Faraday::Response::FullContactErrors
@@ -10,26 +10,38 @@ module FullContact
10
10
  end
11
11
 
12
12
  # Raised when FullContact returns the HTTP status code 400
13
- class BadRequest < Error; end
13
+ class BadRequest < Error;
14
+ end
14
15
 
15
16
  # Raised when FullContact returns the HTTP status code 401
16
- class Unauthorized < Error; end
17
+ class Unauthorized < Error;
18
+ end
17
19
 
18
20
  # Raised when FullContact returns the HTTP status code 403
19
- class Forbidden < Error; end
21
+ class Forbidden < Error;
22
+ end
20
23
 
21
24
  # Raised when FullContact returns the HTTP status code 404
22
- class NotFound < Error; end
25
+ class NotFound < Error;
26
+ end
23
27
 
24
28
  # Raised when FullContact returns the HTTP status code 422
25
- class Invalid < Error; end
29
+ class Invalid < Error;
30
+ end
31
+
32
+ # Raised when FullContact returns the HTTP status code 429
33
+ class RateLimited < Error;
34
+ end
26
35
 
27
36
  # Raised when FullContact returns the HTTP status code 500
28
- class InternalServerError < Error; end
37
+ class InternalServerError < Error;
38
+ end
29
39
 
30
40
  # Raised when FullContact returns the HTTP status code 502
31
- class BadGateway < Error; end
41
+ class BadGateway < Error;
42
+ end
32
43
 
33
44
  # Raised when FullContact returns the HTTP status code 503
34
- class ServiceUnavailable < Error; end
45
+ class ServiceUnavailable < Error;
46
+ end
35
47
  end
@@ -14,7 +14,7 @@ module FullContact
14
14
 
15
15
  response = connection(raw, faraday_options).send(method) do |request|
16
16
  request.url(formatted_path(path), options)
17
- end
17
+ end
18
18
 
19
19
  raw ? response : response.body
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module FullContact
2
- VERSION = "0.7.0"
2
+ VERSION = '0.8.2'
3
3
  end
@@ -4,28 +4,28 @@ require 'fullcontact'
4
4
 
5
5
  describe Faraday::Response do
6
6
  before do
7
- FullContact.configure do |config|
8
- config.api_key = "api_key"
9
- end
7
+ FullContact.configure do |config|
8
+ config.api_key = "api_key"
9
+ end
10
10
  @client = FullContact::Client.new
11
11
  end
12
12
 
13
13
  {
14
- 400 => FullContact::BadRequest,
15
- 401 => FullContact::Unauthorized,
16
- 403 => FullContact::Forbidden,
17
- 404 => FullContact::NotFound,
18
- 422 => FullContact::Invalid,
19
- 500 => FullContact::InternalServerError,
20
- 502 => FullContact::BadGateway,
21
- 503 => FullContact::ServiceUnavailable,
14
+ 400 => FullContact::BadRequest,
15
+ 401 => FullContact::Unauthorized,
16
+ 403 => FullContact::Forbidden,
17
+ 404 => FullContact::NotFound,
18
+ 422 => FullContact::Invalid,
19
+ 500 => FullContact::InternalServerError,
20
+ 502 => FullContact::BadGateway,
21
+ 503 => FullContact::ServiceUnavailable,
22
22
  }.each do |status, exception|
23
23
  if (status >= 500)
24
24
  context "when HTTP status is #{status}" do
25
25
  before do
26
26
  stub_get('person.json').
27
- with(:query => {:apiKey => "api_key", :email => 'brawest@gmail.com'}).
28
- to_return(:status => status)
27
+ with(:query => {:apiKey => "api_key", :email => 'brawest@gmail.com'}).
28
+ to_return(:status => status)
29
29
  end
30
30
 
31
31
  it "should raise #{exception.name} error" do
@@ -39,14 +39,14 @@ describe Faraday::Response do
39
39
  context "when HTTP status is #{status} and body is #{body||='nil'}" do
40
40
  before do
41
41
  body_message = '{"'+body+'":"test"}' unless body.nil?
42
- stub_get('person.json').
43
- with(:query => {:apiKey => "api_key", :email => 'brawest@gmail.com'}).
44
- to_return(:status => status, :body => body_message)
42
+ stub_get('person.json').
43
+ with(:query => {:apiKey => "api_key", :email => 'brawest@gmail.com'}).
44
+ to_return(:status => status, :body => body_message)
45
45
  end
46
46
 
47
47
  it "should raise #{exception.name} error" do
48
48
  lambda do
49
- @client.person(:email => 'brawest@gmail.com')
49
+ @client.person(:email => 'brawest@gmail.com')
50
50
  end.should raise_error(exception)
51
51
  end
52
52
  end
@@ -9,31 +9,31 @@ describe FullContact do
9
9
  context "when delegating to a client" do
10
10
 
11
11
  before do
12
- FullContact.configure do |config|
13
- config.api_key = "api_key"
14
- end
12
+ FullContact.configure do |config|
13
+ config.api_key = "api_key"
14
+ end
15
15
 
16
- stub_get("person.json").
17
- with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"}).
18
- to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
16
+ stub_get("person.json").
17
+ with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"}).
18
+ to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
19
19
 
20
- stub_get("person.json").
21
- with(:query => {:apiKey => "api_key", :twitter => "brawtest"}).
22
- to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
20
+ stub_get("person.json").
21
+ with(:query => {:apiKey => "api_key", :twitter => "brawtest"}).
22
+ to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
23
23
  end
24
24
 
25
25
  it "should get the correct resource" do
26
- FullContact.person(email: "brawest@gmail.com")
26
+ FullContact.person(email: "brawest@gmail.com")
27
27
  a_get("person.json")
28
- .with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"})
29
- .should have_been_made
28
+ .with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"})
29
+ .should have_been_made
30
30
  end
31
31
 
32
32
  it "should strip the timeoutSeconds parameter" do
33
- FullContact.person(email: "brawest@gmail.com", timeoutSeconds: 30)
33
+ FullContact.person(email: "brawest@gmail.com", timeoutSeconds: 30)
34
34
  a_get("person.json")
35
- .with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"})
36
- .should have_been_made
35
+ .with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"})
36
+ .should have_been_made
37
37
  end
38
38
 
39
39
  it "should return the same results as a client by email" do
@@ -45,12 +45,6 @@ describe FullContact do
45
45
  end
46
46
  end
47
47
 
48
- describe '.respond_to?' do
49
- it 'takes an optional include private argument' do
50
- FullContact.respond_to?(:client, true).should be_true
51
- end
52
- end
53
-
54
48
  describe ".client" do
55
49
  it "should be a FullContact::Client" do
56
50
  FullContact.client.should be_a FullContact::Client
@@ -102,6 +96,12 @@ describe FullContact do
102
96
  end
103
97
  end
104
98
 
99
+ describe ".user_agent" do
100
+ it "should return the default user agent" do
101
+ expect(FullContact.user_agent).to satisfy { |ua| ua.start_with? 'FullContact Ruby Client/' }
102
+ end
103
+ end
104
+
105
105
  describe ".user_agent=" do
106
106
  it "should set the user_agent" do
107
107
  FullContact.user_agent = 'Custom User Agent'
@@ -6,7 +6,7 @@ describe FullContact::API do
6
6
  end
7
7
 
8
8
  context "with module configuration" do
9
- before do
9
+ before do
10
10
  FullContact.configure do |config|
11
11
  @keys.each do |key|
12
12
  config.send("#{key}=", key)
@@ -29,24 +29,24 @@ describe FullContact::API do
29
29
 
30
30
  before do
31
31
  @configuration = {
32
- :api_key => 'api_key',
33
- :adapter => :typhoeus,
34
- :endpoint => 'http://tumblr.com/',
35
- :gateway => 'apigee-1111.apigee.com',
36
- :format => :xml,
37
- :proxy => 'http://erik:sekret@proxy.example.com:8080',
38
- :user_agent => 'Custom User Agent',
32
+ :api_key => 'api_key',
33
+ :adapter => :typhoeus,
34
+ :endpoint => 'http://tumblr.com/',
35
+ :gateway => 'apigee-1111.apigee.com',
36
+ :format => :xml,
37
+ :proxy => 'http://erik:sekret@proxy.example.com:8080',
38
+ :user_agent => 'Custom User Agent',
39
39
  }
40
40
  end
41
41
 
42
42
  context "during initialization"
43
43
 
44
- it "should override module configuration" do
45
- api = FullContact::API.new(@configuration)
46
- @keys.each do |key|
47
- api.send(key).should == @configuration[key]
48
- end
44
+ it "should override module configuration" do
45
+ api = FullContact::API.new(@configuration)
46
+ @keys.each do |key|
47
+ api.send(key).should == @configuration[key]
49
48
  end
49
+ end
50
50
 
51
51
  context "after initilization" do
52
52
 
@@ -7,6 +7,6 @@ describe FullContact::Client do
7
7
  @client = FullContact::Client.new(:format => format, :api_key => 'api_key')
8
8
  end
9
9
 
10
- end
11
10
  end
12
11
  end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fullcontact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-08 00:00:00.000000000 Z
12
+ date: 2014-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: maruku
16
- requirement: &70341113073320 !ruby/object:Gem::Requirement
16
+ requirement: &70332720405680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70341113073320
24
+ version_requirements: *70332720405680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70341113072760 !ruby/object:Gem::Requirement
27
+ requirement: &70332720404800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.4'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70341113072760
35
+ version_requirements: *70332720404800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70341113072180 !ruby/object:Gem::Requirement
38
+ requirement: &70332720404160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,21 +43,21 @@ dependencies:
43
43
  version: '0.9'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70341113072180
46
+ version_requirements: *70332720404160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70341113071400 !ruby/object:Gem::Requirement
49
+ requirement: &70332720403700 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '2.6'
54
+ version: '3.1'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70341113071400
57
+ version_requirements: *70332720403700
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &70341113068420 !ruby/object:Gem::Requirement
60
+ requirement: &70332720403200 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0.4'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70341113068420
68
+ version_requirements: *70332720403200
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
- requirement: &70341113067920 !ruby/object:Gem::Requirement
71
+ requirement: &70332720402680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.6'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70341113067920
79
+ version_requirements: *70332720402680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: yard
82
- requirement: &70341113067300 !ruby/object:Gem::Requirement
82
+ requirement: &70332720401800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0.7'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70341113067300
90
+ version_requirements: *70332720401800
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: hashie
93
- requirement: &70341113066220 !ruby/object:Gem::Requirement
93
+ requirement: &70332720401200 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '2.0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70341113066220
101
+ version_requirements: *70332720401200
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: faraday
104
- requirement: &70341113065220 !ruby/object:Gem::Requirement
104
+ requirement: &70332720400480 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.9.0
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70341113065220
112
+ version_requirements: *70332720400480
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: faraday_middleware
115
- requirement: &70341113064500 !ruby/object:Gem::Requirement
115
+ requirement: &70332720399600 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,21 +120,10 @@ dependencies:
120
120
  version: '0.9'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70341113064500
124
- - !ruby/object:Gem::Dependency
125
- name: multi_xml
126
- requirement: &70341113063500 !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0.5'
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: *70341113063500
123
+ version_requirements: *70332720399600
135
124
  - !ruby/object:Gem::Dependency
136
125
  name: rash
137
- requirement: &70341113062780 !ruby/object:Gem::Requirement
126
+ requirement: &70332720399140 !ruby/object:Gem::Requirement
138
127
  none: false
139
128
  requirements:
140
129
  - - ! '>='
@@ -142,7 +131,7 @@ dependencies:
142
131
  version: '0.4'
143
132
  type: :runtime
144
133
  prerelease: false
145
- version_requirements: *70341113062780
134
+ version_requirements: *70332720399140
146
135
  description: A Ruby wrapper for the FullContact API
147
136
  email:
148
137
  - support@fullcontact.com
@@ -157,12 +146,9 @@ files:
157
146
  - LICENSE.md
158
147
  - README.md
159
148
  - Rakefile
160
- - VERSION
161
149
  - fullcontact.gemspec
162
150
  - lib/faraday/request/gateway.rb
163
151
  - lib/faraday/response/fullcontact_errors.rb
164
- - lib/faraday/response/raise_http_4xx.rb
165
- - lib/faraday/response/raise_http_5xx.rb
166
152
  - lib/fullcontact.rb
167
153
  - lib/fullcontact/api.rb
168
154
  - lib/fullcontact/client.rb
@@ -182,7 +168,8 @@ files:
182
168
  - vendor/cache/maruku-0.6.0.gem
183
169
  - vendor/cache/syntax-1.0.0.gem
184
170
  homepage: https://github.com/fullcontact/fullcontact-api-ruby
185
- licenses: []
171
+ licenses:
172
+ - MIT
186
173
  post_install_message: ''
187
174
  rdoc_options: []
188
175
  require_paths:
@@ -195,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
182
  version: '0'
196
183
  segments:
197
184
  - 0
198
- hash: -3782038561833846035
185
+ hash: -4162318102109248767
199
186
  required_rubygems_version: !ruby/object:Gem::Requirement
200
187
  none: false
201
188
  requirements:
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.1
@@ -1,45 +0,0 @@
1
- require 'faraday'
2
-
3
- # @private
4
- module Faraday
5
- # @private
6
- class Response::RaiseHttp4xx < Response::Middleware
7
- def on_complete(env)
8
- case env[:status].to_i
9
- when 400
10
- raise FullContact::BadRequest.new(error_message(env), env[:response_headers])
11
- when 401
12
- raise FullContact::Unauthorized.new(error_message(env), env[:response_headers])
13
- when 403
14
- raise FullContact::Forbidden.new(error_message(env), env[:response_headers])
15
- when 404
16
- raise FullContact::NotFound.new(error_message(env), env[:response_headers])
17
- when 422
18
- raise FullContact::Invalid.new(error_message(env), env[:response_headers])
19
- end
20
-
21
-
22
- end
23
-
24
- private
25
-
26
- def error_message(env)
27
- "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{env[:status]}#{error_body(env[:body])}"
28
- end
29
-
30
- def error_body(body)
31
- if body.nil?
32
- nil
33
- elsif body['error']
34
- ": #{body['error']}"
35
- elsif body['errors']
36
- first = Array(body['errors']).first
37
- if first.kind_of? Hash
38
- ": #{first['message'].chomp}"
39
- else
40
- ": #{first.chomp}"
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,24 +0,0 @@
1
- require 'faraday'
2
-
3
- # @private
4
- module Faraday
5
- # @private
6
- class Response::RaiseHttp5xx < Response::Middleware
7
- def on_complete(env)
8
- case env[:status].to_i
9
- when 500
10
- raise FullContact::InternalServerError.new(error_message(env, "Internal server error."), env[:response_headers])
11
- when 502
12
- raise FullContact::BadGateway.new(error_message(env, "FullContact is down or being upgraded."), env[:response_headers])
13
- when 503
14
- raise FullContact::ServiceUnavailable.new(error_message(env, "Service unavailable."), env[:response_headers])
15
- end
16
- end
17
-
18
- private
19
-
20
- def error_message(env, body=nil)
21
- "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{[env[:status].to_s + ':', body].compact.join(' ')} Check http://status.fullcontact.cc/ for updates on the status of the FullContact service."
22
- end
23
- end
24
- end