vertebrae 0.7.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +24 -0
- data/.ruby-version +1 -1
- data/Gemfile +3 -4
- data/README.md +17 -0
- data/Rakefile +3 -15
- data/VERSION +1 -1
- data/lib/connection.rb +7 -5
- data/lib/response/raise_error.rb +4 -2
- data/lib/vertebrae.rb +2 -1
- data/spec/request_spec.rb +1 -1
- data/vertebrae.gemspec +22 -46
- metadata +18 -18
- data/.travis.yml +0 -9
- data/README.rdoc +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62eabfcd0080454194f02c772758fcac1dee7998c264813b715f729c01f6deec
|
4
|
+
data.tar.gz: 563e98c3ad61dc9040cc26134d795eb884d535197963d736f7a76e121f66d29f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 703b18a9b5ffa5b538a43ef6c68caa99d22c34411a75fca19bce78e020183811d3e9f4bb5b1708d365928f8b7fec8402325affea87491807b955ab5f38572355
|
7
|
+
data.tar.gz: 59266d8c1051b15946274669008e702eafb08896a089a3f08eb6498d35b65d6a5ace24c3a72177d499a91a5fcac3be727b4a7a75d446020913537b2663eea7e4
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- uses: actions/checkout@v2
|
9
|
+
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
10
|
+
with:
|
11
|
+
ruby-version: 2.7
|
12
|
+
bundler-cache: true
|
13
|
+
- run: bundle install
|
14
|
+
- run: bundle exec rspec
|
15
|
+
rubocop:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
20
|
+
with:
|
21
|
+
ruby-version: 2.7
|
22
|
+
bundler-cache: true
|
23
|
+
- run: bundle install
|
24
|
+
- run: bundle exec rubocop
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.2
|
data/Gemfile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
gem 'activesupport', '>= 5.1.4'
|
4
|
-
gem 'faraday', '> 0
|
5
|
-
gem '
|
6
|
-
gem '
|
4
|
+
gem 'faraday', '> 2.0'
|
5
|
+
gem 'faraday-mashify'
|
6
|
+
gem 'faraday-multipart'
|
7
7
|
|
8
8
|
# Add dependencies to develop your gem here.
|
9
9
|
# Include everything needed to run rake, tests, features, etc.
|
@@ -12,6 +12,5 @@ group :development do
|
|
12
12
|
gem "bundler"
|
13
13
|
gem "webmock"
|
14
14
|
gem "rspec-its"
|
15
|
-
gem "juwelier", git: 'https://github.com/flajann2/juwelier.git'
|
16
15
|
gem "rubocop"
|
17
16
|
end
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# vertebrae
|
2
|
+
|
3
|
+
Some basic infrastructure for writing beautiful API clients. See tijuana\_client for a small example.
|
4
|
+
|
5
|
+
[![CI Status](https://github.com/controlshift/vertebrae/actions/workflows/ci.yml/badge.svg)](https://github.com/controlshift/vertebrae/actions/workflows/ci.yml)
|
6
|
+
|
7
|
+
## Development
|
8
|
+
|
9
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests.
|
10
|
+
|
11
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
12
|
+
|
13
|
+
## Copyright
|
14
|
+
|
15
|
+
Copyright (c) 2013 Nathan Woodhull. See LICENSE.txt for
|
16
|
+
further details.
|
17
|
+
|
data/Rakefile
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler'
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
|
7
|
+
|
5
8
|
begin
|
6
9
|
Bundler.setup(:default, :development)
|
7
10
|
rescue Bundler::BundlerError => e
|
@@ -11,21 +14,6 @@ rescue Bundler::BundlerError => e
|
|
11
14
|
end
|
12
15
|
require 'rake'
|
13
16
|
|
14
|
-
require 'juwelier'
|
15
|
-
Juwelier::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
-
gem.name = "vertebrae"
|
18
|
-
gem.homepage = "http://github.com/controlshift/vertebrae"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{API Client Infrastructure}
|
21
|
-
gem.description = %Q{A set of low level infrastructure and reusable code for building API clients}
|
22
|
-
gem.email = "nathan@controlshiftlabs.com"
|
23
|
-
gem.authors = ["Nathan Woodhull"]
|
24
|
-
|
25
|
-
# dependencies defined in Gemfile
|
26
|
-
end
|
27
|
-
Juwelier::RubygemsDotOrgTasks.new
|
28
|
-
|
29
17
|
require 'rspec/core'
|
30
18
|
require 'rspec/core/rake_task'
|
31
19
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0
|
1
|
+
1.0
|
data/lib/connection.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'faraday'
|
4
|
-
require '
|
4
|
+
require 'faraday/multipart'
|
5
|
+
require 'faraday/mashify'
|
5
6
|
require 'response/raise_error'
|
6
7
|
require 'authorization'
|
7
8
|
|
@@ -37,16 +38,17 @@ module Vertebrae
|
|
37
38
|
#
|
38
39
|
def default_middleware
|
39
40
|
Proc.new do |builder|
|
40
|
-
builder.use Faraday::
|
41
|
+
builder.use Faraday::Multipart::Middleware
|
41
42
|
builder.use Faraday::Request::UrlEncoded
|
42
43
|
if configuration.authenticated?
|
43
|
-
builder.use Faraday::Request::
|
44
|
+
builder.use Faraday::Request::Authorization, :basic, configuration.username, configuration.password
|
44
45
|
end
|
45
46
|
|
46
47
|
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
48
|
+
|
47
49
|
unless options[:raw]
|
48
|
-
builder.use
|
49
|
-
builder.use
|
50
|
+
builder.use Faraday::Mashify::Middleware
|
51
|
+
builder.use Faraday::Response::Json
|
50
52
|
end
|
51
53
|
builder.use Vertebrae::Response::RaiseError
|
52
54
|
builder.adapter configuration.adapter
|
data/lib/response/raise_error.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'faraday/response'
|
4
|
+
|
3
5
|
module Vertebrae
|
4
6
|
module Response
|
5
|
-
class RaiseError < Faraday::
|
7
|
+
class RaiseError < Faraday::Middleware
|
6
8
|
|
7
9
|
def on_complete(response)
|
8
10
|
status_code = response[:status].to_i
|
@@ -12,4 +14,4 @@ module Vertebrae
|
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end # Response::RaiseError
|
15
|
-
end
|
17
|
+
end
|
data/lib/vertebrae.rb
CHANGED
data/spec/request_spec.rb
CHANGED
@@ -81,7 +81,7 @@ describe Vertebrae::Request do
|
|
81
81
|
let(:vb) { Vertebrae::API.new username: 'user', password: 'pass' }
|
82
82
|
|
83
83
|
it 'should make requests with basic auth' do
|
84
|
-
stub_request(:get, 'https://test3.com/path').with(basic_auth: [
|
84
|
+
stub_request(:get, 'https://test3.com/path').with(basic_auth: %w[user pass])
|
85
85
|
vb.request(:get, '/path', {}, {host: 'test3.com'})
|
86
86
|
end
|
87
87
|
end
|
data/vertebrae.gemspec
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vertebrae".freeze
|
9
|
-
s.version =
|
9
|
+
s.version = Vertebrae::VERSION
|
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 = "2021-
|
14
|
+
s.date = "2021-07-23"
|
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 = [
|
18
18
|
"LICENSE.txt",
|
19
|
-
"README.
|
19
|
+
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
+
".github/workflows/ci.yml",
|
23
24
|
".rspec",
|
24
25
|
".rubocop.yml",
|
25
26
|
".ruby-gemset",
|
26
27
|
".ruby-version",
|
27
|
-
".travis.yml",
|
28
28
|
"Gemfile",
|
29
29
|
"LICENSE.txt",
|
30
|
-
"README.
|
30
|
+
"README.md",
|
31
31
|
"Rakefile",
|
32
32
|
"VERSION",
|
33
33
|
"lib/api.rb",
|
@@ -54,46 +54,22 @@ Gem::Specification.new do |s|
|
|
54
54
|
]
|
55
55
|
s.homepage = "http://github.com/controlshift/vertebrae".freeze
|
56
56
|
s.licenses = ["MIT".freeze]
|
57
|
-
s.rubygems_version = "3.0.8".freeze
|
58
57
|
s.summary = "API Client Infrastructure".freeze
|
59
58
|
|
60
59
|
if s.respond_to? :specification_version then
|
61
60
|
s.specification_version = 4
|
62
|
-
|
63
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
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"])
|
68
|
-
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
69
|
-
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
70
|
-
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
71
|
-
s.add_development_dependency(%q<rspec-its>.freeze, [">= 0"])
|
72
|
-
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
73
|
-
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
74
|
-
else
|
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
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
80
|
-
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
81
|
-
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
82
|
-
s.add_dependency(%q<rspec-its>.freeze, [">= 0"])
|
83
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
84
|
-
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
85
|
-
end
|
86
|
-
else
|
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"])
|
91
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
92
|
-
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
93
|
-
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
94
|
-
s.add_dependency(%q<rspec-its>.freeze, [">= 0"])
|
95
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
96
|
-
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
97
61
|
end
|
62
|
+
|
63
|
+
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 5.1.4"])
|
64
|
+
s.add_runtime_dependency(%q<faraday>.freeze, ["~> 2"])
|
65
|
+
s.add_runtime_dependency(%q<faraday-mashify>.freeze, [">= 0"])
|
66
|
+
s.add_runtime_dependency(%q<faraday-multipart>.freeze, [">= 0"])
|
67
|
+
|
68
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
70
|
+
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
71
|
+
s.add_development_dependency(%q<rspec-its>.freeze, [">= 0"])
|
72
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
98
74
|
end
|
99
75
|
|
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: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -28,44 +28,44 @@ dependencies:
|
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '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
|
-
version: '
|
40
|
+
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: faraday-mashify
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '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: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: faraday-multipart
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
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: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,17 +157,17 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files:
|
159
159
|
- LICENSE.txt
|
160
|
-
- README.
|
160
|
+
- README.md
|
161
161
|
files:
|
162
162
|
- ".document"
|
163
|
+
- ".github/workflows/ci.yml"
|
163
164
|
- ".rspec"
|
164
165
|
- ".rubocop.yml"
|
165
166
|
- ".ruby-gemset"
|
166
167
|
- ".ruby-version"
|
167
|
-
- ".travis.yml"
|
168
168
|
- Gemfile
|
169
169
|
- LICENSE.txt
|
170
|
-
- README.
|
170
|
+
- README.md
|
171
171
|
- Rakefile
|
172
172
|
- VERSION
|
173
173
|
- lib/api.rb
|
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
- !ruby/object:Gem::Version
|
211
211
|
version: '0'
|
212
212
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
213
|
+
rubygems_version: 3.4.1
|
214
214
|
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: API Client Infrastructure
|
data/.travis.yml
DELETED
data/README.rdoc
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
= vertebrae
|
2
|
-
|
3
|
-
Some basic infrastructure for writing beautiful API clients. See tijuana_client for a small example.
|
4
|
-
|
5
|
-
[![Build Status](https://travis-ci.org/controlshift/vertebrae.svg)](https://travis-ci.org/controlshift/vertebrae)
|
6
|
-
|
7
|
-
== Contributing to vertebrae
|
8
|
-
|
9
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
10
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
11
|
-
* Fork the project.
|
12
|
-
* Start a feature/bugfix branch.
|
13
|
-
* Commit and push until you are happy with your contribution.
|
14
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
15
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
16
|
-
|
17
|
-
== Copyright
|
18
|
-
|
19
|
-
Copyright (c) 2013 Nathan Woodhull. See LICENSE.txt for
|
20
|
-
further details.
|
21
|
-
|