vertebrae 0.4.3 → 0.7.0
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 +7 -4
- 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 +54 -0
- 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 +31 -19
- data/Gemfile.lock +0 -108
- 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: ab95ca1c8df33992dad2838e1ca5cab72d9dcedce828825342dc6346e99efa5c
|
4
|
+
data.tar.gz: '078f6772ffe31b1150d2d32e240231113e91413faf56da77af6f0657e6957c2f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d42d282cd5c63cedbe256b2eb565309f7dc32864fbf446f6e0335eb8b3e0a66b0b70c5dba93a7070708ca5e37d7a9b2d6766fa9ef3840fd8c4e8eb6cde4dafe
|
7
|
+
data.tar.gz: a5bc410b164b79d37ce3cf8c0dbf8638d182d26baaa9ca3b14db31579b7b6ab0059045ac4823b25e0335b9e04afc92715fd061a9a52f35c919ce5f9fde7ed7b0
|
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: 'https://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
|
@@ -15,7 +17,8 @@ module Vertebrae
|
|
15
17
|
:connection_options,
|
16
18
|
:content_type,
|
17
19
|
:scheme,
|
18
|
-
:port
|
20
|
+
:port,
|
21
|
+
:additional_headers
|
19
22
|
].freeze
|
20
23
|
|
21
24
|
# The default HTTP scheme configuration
|
@@ -49,7 +52,7 @@ module Vertebrae
|
|
49
52
|
DEFAULT_CONNECTION_OPTIONS = {}
|
50
53
|
|
51
54
|
DEFAULT_CONTENT_TYPE = 'application/json'.freeze
|
52
|
-
|
55
|
+
DEFAULT_ADDITIONAL_HEADERS = {}.freeze
|
53
56
|
|
54
57
|
VALID_OPTIONS_KEYS.each do | key |
|
55
58
|
define_method("default_#{key}".intern) { default_options[key] }
|
@@ -95,10 +98,10 @@ module Vertebrae
|
|
95
98
|
ACCEPT_CHARSET => "utf-8",
|
96
99
|
USER_AGENT => user_agent,
|
97
100
|
CONTENT_TYPE => content_type
|
98
|
-
},
|
101
|
+
}.merge(additional_headers),
|
99
102
|
:ssl => ssl,
|
100
103
|
:url => endpoint
|
101
|
-
}
|
104
|
+
}.merge(connection_options)
|
102
105
|
end
|
103
106
|
|
104
107
|
|
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,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Vertebrae::Configuration do
|
@@ -71,4 +73,56 @@ describe Vertebrae::Configuration do
|
|
71
73
|
expect(subject.adapter).to eq(:foo)
|
72
74
|
end
|
73
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
|
74
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.7.0 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.7.0"
|
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 = "2021-03-22"
|
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, [">= 0
|
67
|
-
s.add_runtime_dependency(%q<faraday_middleware>.freeze, [">= 0"])
|
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, [">= 1.0"])
|
66
|
+
s.add_runtime_dependency(%q<faraday_middleware>.freeze, [">= 1.0"])
|
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, [">= 0
|
77
|
-
s.add_dependency(%q<faraday_middleware>.freeze, [">= 0"])
|
78
|
-
s.add_dependency(%q<hashie>.freeze, ["
|
75
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 5.1.4"])
|
76
|
+
s.add_dependency(%q<faraday>.freeze, [">= 1.0"])
|
77
|
+
s.add_dependency(%q<faraday_middleware>.freeze, [">= 1.0"])
|
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, [">= 0
|
88
|
-
s.add_dependency(%q<faraday_middleware>.freeze, [">= 0"])
|
89
|
-
s.add_dependency(%q<hashie>.freeze, ["
|
87
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 5.1.4"])
|
88
|
+
s.add_dependency(%q<faraday>.freeze, [">= 1.0"])
|
89
|
+
s.add_dependency(%q<faraday_middleware>.freeze, [">= 1.0"])
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-22 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
|
-
version: 0
|
33
|
+
version: '1.0'
|
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
|
-
version: 0
|
40
|
+
version: '1.0'
|
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: '0'
|
47
|
+
version: '1.0'
|
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: '0'
|
54
|
+
version: '1.0'
|
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
|
@@ -182,7 +195,7 @@ homepage: http://github.com/controlshift/vertebrae
|
|
182
195
|
licenses:
|
183
196
|
- MIT
|
184
197
|
metadata: {}
|
185
|
-
post_install_message:
|
198
|
+
post_install_message:
|
186
199
|
rdoc_options: []
|
187
200
|
require_paths:
|
188
201
|
- lib
|
@@ -197,9 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
210
|
- !ruby/object:Gem::Version
|
198
211
|
version: '0'
|
199
212
|
requirements: []
|
200
|
-
|
201
|
-
|
202
|
-
signing_key:
|
213
|
+
rubygems_version: 3.0.8
|
214
|
+
signing_key:
|
203
215
|
specification_version: 4
|
204
216
|
summary: API Client Infrastructure
|
205
217
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (5.1.4)
|
5
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
-
i18n (~> 0.7)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
tzinfo (~> 1.1)
|
9
|
-
addressable (2.5.2)
|
10
|
-
public_suffix (>= 2.0.2, < 4.0)
|
11
|
-
builder (3.2.3)
|
12
|
-
concurrent-ruby (1.0.5)
|
13
|
-
crack (0.4.3)
|
14
|
-
safe_yaml (~> 1.0.0)
|
15
|
-
descendants_tracker (0.0.4)
|
16
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
17
|
-
diff-lcs (1.3)
|
18
|
-
faraday (0.12.2)
|
19
|
-
multipart-post (>= 1.2, < 3)
|
20
|
-
faraday_middleware (0.12.2)
|
21
|
-
faraday (>= 0.7.4, < 1.0)
|
22
|
-
git (1.3.0)
|
23
|
-
github_api (0.18.2)
|
24
|
-
addressable (~> 2.4)
|
25
|
-
descendants_tracker (~> 0.0.4)
|
26
|
-
faraday (~> 0.8)
|
27
|
-
hashie (~> 3.5, >= 3.5.2)
|
28
|
-
oauth2 (~> 1.0)
|
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)
|
34
|
-
juwelier (2.4.7)
|
35
|
-
builder
|
36
|
-
bundler
|
37
|
-
git
|
38
|
-
github_api
|
39
|
-
highline
|
40
|
-
kamelcase (~> 0)
|
41
|
-
nokogiri
|
42
|
-
psych
|
43
|
-
rake
|
44
|
-
rdoc
|
45
|
-
semver2
|
46
|
-
jwt (1.5.6)
|
47
|
-
kamelcase (0.0.1)
|
48
|
-
semver2 (~> 3)
|
49
|
-
mini_portile2 (2.3.0)
|
50
|
-
minitest (5.10.3)
|
51
|
-
multi_json (1.12.2)
|
52
|
-
multi_xml (0.6.0)
|
53
|
-
multipart-post (2.0.0)
|
54
|
-
nokogiri (1.8.1)
|
55
|
-
mini_portile2 (~> 2.3.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 (3.0.2)
|
63
|
-
public_suffix (3.0.1)
|
64
|
-
rack (2.0.3)
|
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)
|
74
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
-
rspec-support (~> 3.7.0)
|
76
|
-
rspec-its (1.2.0)
|
77
|
-
rspec-core (>= 3.0.0)
|
78
|
-
rspec-expectations (>= 3.0.0)
|
79
|
-
rspec-mocks (3.7.0)
|
80
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.7.0)
|
82
|
-
rspec-support (3.7.0)
|
83
|
-
safe_yaml (1.0.4)
|
84
|
-
semver2 (3.4.2)
|
85
|
-
thread_safe (0.3.6)
|
86
|
-
tzinfo (1.2.4)
|
87
|
-
thread_safe (~> 0.1)
|
88
|
-
webmock (3.1.1)
|
89
|
-
addressable (>= 2.3.6)
|
90
|
-
crack (>= 0.3.2)
|
91
|
-
hashdiff
|
92
|
-
|
93
|
-
PLATFORMS
|
94
|
-
ruby
|
95
|
-
|
96
|
-
DEPENDENCIES
|
97
|
-
activesupport
|
98
|
-
bundler
|
99
|
-
faraday (>= 0.9.2)
|
100
|
-
faraday_middleware
|
101
|
-
hashie
|
102
|
-
juwelier
|
103
|
-
rspec
|
104
|
-
rspec-its
|
105
|
-
webmock
|
106
|
-
|
107
|
-
BUNDLED WITH
|
108
|
-
1.16.1
|
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
|