callcredit 0.3.7 → 0.3.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45614e1397afff4e95991b829a14e1001e0d79d2
4
- data.tar.gz: 6b4ca2913c8f061344363fc0773a57e2f836cab1
3
+ metadata.gz: 1213865aa7687c9adfd222ffeed8c2e1e6a76ccd
4
+ data.tar.gz: 2e1265299afc2b3198eb4c1c0c07da6e809dd6fe
5
5
  SHA512:
6
- metadata.gz: 2f555f5241e1a4b127a51dc8cb3229083250cf34eb990f071022a2722e090546e35c1b0d63b94b77ddf3eed5a923e11e3e540fe96a7634b06333e11be22240cc
7
- data.tar.gz: 395f439d4527279815c8bce6fb376488185efdcaed86589fe4096d210e3e1d224ad04858da42602de3a9afa3a095eaa34383b98d6b8e0b51f6ac4e064c4b61c3
6
+ metadata.gz: 88f56e2dce84202fdaed7891de549f8e6c4d89400c6c6b1718efe717fc50368f7ef990ccd9a066ff5568f69388db2a6e9020e38b0e06f732bc1d4cb0581f4259
7
+ data.tar.gz: 321382da4b9e994eeb5c702c166ff78a8372e5bfb3d640b17a6d8dc596339427c1d507354f87e437bf0945b6021ea5f9cd53887762a2faf4e0bbd8f90e2ba80f
@@ -1,3 +1,7 @@
1
+ ## 0.3.8 - July 16, 2014
2
+
3
+ - Include requiest ID (RID) on all requests
4
+
1
5
  ## 0.3.7 - June 3, 2014
2
6
 
3
7
  - Add support for Faraday 0.9
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
6
6
  gem.add_runtime_dependency 'nokogiri', '~> 1.4'
7
7
  gem.add_runtime_dependency 'unicode_utils', '~> 1.4.0'
8
8
 
9
- gem.add_development_dependency 'rspec', '~> 2.14.1'
10
- gem.add_development_dependency 'webmock', '~> 1.17.2'
9
+ gem.add_development_dependency 'rspec', '~> 3.0.0'
10
+ gem.add_development_dependency 'webmock', '~> 1.18.0'
11
11
 
12
12
  gem.authors = ['Grey Baker']
13
13
  gem.description = %q{Ruby wrapper for Callcredit's CallValidate API}
@@ -27,7 +27,7 @@ module Callcredit
27
27
  xml.callvalidate do
28
28
  authentication(xml)
29
29
  xml.sessions do
30
- xml.session do
30
+ xml.session("RID" => Time.now.to_f) do
31
31
  xml.data do
32
32
  personal_data(xml, check_data[:personal_data])
33
33
  card_data(xml, check_data[:card_data])
@@ -1,3 +1,3 @@
1
1
  module Callcredit
2
- VERSION = '0.3.7'.freeze
2
+ VERSION = '0.3.8'.freeze
3
3
  end
@@ -8,7 +8,11 @@ describe Callcredit do
8
8
  Callcredit::Config::DEFAULT_OPTIONS.keys.map(&:to_sym).each do |key|
9
9
  context "setting #{key}" do
10
10
  before { Callcredit.configure { |config| config[key] = key } }
11
- its([key]) { should == key }
11
+
12
+ describe [key] do
13
+ subject { super()[key] }
14
+ it { should == key }
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -26,8 +30,8 @@ describe Callcredit do
26
30
  let(:data) { { first_name: "Grey", last_name: "Baker" } }
27
31
 
28
32
  it "delegates to the client" do
29
- Callcredit::Client.any_instance.
30
- should_receive(:id_enhanced_check).with(data)
33
+ expect_any_instance_of(Callcredit::Client).
34
+ to receive(:id_enhanced_check).with(data)
31
35
  Callcredit.id_enhanced_check(data)
32
36
  end
33
37
  end
@@ -39,8 +43,8 @@ describe Callcredit do
39
43
  end
40
44
 
41
45
  it "delegates to the client" do
42
- Callcredit::Client.any_instance.
43
- should_receive(:perform_check).with(:id_enhanced_check, data)
46
+ expect_any_instance_of(Callcredit::Client).
47
+ to receive(:perform_check).with(:id_enhanced_check, data)
44
48
  Callcredit.perform_check(:id_enhanced_check, data)
45
49
  end
46
50
  end
@@ -24,15 +24,19 @@ describe Callcredit::Checks::IDEnhanced do
24
24
 
25
25
  it "makes a get request" do
26
26
  perform_check
27
- a_request(:get, config[:api_endpoint]).should have_been_made
27
+ expect(a_request(:get, config[:api_endpoint])).to have_been_made
28
28
  end
29
29
 
30
- it { should be_a Callcredit::Response }
30
+ it { is_expected.to be_a Callcredit::Response }
31
31
 
32
32
  context "when the config[:raw] is true" do
33
33
  before { config[:raw] = true }
34
- it { should be_a Faraday::Response }
35
- its(:body) { should be_a String }
34
+ it { is_expected.to be_a Faraday::Response }
35
+
36
+ describe '#body' do
37
+ subject { super().body }
38
+ it { should be_a String }
39
+ end
36
40
  end
37
41
 
38
42
  describe "validates inputs" do
@@ -48,7 +52,7 @@ describe Callcredit::Checks::IDEnhanced do
48
52
 
49
53
  it "makes a get request" do
50
54
  perform_check
51
- a_request(:get, config[:api_endpoint]).should have_been_made
55
+ expect(a_request(:get, config[:api_endpoint])).to have_been_made
52
56
  end
53
57
  end
54
58
  end
@@ -10,7 +10,10 @@ describe Callcredit::Client do
10
10
  before { configure_callcredit }
11
11
  subject(:new_client) { Callcredit::Client.new }
12
12
 
13
- its(:config) { should_not == Callcredit.config }
13
+ describe '#config' do
14
+ subject { super().config }
15
+ it { should_not == Callcredit.config }
16
+ end
14
17
  it "has the attributes of the global config" do
15
18
  new_client.config[:first_name] == Callcredit.config[:first_name]
16
19
  end
@@ -20,7 +23,10 @@ describe Callcredit::Client do
20
23
  before { config[:first_name] = "test" }
21
24
  subject(:new_client) { Callcredit::Client.new(config) }
22
25
 
23
- its(:config) { should_not == config }
26
+ describe '#config' do
27
+ subject { super().config }
28
+ it { should_not == config }
29
+ end
24
30
  it "has the attributes of the passed in config" do
25
31
  new_client.config[:first_name] == config[:first_name]
26
32
  end
@@ -32,13 +32,13 @@ describe Callcredit::Request do
32
32
  let(:xsd) { Nokogiri::XML::Schema(xml_schema) }
33
33
 
34
34
  it "generates a valid XML request" do
35
- xsd.validate(request_xml).should == []
35
+ expect(xsd.validate(request_xml)).to eq([])
36
36
  end
37
37
 
38
38
  context "with a date object for date_of_birth" do
39
39
  let(:date_of_birth) { Date.parse("01/01/2000") }
40
40
  it "generates a valid XML request" do
41
- xsd.validate(request_xml).should == []
41
+ expect(xsd.validate(request_xml)).to eq([])
42
42
  end
43
43
  end
44
44
  end
@@ -48,18 +48,22 @@ describe Callcredit::Request do
48
48
 
49
49
  it "makes a get request" do
50
50
  perform_check
51
- a_request(:get, config[:api_endpoint]).should have_been_made
51
+ expect(a_request(:get, config[:api_endpoint])).to have_been_made
52
52
  end
53
53
 
54
54
  context "when the config[:raw] is true" do
55
55
  before { config[:raw] = true }
56
- it { should be_a Faraday::Response }
57
- its(:body) { should be_a String }
56
+ it { is_expected.to be_a Faraday::Response }
57
+
58
+ describe '#body' do
59
+ subject { super().body }
60
+ it { should be_a String }
61
+ end
58
62
  end
59
63
 
60
64
  context "when the config[:raw] is false" do
61
- it { should be_a Hash }
62
- it { should include "Results" }
65
+ it { is_expected.to be_a Hash }
66
+ it { is_expected.to include "Results" }
63
67
 
64
68
  context "errors" do
65
69
  context "500" do
@@ -6,6 +6,6 @@ describe Callcredit::Response do
6
6
  subject(:response) { Callcredit::Response.new(result_hash) }
7
7
 
8
8
  it "makes some helper methods available" do
9
- response.pid.should == "LTJ-CT2-1606-13927-46399"
9
+ expect(response.pid).to eq("LTJ-CT2-1606-13927-46399")
10
10
  end
11
11
  end
@@ -1,6 +1,11 @@
1
1
  require 'callcredit'
2
2
  require 'webmock/rspec'
3
- RSpec.configure { |config| config.include WebMock::API }
3
+
4
+ RSpec.configure do |config|
5
+ config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
6
+ config.raise_errors_for_deprecations!
7
+ config.include WebMock::API
8
+ end
4
9
 
5
10
  def configure_callcredit
6
11
  Callcredit.configure do |config|
@@ -23,4 +28,4 @@ shared_examples "it validates presence" do |property|
23
28
  expect { subject }.to raise_error Callcredit::InvalidRequestError
24
29
  end
25
30
  end
26
- end
31
+ end
@@ -6,17 +6,17 @@ describe Callcredit::Validations do
6
6
 
7
7
  context "without a date of birth" do
8
8
  let(:date_of_birth) { nil }
9
- it { should == nil }
9
+ it { is_expected.to eq(nil) }
10
10
  end
11
11
 
12
12
  context "with a date object" do
13
13
  let(:date_of_birth) { Date.parse("01/01/2000") }
14
- it { should == date_of_birth.strftime("%d/%m/%Y") }
14
+ it { is_expected.to eq(date_of_birth.strftime("%d/%m/%Y")) }
15
15
  end
16
16
 
17
17
  context "with a parseable string" do
18
18
  let(:date_of_birth) { "01-01-2000" }
19
- it { should == "01/01/2000" }
19
+ it { is_expected.to eq("01/01/2000") }
20
20
  end
21
21
 
22
22
  context "with a load of rubbish" do
@@ -32,17 +32,17 @@ describe Callcredit::Validations do
32
32
 
33
33
  context "without a name" do
34
34
  let(:name) { nil }
35
- it { should == nil }
35
+ it { is_expected.to eq(nil) }
36
36
  end
37
37
 
38
38
  context "with a simple name" do
39
39
  let(:name) { "Grey" }
40
- it { should == name }
40
+ it { is_expected.to eq(name) }
41
41
  end
42
42
 
43
43
  context "with a name with non-ASCII characters" do
44
44
  let(:name) { "Gréy" }
45
- it { should == "Grey" }
45
+ it { is_expected.to eq("Grey") }
46
46
  end
47
47
 
48
48
  context "with a very long name" do
@@ -65,17 +65,17 @@ describe Callcredit::Validations do
65
65
 
66
66
  context "without a postcode" do
67
67
  let(:postcode) { nil }
68
- it { should == nil }
68
+ it { is_expected.to eq(nil) }
69
69
  end
70
70
 
71
71
  context "with a correct postcode" do
72
72
  let(:postcode) { "EC2A 1DX" }
73
- it { should == postcode }
73
+ it { is_expected.to eq(postcode) }
74
74
  end
75
75
 
76
76
  context "with a padded postcode" do
77
77
  let(:postcode) { "EC2A 1DX " }
78
- it { should == "EC2A 1DX" }
78
+ it { is_expected.to eq("EC2A 1DX") }
79
79
  end
80
80
 
81
81
  context "with a postcode that is too short" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: callcredit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grey Baker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2014-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday_middleware
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - ~>
80
80
  - !ruby/object:Gem::Version
81
- version: 2.14.1
81
+ version: 3.0.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - ~>
87
87
  - !ruby/object:Gem::Version
88
- version: 2.14.1
88
+ version: 3.0.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: webmock
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - ~>
94
94
  - !ruby/object:Gem::Version
95
- version: 1.17.2
95
+ version: 1.18.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ~>
101
101
  - !ruby/object:Gem::Version
102
- version: 1.17.2
102
+ version: 1.18.0
103
103
  description: Ruby wrapper for Callcredit's CallValidate API
104
104
  email:
105
105
  - grey@gocardless.com