vertebrae 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: a928279424eb899757bacc41c172bf9bb32b279c
4
- data.tar.gz: 29e46c54cc0cba4f578fc375cdd8e754ca3527a9
3
+ metadata.gz: 3d3d13a6b72c1baeb513620e39717bbada581049
4
+ data.tar.gz: bae900e52ac1a0d3ef22fd4ffb5664380b175891
5
5
  SHA512:
6
- metadata.gz: 1c085387d00a6495198ff444f898e2fdf5495d8fd9f05e041af3f58698deebb5070055381f8df834253c0ad0eff0c1ca8fd76903d46dac02e4c33a0e77d3c47d
7
- data.tar.gz: 6499401c11552892c1cab0f4faa0434910f9e1c72f06b5c5d95346afd74ad0a81e3a002816184398448b52b33937b8faf0e3fc224c7e9cd7df2fcfd97bd05706
6
+ metadata.gz: '09831d8fdf212c8180f9577688580b575ad9bb60c47171961d57af820ee6ee642d5a2347ee7d4258b1c8468112dd269e7445f7d2423164149306a16da6e178e4'
7
+ data.tar.gz: 13fd2deb93bd83e5db3b92162e9e0f15b6ff57d86e20c2ce68186900c618df68cb7967cec5c8674a9ea73e5775c8bb04bf1710c92cb801dc015ac4b4973ee091
@@ -1 +1 @@
1
- 2.3.4
1
+ 2.4.2
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.2.4"
3
+ - "2.4.2"
@@ -1,12 +1,13 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (5.1.3)
4
+ activesupport (5.1.4)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
6
  i18n (~> 0.7)
7
7
  minitest (~> 5.1)
8
8
  tzinfo (~> 1.1)
9
- addressable (2.4.0)
9
+ addressable (2.5.2)
10
+ public_suffix (>= 2.0.2, < 4.0)
10
11
  builder (3.2.3)
11
12
  concurrent-ruby (1.0.5)
12
13
  crack (0.4.3)
@@ -14,22 +15,22 @@ GEM
14
15
  descendants_tracker (0.0.4)
15
16
  thread_safe (~> 0.3, >= 0.3.1)
16
17
  diff-lcs (1.3)
17
- faraday (0.9.2)
18
+ faraday (0.12.2)
18
19
  multipart-post (>= 1.2, < 3)
19
20
  faraday_middleware (0.12.2)
20
21
  faraday (>= 0.7.4, < 1.0)
21
22
  git (1.3.0)
22
- github_api (0.17.0)
23
- addressable (~> 2.4.0)
23
+ github_api (0.18.2)
24
+ addressable (~> 2.4)
24
25
  descendants_tracker (~> 0.0.4)
25
- faraday (~> 0.8, < 0.10)
26
- hashie (>= 3.4)
27
- mime-types (>= 1.16, < 3.0)
26
+ faraday (~> 0.8)
27
+ hashie (~> 3.5, >= 3.5.2)
28
28
  oauth2 (~> 1.0)
29
- hashdiff (0.3.5)
30
- hashie (3.5.6)
31
- highline (1.7.8)
32
- i18n (0.8.6)
29
+ hashdiff (0.3.7)
30
+ hashie (3.5.7)
31
+ highline (1.7.10)
32
+ i18n (0.9.1)
33
+ concurrent-ruby (~> 1.0)
33
34
  juwelier (2.4.7)
34
35
  builder
35
36
  bundler
@@ -45,46 +46,46 @@ GEM
45
46
  jwt (1.5.6)
46
47
  kamelcase (0.0.1)
47
48
  semver2 (~> 3)
48
- mime-types (2.99.3)
49
- mini_portile2 (2.2.0)
49
+ mini_portile2 (2.3.0)
50
50
  minitest (5.10.3)
51
- multi_json (1.12.1)
51
+ multi_json (1.12.2)
52
52
  multi_xml (0.6.0)
53
53
  multipart-post (2.0.0)
54
- nokogiri (1.8.0)
55
- mini_portile2 (~> 2.2.0)
54
+ nokogiri (1.8.1)
55
+ mini_portile2 (~> 2.3.0)
56
56
  oauth2 (1.4.0)
57
57
  faraday (>= 0.8, < 0.13)
58
58
  jwt (~> 1.0)
59
59
  multi_json (~> 1.3)
60
60
  multi_xml (~> 0.5)
61
61
  rack (>= 1.2, < 3)
62
- psych (2.2.4)
62
+ psych (3.0.2)
63
+ public_suffix (3.0.1)
63
64
  rack (2.0.3)
64
- rake (12.0.0)
65
- rdoc (5.1.0)
66
- rspec (3.6.0)
67
- rspec-core (~> 3.6.0)
68
- rspec-expectations (~> 3.6.0)
69
- rspec-mocks (~> 3.6.0)
70
- rspec-core (3.6.0)
71
- rspec-support (~> 3.6.0)
72
- rspec-expectations (3.6.0)
65
+ rake (12.3.0)
66
+ rdoc (6.0.1)
67
+ rspec (3.7.0)
68
+ rspec-core (~> 3.7.0)
69
+ rspec-expectations (~> 3.7.0)
70
+ rspec-mocks (~> 3.7.0)
71
+ rspec-core (3.7.0)
72
+ rspec-support (~> 3.7.0)
73
+ rspec-expectations (3.7.0)
73
74
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.6.0)
75
+ rspec-support (~> 3.7.0)
75
76
  rspec-its (1.2.0)
76
77
  rspec-core (>= 3.0.0)
77
78
  rspec-expectations (>= 3.0.0)
78
- rspec-mocks (3.6.0)
79
+ rspec-mocks (3.7.0)
79
80
  diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.6.0)
81
- rspec-support (3.6.0)
81
+ rspec-support (~> 3.7.0)
82
+ rspec-support (3.7.0)
82
83
  safe_yaml (1.0.4)
83
84
  semver2 (3.4.2)
84
85
  thread_safe (0.3.6)
85
- tzinfo (1.2.3)
86
+ tzinfo (1.2.4)
86
87
  thread_safe (~> 0.1)
87
- webmock (3.0.1)
88
+ webmock (3.1.1)
88
89
  addressable (>= 2.3.6)
89
90
  crack (>= 0.3.2)
90
91
  hashdiff
@@ -104,4 +105,4 @@ DEPENDENCIES
104
105
  webmock
105
106
 
106
107
  BUNDLED WITH
107
- 1.15.4
108
+ 1.16.1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -5,7 +5,6 @@ module Vertebrae
5
5
  include Authorization
6
6
 
7
7
  VALID_OPTIONS_KEYS = [
8
- :adapter,
9
8
  :prefix,
10
9
  :ssl,
11
10
  :mime_type,
@@ -19,9 +18,6 @@ module Vertebrae
19
18
  :port
20
19
  ].freeze
21
20
 
22
- # Other adapters are :typhoeus, :patron, :em_synchrony, :excon, :test
23
- DEFAULT_ADAPTER = :net_http
24
-
25
21
  # The default HTTP scheme configuration
26
22
  DEFAULT_SCHEME = 'https'
27
23
 
@@ -71,6 +67,14 @@ module Vertebrae
71
67
  end
72
68
  end
73
69
 
70
+ def adapter
71
+ options[:adapter] || auto_detect_adapter
72
+ end
73
+
74
+ def adapter=(value)
75
+ options[:adapter] = value
76
+ end
77
+
74
78
  attr_accessor :options
75
79
  attr_accessor :default_options
76
80
 
@@ -92,7 +96,7 @@ module Vertebrae
92
96
  USER_AGENT => user_agent,
93
97
  CONTENT_TYPE => content_type
94
98
  },
95
- :ssl => ssl,
99
+ :ssl => ssl,
96
100
  :url => endpoint
97
101
  }
98
102
  end
@@ -114,5 +118,29 @@ module Vertebrae
114
118
  def endpoint
115
119
  "#{self.scheme}://#{self.host}#{self.port.present? ? ":#{self.port}" : ''}#{self.prefix}"
116
120
  end
121
+
122
+ private
123
+
124
+ # Auto-detect the best adapter (HTTP "driver") available, based on libraries
125
+ # loaded by the user, preferring those with persistent connections
126
+ # ("keep-alive") by default
127
+ #
128
+ # @return [Symbol]
129
+ #
130
+ #
131
+ def auto_detect_adapter
132
+ case
133
+ when defined?(::Typhoeus)
134
+ :typhoeus
135
+ when defined?(::Patron)
136
+ :patron
137
+ when defined?(::HTTPClient)
138
+ :httpclient
139
+ when defined?(::Net::HTTP::Persistent)
140
+ :net_http_persistent
141
+ else
142
+ ::Faraday.default_adapter
143
+ end
144
+ end
117
145
  end
118
- end
146
+ end
@@ -4,8 +4,7 @@ describe Vertebrae::Configuration do
4
4
 
5
5
  subject { Vertebrae::Configuration.new({}) }
6
6
 
7
- {:adapter => described_class::DEFAULT_ADAPTER,
8
- :scheme => described_class::DEFAULT_SCHEME,
7
+ {:scheme => described_class::DEFAULT_SCHEME,
9
8
  :ssl => described_class::DEFAULT_SSL,
10
9
  :user_agent => described_class::DEFAULT_USER_AGENT,
11
10
  :username => described_class::DEFAULT_USERNAME,
@@ -59,4 +58,17 @@ describe Vertebrae::Configuration do
59
58
  end
60
59
  end
61
60
  end
61
+
62
+ describe 'adapter' do
63
+ it 'should default to :net_http' do
64
+ expect(subject.adapter).to eq(:net_http)
65
+ end
66
+ end
67
+
68
+ describe 'adapter=' do
69
+ it 'should allow setting and retrieval' do
70
+ subject.adapter = :foo
71
+ expect(subject.adapter).to eq(:foo)
72
+ end
73
+ end
62
74
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vertebrae 0.4.2 ruby lib
5
+ # stub: vertebrae 0.4.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vertebrae".freeze
9
- s.version = "0.4.2"
9
+ s.version = "0.4.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Nathan Woodhull".freeze]
14
- s.date = "2017-08-21"
14
+ s.date = "2017-12-27"
15
15
  s.description = "A set of low level infrastructure and reusable code for building API clients".freeze
16
16
  s.email = "nathan@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -55,7 +55,7 @@ Gem::Specification.new do |s|
55
55
  ]
56
56
  s.homepage = "http://github.com/controlshift/vertebrae".freeze
57
57
  s.licenses = ["MIT".freeze]
58
- s.rubygems_version = "2.5.2".freeze
58
+ s.rubygems_version = "2.6.14".freeze
59
59
  s.summary = "API Client Infrastructure".freeze
60
60
 
61
61
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertebrae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-21 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  version: '0'
199
199
  requirements: []
200
200
  rubyforge_project:
201
- rubygems_version: 2.5.2
201
+ rubygems_version: 2.6.14
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: API Client Infrastructure