passfort 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c013a4f7ffd719e32ebee5be88c3372af875f7089647f57a698974879117ac16
4
- data.tar.gz: 5c910f390dd5bd5215b5292ae099400022a3234f413d577e12b6809b714792c1
3
+ metadata.gz: 6895fae5e18a47206f33b537029a9b9ada673f0dc2c707bcc3eb041e2b054746
4
+ data.tar.gz: 60682b4845fd07a3cf4b9f009a9362f0cff7f1d6825ee94f6e4de31ddb99ecca
5
5
  SHA512:
6
- metadata.gz: da3bfde367aec9a97b9337ec09fc9451cf9455a7ac6a028e29898da0dcd055f8ec92187db0934b0d15891ebf001fd3fd8aff8c796a3fc036873b441e69b8f9c5
7
- data.tar.gz: e4f2fc6b6036d772048847328466d66bc26f1e688c5c64f3f13f65698641521e1273a7c5dd8626e1051e29bfc867adc30dd07a2ecfe3986b7cf0b02c793718a3
6
+ metadata.gz: e2484850489eb6035f75e64e1baa608c2c1a6d75677ffbcbf2a2998c0face9cffacdd6631c3079da8aa4f76d68047ad79799b7a5844bcf4fd7066dda85094d83
7
+ data.tar.gz: a6b4fe95090fda50ec1fe4022383e5ac6c62bcba55d4e5ecfe03de381658c4fb98febc30adb0d42d7b2a5ce03a519748b11e57bc549b363e865721125ea771d0
@@ -6,6 +6,11 @@ Unreleased
6
6
 
7
7
  No changes.
8
8
 
9
+ 0.3.1
10
+ -----
11
+
12
+ - Allow setting connection properties
13
+
9
14
  0.3.0
10
15
  -----
11
16
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- passfort (0.3.0)
4
+ passfort (0.3.1)
5
5
  activesupport (~> 5.0)
6
6
  excon (~> 0.60)
7
7
 
@@ -4,8 +4,8 @@ require "passfort/http"
4
4
 
5
5
  module Passfort
6
6
  class Client
7
- def initialize(api_key:)
8
- @http = Passfort::Http.new(api_key)
7
+ def initialize(api_key:, excon_opts: {})
8
+ @http = Passfort::Http.new(api_key, excon_opts)
9
9
  end
10
10
 
11
11
  def profiles
@@ -9,9 +9,12 @@ module Passfort
9
9
  DOMAIN = "https://api.passfort.com"
10
10
  ROOT_PATH = "/4.0"
11
11
 
12
- def initialize(api_key, connection: Excon.new(DOMAIN))
12
+ attr_reader :api_key, :connection
13
+
14
+ def initialize(api_key, excon_opts = {})
13
15
  @api_key = api_key
14
- @connection = connection
16
+ uri = excon_opts[:domain] || DOMAIN
17
+ @connection = Excon.new(uri, excon_opts.except(:domain))
15
18
  end
16
19
 
17
20
  def get(path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Passfort
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -110,6 +110,34 @@ RSpec.describe Passfort::Http do
110
110
  end
111
111
  end
112
112
 
113
+ describe "#initialize" do
114
+ describe "with an API key" do
115
+ it "sets the .api_key" do
116
+ expect(http.api_key).to eq("api_key")
117
+ end
118
+
119
+ it "sets a default endpoint" do
120
+ expect(described_class::DOMAIN).to include(http.connection.data[:hostname])
121
+ end
122
+ end
123
+
124
+ it "accepts an alternate endpoint" do
125
+ example_endpoint = "https://example.net"
126
+ client = described_class.new("api_key", "domain": example_endpoint)
127
+ expect(example_endpoint).to include(client.connection.data[:hostname])
128
+ end
129
+
130
+ it "supports setting open_timeout" do
131
+ http = described_class.new("api_key", "open_timeout": 1)
132
+ expect(http.connection.data[:open_timeout]).to eq(1)
133
+ end
134
+
135
+ it "supports setting read_timeout" do
136
+ http = described_class.new("api_key", "read_timeout": 2)
137
+ expect(http.connection.data[:read_timeout]).to eq(2)
138
+ end
139
+ end
140
+
113
141
  describe "#get" do
114
142
  subject { -> { http.get(path) } }
115
143
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passfort
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-06 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport