vertebrae 0.4.2 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +26 -0
- data/.ruby-version +1 -1
- data/.travis.yml +7 -1
- data/Gemfile +6 -8
- data/VERSION +1 -1
- data/lib/api.rb +2 -0
- data/lib/authorization.rb +2 -0
- data/lib/base.rb +4 -2
- data/lib/configuration.rb +41 -10
- data/lib/connection.rb +7 -4
- data/lib/constants.rb +2 -0
- data/lib/core_ext/array.rb +2 -0
- data/lib/model.rb +2 -0
- data/lib/railties.rb +2 -0
- data/lib/request.rb +2 -0
- data/lib/response/raise_error.rb +2 -0
- data/lib/response_error.rb +4 -2
- data/lib/vertebrae.rb +2 -2
- data/spec/api_spec.rb +2 -0
- data/spec/configuration_spec.rb +68 -2
- data/spec/logger_spec.rb +2 -0
- data/spec/request_spec.rb +12 -0
- data/spec/spec_helper.rb +4 -2
- data/vertebrae.gemspec +20 -18
- metadata +30 -18
- data/Gemfile.lock +0 -107
- data/lib/request/basic_auth.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cf3a9bf8bfca0580686334117e85642dd95ac68ccd6ed92970bc6b264ad8981c
|
4
|
+
data.tar.gz: b0a4495f29d0a76490661212d6309b09c42e13efc8f97836d5c6feb2382c6748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82f9f65cae54ccdc589f01c098c6f502bf33d11d31f9c2b47d9bacf348b7a2efc481b6655a8a9d253c5c24059eb71b0eca99e6e13b9e5071eb89a8886b09b38
|
7
|
+
data.tar.gz: 7319717ad0841ec271dfbc9333d4d86297ac6f5da70b65a4359c73d0f01758a62614dce82efac8219ed7895684acca3ea146c07bd9a84caed032473e0d85048e
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisabledByDefault: true
|
3
|
+
|
4
|
+
Security:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
Bundler/DuplicatedGem:
|
8
|
+
Enabled: true
|
9
|
+
Bundler/InsecureProtocolSource:
|
10
|
+
Enabled: true
|
11
|
+
Layout/IndentationStyle:
|
12
|
+
Enabled: true
|
13
|
+
Layout/SpaceInsideRangeLiteral:
|
14
|
+
Enabled: true
|
15
|
+
Lint:
|
16
|
+
Enabled: true
|
17
|
+
Lint/RaiseException:
|
18
|
+
Enabled: true
|
19
|
+
Naming/AsciiIdentifiers:
|
20
|
+
Enabled: true
|
21
|
+
Naming/ClassAndModuleCamelCase:
|
22
|
+
Enabled: true
|
23
|
+
Naming/ConstantName:
|
24
|
+
Enabled: true
|
25
|
+
Naming/FileName:
|
26
|
+
Enabled: true
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
|
5
|
-
gem 'activesupport'
|
6
|
-
gem 'faraday', '>= 0.9.2'
|
7
|
-
gem 'faraday_middleware'
|
8
|
-
gem 'hashie'
|
9
2
|
|
3
|
+
gem 'activesupport', '>= 5.1.4'
|
4
|
+
gem 'faraday', '> 0.9.2'
|
5
|
+
gem 'faraday_middleware', '> 0.12.2'
|
6
|
+
gem 'hashie', '> 3.5.7'
|
10
7
|
|
11
8
|
# Add dependencies to develop your gem here.
|
12
9
|
# Include everything needed to run rake, tests, features, etc.
|
@@ -15,5 +12,6 @@ group :development do
|
|
15
12
|
gem "bundler"
|
16
13
|
gem "webmock"
|
17
14
|
gem "rspec-its"
|
18
|
-
gem "juwelier"
|
15
|
+
gem "juwelier", git: 'git@github.com:flajann2/juwelier.git'
|
16
|
+
gem "rubocop"
|
19
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.2
|
data/lib/api.rb
CHANGED
data/lib/authorization.rb
CHANGED
data/lib/base.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Vertebrae
|
2
4
|
module Base
|
3
5
|
def logger
|
@@ -20,7 +22,7 @@ module Vertebrae
|
|
20
22
|
|
21
23
|
# implement this in your api
|
22
24
|
#
|
23
|
-
def new(
|
25
|
+
def new(_options = {}, &_block)
|
24
26
|
raise "implement me!"
|
25
27
|
end
|
26
28
|
|
@@ -36,4 +38,4 @@ module Vertebrae
|
|
36
38
|
new.respond_to?(method, include_private) || super(method, include_private)
|
37
39
|
end
|
38
40
|
end
|
39
|
-
end
|
41
|
+
end
|
data/lib/configuration.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Vertebrae
|
2
4
|
class Configuration
|
3
5
|
include Vertebrae::Constants
|
@@ -5,7 +7,6 @@ module Vertebrae
|
|
5
7
|
include Authorization
|
6
8
|
|
7
9
|
VALID_OPTIONS_KEYS = [
|
8
|
-
:adapter,
|
9
10
|
:prefix,
|
10
11
|
:ssl,
|
11
12
|
:mime_type,
|
@@ -16,12 +17,10 @@ module Vertebrae
|
|
16
17
|
:connection_options,
|
17
18
|
:content_type,
|
18
19
|
:scheme,
|
19
|
-
:port
|
20
|
+
:port,
|
21
|
+
:additional_headers
|
20
22
|
].freeze
|
21
23
|
|
22
|
-
# Other adapters are :typhoeus, :patron, :em_synchrony, :excon, :test
|
23
|
-
DEFAULT_ADAPTER = :net_http
|
24
|
-
|
25
24
|
# The default HTTP scheme configuration
|
26
25
|
DEFAULT_SCHEME = 'https'
|
27
26
|
|
@@ -53,7 +52,7 @@ module Vertebrae
|
|
53
52
|
DEFAULT_CONNECTION_OPTIONS = {}
|
54
53
|
|
55
54
|
DEFAULT_CONTENT_TYPE = 'application/json'.freeze
|
56
|
-
|
55
|
+
DEFAULT_ADDITIONAL_HEADERS = {}.freeze
|
57
56
|
|
58
57
|
VALID_OPTIONS_KEYS.each do | key |
|
59
58
|
define_method("default_#{key}".intern) { default_options[key] }
|
@@ -71,6 +70,14 @@ module Vertebrae
|
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
73
|
+
def adapter
|
74
|
+
options[:adapter] || auto_detect_adapter
|
75
|
+
end
|
76
|
+
|
77
|
+
def adapter=(value)
|
78
|
+
options[:adapter] = value
|
79
|
+
end
|
80
|
+
|
74
81
|
attr_accessor :options
|
75
82
|
attr_accessor :default_options
|
76
83
|
|
@@ -91,10 +98,10 @@ module Vertebrae
|
|
91
98
|
ACCEPT_CHARSET => "utf-8",
|
92
99
|
USER_AGENT => user_agent,
|
93
100
|
CONTENT_TYPE => content_type
|
94
|
-
},
|
95
|
-
:ssl =>
|
101
|
+
}.merge(additional_headers),
|
102
|
+
:ssl => ssl,
|
96
103
|
:url => endpoint
|
97
|
-
}
|
104
|
+
}.merge(connection_options)
|
98
105
|
end
|
99
106
|
|
100
107
|
|
@@ -114,5 +121,29 @@ module Vertebrae
|
|
114
121
|
def endpoint
|
115
122
|
"#{self.scheme}://#{self.host}#{self.port.present? ? ":#{self.port}" : ''}#{self.prefix}"
|
116
123
|
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
# Auto-detect the best adapter (HTTP "driver") available, based on libraries
|
128
|
+
# loaded by the user, preferring those with persistent connections
|
129
|
+
# ("keep-alive") by default
|
130
|
+
#
|
131
|
+
# @return [Symbol]
|
132
|
+
#
|
133
|
+
#
|
134
|
+
def auto_detect_adapter
|
135
|
+
case
|
136
|
+
when defined?(::Typhoeus)
|
137
|
+
:typhoeus
|
138
|
+
when defined?(::Patron)
|
139
|
+
:patron
|
140
|
+
when defined?(::HTTPClient)
|
141
|
+
:httpclient
|
142
|
+
when defined?(::Net::HTTP::Persistent)
|
143
|
+
:net_http_persistent
|
144
|
+
else
|
145
|
+
::Faraday.default_adapter
|
146
|
+
end
|
147
|
+
end
|
117
148
|
end
|
118
|
-
end
|
149
|
+
end
|
data/lib/connection.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'faraday_middleware'
|
3
|
-
require 'request/basic_auth'
|
4
5
|
require 'response/raise_error'
|
5
6
|
require 'authorization'
|
6
7
|
|
@@ -9,7 +10,7 @@ module Vertebrae
|
|
9
10
|
include Vertebrae::Constants
|
10
11
|
include Vertebrae::Authorization
|
11
12
|
|
12
|
-
|
13
|
+
attr_reader :options
|
13
14
|
attr_accessor :configuration
|
14
15
|
|
15
16
|
ALLOWED_OPTIONS = [
|
@@ -38,7 +39,9 @@ module Vertebrae
|
|
38
39
|
Proc.new do |builder|
|
39
40
|
builder.use Faraday::Request::Multipart
|
40
41
|
builder.use Faraday::Request::UrlEncoded
|
41
|
-
|
42
|
+
if configuration.authenticated?
|
43
|
+
builder.use Faraday::Request::BasicAuthentication, configuration.username, configuration.password
|
44
|
+
end
|
42
45
|
|
43
46
|
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
44
47
|
unless options[:raw]
|
@@ -69,4 +72,4 @@ module Vertebrae
|
|
69
72
|
Faraday.new(configuration.faraday_options.merge(:builder => stack))
|
70
73
|
end
|
71
74
|
end
|
72
|
-
end
|
75
|
+
end
|
data/lib/constants.rb
CHANGED
data/lib/core_ext/array.rb
CHANGED
data/lib/model.rb
CHANGED
data/lib/railties.rb
CHANGED
data/lib/request.rb
CHANGED
data/lib/response/raise_error.rb
CHANGED
data/lib/response_error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Vertebrae
|
2
4
|
class ResponseError < StandardError
|
3
5
|
attr_reader :status_code
|
@@ -10,7 +12,7 @@ module Vertebrae
|
|
10
12
|
private
|
11
13
|
|
12
14
|
def error_message(response)
|
13
|
-
"#{response[:method].to_s.upcase} #{response[:url]
|
15
|
+
"#{response[:method].to_s.upcase} #{response[:url]}: #{response[:status]} \n\n #{response[:body] if response[:body]}"
|
14
16
|
end
|
15
17
|
end
|
16
|
-
end
|
18
|
+
end
|
data/lib/vertebrae.rb
CHANGED
data/spec/api_spec.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Vertebrae::Configuration do
|
4
6
|
|
5
7
|
subject { Vertebrae::Configuration.new({}) }
|
6
8
|
|
7
|
-
{:
|
8
|
-
:scheme => described_class::DEFAULT_SCHEME,
|
9
|
+
{:scheme => described_class::DEFAULT_SCHEME,
|
9
10
|
:ssl => described_class::DEFAULT_SSL,
|
10
11
|
:user_agent => described_class::DEFAULT_USER_AGENT,
|
11
12
|
:username => described_class::DEFAULT_USERNAME,
|
@@ -59,4 +60,69 @@ describe Vertebrae::Configuration do
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
63
|
+
|
64
|
+
describe 'adapter' do
|
65
|
+
it 'should default to :net_http' do
|
66
|
+
expect(subject.adapter).to eq(:net_http)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'adapter=' do
|
71
|
+
it 'should allow setting and retrieval' do
|
72
|
+
subject.adapter = :foo
|
73
|
+
expect(subject.adapter).to eq(:foo)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '#faraday_options' do
|
78
|
+
subject { Vertebrae::Configuration.new(host: 'example.com') }
|
79
|
+
|
80
|
+
it 'should include headers, ssl, and url settings by default' do
|
81
|
+
opts = subject.faraday_options
|
82
|
+
expect(opts.keys).to contain_exactly(:headers, :ssl, :url)
|
83
|
+
expect(opts[:headers]).to eq({'Accept' => 'application/json;q=0.1',
|
84
|
+
'Accept-Charset' => 'utf-8',
|
85
|
+
'User-Agent' => 'Vertebrae REST Gem',
|
86
|
+
'Content-Type' => 'application/json'})
|
87
|
+
expect(opts[:ssl]).to eq({})
|
88
|
+
expect(opts[:url]).to eq 'https://example.com/'
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'with connection_options' do
|
92
|
+
let(:connection_options) { {ssl: {verify: false},
|
93
|
+
timeout: 5} }
|
94
|
+
|
95
|
+
subject { Vertebrae::Configuration.new(host: 'example.com', connection_options: connection_options) }
|
96
|
+
|
97
|
+
it 'should override and extend the default options' do
|
98
|
+
opts = subject.faraday_options
|
99
|
+
expect(opts.keys).to contain_exactly(:headers, :ssl, :timeout, :url)
|
100
|
+
expect(opts[:headers]).to eq({'Accept' => 'application/json;q=0.1',
|
101
|
+
'Accept-Charset' => 'utf-8',
|
102
|
+
'User-Agent' => 'Vertebrae REST Gem',
|
103
|
+
'Content-Type' => 'application/json'})
|
104
|
+
expect(opts[:ssl]).to eq({verify: false})
|
105
|
+
expect(opts[:url]).to eq 'https://example.com/'
|
106
|
+
expect(opts[:timeout]).to eq 5
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'with additional_headers' do
|
111
|
+
let(:additional_headers) { {'special-auth-token' => 'abcde12345'} }
|
112
|
+
|
113
|
+
subject { Vertebrae::Configuration.new(host: 'example.com', additional_headers: additional_headers) }
|
114
|
+
|
115
|
+
it 'should add the additional headers to the other headers' do
|
116
|
+
opts = subject.faraday_options
|
117
|
+
expect(opts.keys).to contain_exactly(:headers, :ssl, :url)
|
118
|
+
expect(opts[:headers]).to eq({'Accept' => 'application/json;q=0.1',
|
119
|
+
'Accept-Charset' => 'utf-8',
|
120
|
+
'User-Agent' => 'Vertebrae REST Gem',
|
121
|
+
'Content-Type' => 'application/json',
|
122
|
+
'special-auth-token' => 'abcde12345'})
|
123
|
+
expect(opts[:ssl]).to eq({})
|
124
|
+
expect(opts[:url]).to eq 'https://example.com/'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
62
128
|
end
|
data/spec/logger_spec.rb
CHANGED
data/spec/request_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Vertebrae::Request do
|
@@ -73,5 +75,15 @@ describe Vertebrae::Request do
|
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
78
|
+
|
79
|
+
context 'with basic auth' do
|
80
|
+
let(:options) { {} }
|
81
|
+
let(:vb) { Vertebrae::API.new username: 'user', password: 'pass' }
|
82
|
+
|
83
|
+
it 'should make requests with basic auth' do
|
84
|
+
stub_request(:get, 'https://test3.com/path').with(basic_auth: ['user', 'pass'])
|
85
|
+
vb.request(:get, '/path', {}, {host: 'test3.com'})
|
86
|
+
end
|
87
|
+
end
|
76
88
|
end
|
77
89
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
5
|
require 'rspec'
|
@@ -10,7 +12,7 @@ require 'rspec/its'
|
|
10
12
|
|
11
13
|
# Requires supporting files with custom matchers and macros, etc,
|
12
14
|
# in ./support/ and its subdirectories.
|
13
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
15
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each {|f| require f}
|
14
16
|
|
15
17
|
RSpec.configure do |config|
|
16
18
|
config.mock_with :rspec do |mocks|
|
@@ -24,7 +26,7 @@ end
|
|
24
26
|
|
25
27
|
|
26
28
|
def reset_authentication_for(object)
|
27
|
-
[
|
29
|
+
%w[username password].each do |item|
|
28
30
|
Vertebrae::Base.send("#{item}=", nil)
|
29
31
|
object.send("#{item}=", nil)
|
30
32
|
end
|
data/vertebrae.gemspec
CHANGED
@@ -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.
|
5
|
+
# stub: vertebrae 0.6.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vertebrae".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.6.2"
|
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 = "
|
14
|
+
s.date = "2020-06-06"
|
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 = [
|
@@ -21,11 +21,11 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".rspec",
|
24
|
+
".rubocop.yml",
|
24
25
|
".ruby-gemset",
|
25
26
|
".ruby-version",
|
26
27
|
".travis.yml",
|
27
28
|
"Gemfile",
|
28
|
-
"Gemfile.lock",
|
29
29
|
"LICENSE.txt",
|
30
30
|
"README.rdoc",
|
31
31
|
"Rakefile",
|
@@ -40,7 +40,6 @@ Gem::Specification.new do |s|
|
|
40
40
|
"lib/model.rb",
|
41
41
|
"lib/railties.rb",
|
42
42
|
"lib/request.rb",
|
43
|
-
"lib/request/basic_auth.rb",
|
44
43
|
"lib/response/raise_error.rb",
|
45
44
|
"lib/response_error.rb",
|
46
45
|
"lib/vertebrae.rb",
|
@@ -55,43 +54,46 @@ Gem::Specification.new do |s|
|
|
55
54
|
]
|
56
55
|
s.homepage = "http://github.com/controlshift/vertebrae".freeze
|
57
56
|
s.licenses = ["MIT".freeze]
|
58
|
-
s.rubygems_version = "
|
57
|
+
s.rubygems_version = "3.0.8".freeze
|
59
58
|
s.summary = "API Client Infrastructure".freeze
|
60
59
|
|
61
60
|
if s.respond_to? :specification_version then
|
62
61
|
s.specification_version = 4
|
63
62
|
|
64
63
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
|
-
s.add_runtime_dependency(%q<activesupport>.freeze, [">=
|
66
|
-
s.add_runtime_dependency(%q<faraday>.freeze, ["
|
67
|
-
s.add_runtime_dependency(%q<faraday_middleware>.freeze, ["
|
68
|
-
s.add_runtime_dependency(%q<hashie>.freeze, ["
|
64
|
+
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 5.1.4"])
|
65
|
+
s.add_runtime_dependency(%q<faraday>.freeze, ["> 0.9.2"])
|
66
|
+
s.add_runtime_dependency(%q<faraday_middleware>.freeze, ["> 0.12.2"])
|
67
|
+
s.add_runtime_dependency(%q<hashie>.freeze, ["> 3.5.7"])
|
69
68
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
70
69
|
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
71
70
|
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
72
71
|
s.add_development_dependency(%q<rspec-its>.freeze, [">= 0"])
|
73
72
|
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
74
74
|
else
|
75
|
-
s.add_dependency(%q<activesupport>.freeze, [">=
|
76
|
-
s.add_dependency(%q<faraday>.freeze, ["
|
77
|
-
s.add_dependency(%q<faraday_middleware>.freeze, ["
|
78
|
-
s.add_dependency(%q<hashie>.freeze, ["
|
75
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 5.1.4"])
|
76
|
+
s.add_dependency(%q<faraday>.freeze, ["> 0.9.2"])
|
77
|
+
s.add_dependency(%q<faraday_middleware>.freeze, ["> 0.12.2"])
|
78
|
+
s.add_dependency(%q<hashie>.freeze, ["> 3.5.7"])
|
79
79
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
80
80
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
81
81
|
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
82
82
|
s.add_dependency(%q<rspec-its>.freeze, [">= 0"])
|
83
83
|
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
84
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
84
85
|
end
|
85
86
|
else
|
86
|
-
s.add_dependency(%q<activesupport>.freeze, [">=
|
87
|
-
s.add_dependency(%q<faraday>.freeze, ["
|
88
|
-
s.add_dependency(%q<faraday_middleware>.freeze, ["
|
89
|
-
s.add_dependency(%q<hashie>.freeze, ["
|
87
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 5.1.4"])
|
88
|
+
s.add_dependency(%q<faraday>.freeze, ["> 0.9.2"])
|
89
|
+
s.add_dependency(%q<faraday_middleware>.freeze, ["> 0.12.2"])
|
90
|
+
s.add_dependency(%q<hashie>.freeze, ["> 3.5.7"])
|
90
91
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
91
92
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
92
93
|
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
93
94
|
s.add_dependency(%q<rspec-its>.freeze, [">= 0"])
|
94
95
|
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
96
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
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
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.1.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.1.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.9.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.9.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday_middleware
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.12.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.12.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hashie
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.5.7
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.5.7
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description: A set of low level infrastructure and reusable code for building API
|
140
154
|
clients
|
141
155
|
email: nathan@controlshiftlabs.com
|
@@ -147,11 +161,11 @@ extra_rdoc_files:
|
|
147
161
|
files:
|
148
162
|
- ".document"
|
149
163
|
- ".rspec"
|
164
|
+
- ".rubocop.yml"
|
150
165
|
- ".ruby-gemset"
|
151
166
|
- ".ruby-version"
|
152
167
|
- ".travis.yml"
|
153
168
|
- Gemfile
|
154
|
-
- Gemfile.lock
|
155
169
|
- LICENSE.txt
|
156
170
|
- README.rdoc
|
157
171
|
- Rakefile
|
@@ -166,7 +180,6 @@ files:
|
|
166
180
|
- lib/model.rb
|
167
181
|
- lib/railties.rb
|
168
182
|
- lib/request.rb
|
169
|
-
- lib/request/basic_auth.rb
|
170
183
|
- lib/response/raise_error.rb
|
171
184
|
- lib/response_error.rb
|
172
185
|
- lib/vertebrae.rb
|
@@ -197,8 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
210
|
- !ruby/object:Gem::Version
|
198
211
|
version: '0'
|
199
212
|
requirements: []
|
200
|
-
|
201
|
-
rubygems_version: 2.5.2
|
213
|
+
rubygems_version: 3.0.8
|
202
214
|
signing_key:
|
203
215
|
specification_version: 4
|
204
216
|
summary: API Client Infrastructure
|
data/Gemfile.lock
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (5.1.3)
|
5
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
-
i18n (~> 0.7)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
tzinfo (~> 1.1)
|
9
|
-
addressable (2.4.0)
|
10
|
-
builder (3.2.3)
|
11
|
-
concurrent-ruby (1.0.5)
|
12
|
-
crack (0.4.3)
|
13
|
-
safe_yaml (~> 1.0.0)
|
14
|
-
descendants_tracker (0.0.4)
|
15
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
16
|
-
diff-lcs (1.3)
|
17
|
-
faraday (0.9.2)
|
18
|
-
multipart-post (>= 1.2, < 3)
|
19
|
-
faraday_middleware (0.12.2)
|
20
|
-
faraday (>= 0.7.4, < 1.0)
|
21
|
-
git (1.3.0)
|
22
|
-
github_api (0.17.0)
|
23
|
-
addressable (~> 2.4.0)
|
24
|
-
descendants_tracker (~> 0.0.4)
|
25
|
-
faraday (~> 0.8, < 0.10)
|
26
|
-
hashie (>= 3.4)
|
27
|
-
mime-types (>= 1.16, < 3.0)
|
28
|
-
oauth2 (~> 1.0)
|
29
|
-
hashdiff (0.3.5)
|
30
|
-
hashie (3.5.6)
|
31
|
-
highline (1.7.8)
|
32
|
-
i18n (0.8.6)
|
33
|
-
juwelier (2.4.7)
|
34
|
-
builder
|
35
|
-
bundler
|
36
|
-
git
|
37
|
-
github_api
|
38
|
-
highline
|
39
|
-
kamelcase (~> 0)
|
40
|
-
nokogiri
|
41
|
-
psych
|
42
|
-
rake
|
43
|
-
rdoc
|
44
|
-
semver2
|
45
|
-
jwt (1.5.6)
|
46
|
-
kamelcase (0.0.1)
|
47
|
-
semver2 (~> 3)
|
48
|
-
mime-types (2.99.3)
|
49
|
-
mini_portile2 (2.2.0)
|
50
|
-
minitest (5.10.3)
|
51
|
-
multi_json (1.12.1)
|
52
|
-
multi_xml (0.6.0)
|
53
|
-
multipart-post (2.0.0)
|
54
|
-
nokogiri (1.8.0)
|
55
|
-
mini_portile2 (~> 2.2.0)
|
56
|
-
oauth2 (1.4.0)
|
57
|
-
faraday (>= 0.8, < 0.13)
|
58
|
-
jwt (~> 1.0)
|
59
|
-
multi_json (~> 1.3)
|
60
|
-
multi_xml (~> 0.5)
|
61
|
-
rack (>= 1.2, < 3)
|
62
|
-
psych (2.2.4)
|
63
|
-
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)
|
73
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
-
rspec-support (~> 3.6.0)
|
75
|
-
rspec-its (1.2.0)
|
76
|
-
rspec-core (>= 3.0.0)
|
77
|
-
rspec-expectations (>= 3.0.0)
|
78
|
-
rspec-mocks (3.6.0)
|
79
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.6.0)
|
81
|
-
rspec-support (3.6.0)
|
82
|
-
safe_yaml (1.0.4)
|
83
|
-
semver2 (3.4.2)
|
84
|
-
thread_safe (0.3.6)
|
85
|
-
tzinfo (1.2.3)
|
86
|
-
thread_safe (~> 0.1)
|
87
|
-
webmock (3.0.1)
|
88
|
-
addressable (>= 2.3.6)
|
89
|
-
crack (>= 0.3.2)
|
90
|
-
hashdiff
|
91
|
-
|
92
|
-
PLATFORMS
|
93
|
-
ruby
|
94
|
-
|
95
|
-
DEPENDENCIES
|
96
|
-
activesupport
|
97
|
-
bundler
|
98
|
-
faraday (>= 0.9.2)
|
99
|
-
faraday_middleware
|
100
|
-
hashie
|
101
|
-
juwelier
|
102
|
-
rspec
|
103
|
-
rspec-its
|
104
|
-
webmock
|
105
|
-
|
106
|
-
BUNDLED WITH
|
107
|
-
1.15.4
|
data/lib/request/basic_auth.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Vertebrae
|
2
|
-
module Request
|
3
|
-
class BasicAuth < Faraday::Middleware
|
4
|
-
dependency 'base64'
|
5
|
-
|
6
|
-
def call(env)
|
7
|
-
env[:request_headers].merge!('Authorization' => "Basic #{@auth}\"")
|
8
|
-
|
9
|
-
@app.call env
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(app, *args)
|
13
|
-
@app = app
|
14
|
-
credentials = ""
|
15
|
-
options = args.extract_options!
|
16
|
-
if options.has_key? :username
|
17
|
-
credentials = "#{options[:username]}:#{options[:password]}"
|
18
|
-
elsif options.has_key? :basic_auth
|
19
|
-
credentials = "#{options[:basic_auth]}"
|
20
|
-
end
|
21
|
-
@auth = Base64.encode64(credentials)
|
22
|
-
@auth.gsub!("\n", "")
|
23
|
-
end
|
24
|
-
end # BasicAuth
|
25
|
-
end
|
26
|
-
end
|