cardconnect 2.0.1 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e78685d6b6148c4ef00d930973370a9d5fd7ee88
4
- data.tar.gz: 57acd3cd68ed8b6dbc33a4f45084aa1328efd39a
3
+ metadata.gz: 1424e5c7c8b8b7da969afddb41d96b38251e6c7f
4
+ data.tar.gz: 4d108dc528103808b4c9688c4afab51c4b833bb0
5
5
  SHA512:
6
- metadata.gz: 6c46b242a5bf6c636dca0a0e59cdfb703cbed43d30f3765319eac9c416a003450fc98ebfbcfdf7191c929f8a529f5185cd3df54ab8f2e1d907e076312d5547db
7
- data.tar.gz: 35ba54fbda3e6823c944f2bc0eb12ec9547a2272ea69dd9dec995e1387de6ed57980d4498a30658f017fca599d2935a15fedaee94ffae342702d68b52a98215e
6
+ metadata.gz: db20abb8bd3a1125ead42db2e54d03b1864a530139d2fd669be621510851bf5537b86f5a5289a5fa98cc8855acf6ee7b84e5051f54ceb128635bb1b512ce8fea
7
+ data.tar.gz: 5a524dd23a749c7232831d8d75a3f72fe34b0e1f890d378a985b408b2f3312340b6c6cf06a31b12d08f69ee509a5a49e19224fe58e2fd738fa01617e28a70c84
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
4
- - 2.0.0
3
+ - 2.2
4
+ - 2.1
5
+ - 2.0
5
6
  - 1.9.3
6
7
  addons:
7
8
  code_climate:
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## v2.1.0
4
+
5
+ * Add ability to pass connection options to the Faraday connection (@jhanggi)
6
+
7
+ ## v2.0.1
8
+
9
+ * Upgrades `faraday` and `faraday_middleware` dependency versions
10
+
11
+ ## v2.0.0
12
+
13
+ * Added support for Profile Service (@AndreiBujenitsa)
14
+ * Removes Deposit Service support
15
+
16
+ ## v1.1.1
17
+
18
+ * Reintroduced Capture and Inquire settlement status constants to resolve some compatibility issues
19
+
20
+ ## v1.1.0
21
+
22
+ * Adding the `profileid` to the Authorization Response.
23
+ * Added fields necessary for Authorization Capture requests
24
+
25
+ ## v1.0.0
26
+
27
+ * First version! Don't downgrade from here!
data/README.md CHANGED
@@ -37,6 +37,16 @@ CardConnect.configure do |config|
37
37
  end
38
38
  ```
39
39
 
40
+ You may pass additional options into the [Faraday connection](https://github.com/lostisland/faraday/blob/master/lib/faraday/connection.rb) via `connection_options`.
41
+
42
+ ```ruby
43
+ CardConnection.configure do |config|
44
+ config.connection_options = { ssl: your_ssl_options }
45
+ end
46
+ ```
47
+
48
+ _Note: We do not recommend setting `verify: false`_
49
+
40
50
  ## Services
41
51
 
42
52
  ### Authorization Service
@@ -5,8 +5,10 @@ module CardConnect
5
5
  attr_accessor :api_username
6
6
  attr_accessor :api_password
7
7
  attr_accessor :endpoint
8
+ attr_accessor :connection_options
8
9
 
9
10
  def initialize
11
+ @connection_options = {}
10
12
  end
11
13
  end
12
14
  end
@@ -3,13 +3,12 @@ require 'faraday_middleware'
3
3
 
4
4
  module CardConnect
5
5
  class Connection
6
- def initialize
7
- @config = CardConnect.configuration
8
- @headers = { user_agent: "CardConnectRubyGem/#{CardConnect::VERSION}" }
6
+ def initialize(config = CardConnect.configuration)
7
+ @config = config
9
8
  end
10
9
 
11
10
  def connection
12
- @connection ||= Faraday.new(url: @config.endpoint, headers: @headers, ssl: { verify: false }) do |f|
11
+ @connection ||= Faraday.new(faraday_options) do |f|
13
12
  f.request :basic_auth, @config.api_username, @config.api_password
14
13
  f.request :json
15
14
 
@@ -27,5 +26,14 @@ module CardConnect
27
26
  rescue Faraday::ClientError => e
28
27
  return e
29
28
  end
29
+
30
+ def faraday_options
31
+ {
32
+ url: @config.endpoint,
33
+ headers: {
34
+ user_agent: "CardConnectRubyGem/#{CardConnect::VERSION}"
35
+ },
36
+ }.merge(@config.connection_options)
37
+ end
30
38
  end
31
39
  end
@@ -1,3 +1,3 @@
1
1
  module CardConnect
2
- VERSION = '2.0.1'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -24,4 +24,8 @@ describe CardConnect::Configuration do
24
24
  it 'must respond to endpoint' do
25
25
  @config.must_respond_to :endpoint
26
26
  end
27
+
28
+ it 'must respond to connection_options' do
29
+ @config.must_respond_to :connection_options
30
+ end
27
31
  end
@@ -31,6 +31,17 @@ describe CardConnect::Connection do
31
31
  it 'must have a handler for parsing the json response third' do
32
32
  @connection.builder.handlers[2].must_be :===, FaradayMiddleware::ParseJson
33
33
  end
34
+
35
+ it 'has ssl verification on by default' do
36
+ assert(@connection.ssl.verify?)
37
+ end
38
+
39
+ it 'has the ability to accept ssl options' do
40
+ config = CardConnect.configuration.dup
41
+ config.connection_options = { ssl: { verify: false } }
42
+ connection = CardConnect::Connection.new(config).connection
43
+ refute(connection.ssl.verify)
44
+ end
34
45
  end
35
46
  end
36
47
  end
@@ -19,7 +19,7 @@ end
19
19
  module CardConnect
20
20
  class Connection
21
21
  def connection
22
- @connection ||= Faraday.new(url: @config.endpoint, headers: @headers) do |faraday|
22
+ @connection ||= Faraday.new(faraday_options) do |faraday|
23
23
  faraday.request :basic_auth, @config.api_username, @config.api_password
24
24
  faraday.request :json
25
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim McKenzie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-10-13 00:00:00.000000000 Z
13
+ date: 2017-12-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -67,6 +67,7 @@ files:
67
67
  - ".gitignore"
68
68
  - ".rubocop.yml"
69
69
  - ".travis.yml"
70
+ - CHANGELOG.md
70
71
  - Gemfile
71
72
  - LICENSE.txt
72
73
  - README.md