vertebrae 0.4.3 → 0.5.0

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: 3d3d13a6b72c1baeb513620e39717bbada581049
4
- data.tar.gz: bae900e52ac1a0d3ef22fd4ffb5664380b175891
3
+ metadata.gz: c36f7513900e9676643bff2e6d7d6ec05528c115
4
+ data.tar.gz: b9f03bbf801b10f655c837d0943bf7d1a2eadfc2
5
5
  SHA512:
6
- metadata.gz: '09831d8fdf212c8180f9577688580b575ad9bb60c47171961d57af820ee6ee642d5a2347ee7d4258b1c8468112dd269e7445f7d2423164149306a16da6e178e4'
7
- data.tar.gz: 13fd2deb93bd83e5db3b92162e9e0f15b6ff57d86e20c2ce68186900c618df68cb7967cec5c8674a9ea73e5775c8bb04bf1710c92cb801dc015ac4b4973ee091
6
+ metadata.gz: c4a6788755e1256f4176c0d221fd8f8b6437d76f4aba6f54451f93cdc34b5fbce68c58ed0796bb29f2324e1411c578f810168198d17bb947d6cbcdc5fd49088a
7
+ data.tar.gz: e27d47e5cbd778c753fa47caf9ae89dac15b666bd424fa7cd9be32b4803ccf9133422abff419db33646ca3e61ffc2da0a971200a47f4666561d0470b8fa729b8
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
2
 
5
- gem 'activesupport'
3
+ gem 'activesupport', '~> 5.1', '>= 5.1.4'
6
4
  gem 'faraday', '>= 0.9.2'
7
- gem 'faraday_middleware'
8
- gem 'hashie'
9
-
5
+ gem 'faraday_middleware', '~> 0.12', '>= 0.12.2'
6
+ gem 'hashie', '~> 3.5', '>= 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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.5.0
data/lib/connection.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'faraday'
2
2
  require 'faraday_middleware'
3
- require 'request/basic_auth'
4
3
  require 'response/raise_error'
5
4
  require 'authorization'
6
5
 
@@ -38,7 +37,9 @@ module Vertebrae
38
37
  Proc.new do |builder|
39
38
  builder.use Faraday::Request::Multipart
40
39
  builder.use Faraday::Request::UrlEncoded
41
- builder.use Vertebrae::Request::BasicAuth, configuration.authentication if configuration.authenticated?
40
+ if configuration.authenticated?
41
+ builder.use Faraday::Request::BasicAuthentication, configuration.username, configuration.password
42
+ end
42
43
 
43
44
  builder.use Faraday::Response::Logger if ENV['DEBUG']
44
45
  unless options[:raw]
@@ -69,4 +70,4 @@ module Vertebrae
69
70
  Faraday.new(configuration.faraday_options.merge(:builder => stack))
70
71
  end
71
72
  end
72
- end
73
+ end
data/spec/request_spec.rb CHANGED
@@ -73,5 +73,15 @@ describe Vertebrae::Request do
73
73
  end
74
74
  end
75
75
  end
76
+
77
+ context 'with basic auth' do
78
+ let(:options) { {} }
79
+ let(:vb) { Vertebrae::API.new username: 'user', password: 'pass' }
80
+
81
+ it 'should make requests with basic auth' do
82
+ stub_request(:get, 'https://test3.com/path').with(basic_auth: ['user', 'pass'])
83
+ vb.request(:get, '/path', {}, {host: 'test3.com'})
84
+ end
85
+ end
76
86
  end
77
87
  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.4.3 ruby lib
5
+ # stub: vertebrae 0.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vertebrae".freeze
9
- s.version = "0.4.3"
9
+ s.version = "0.5.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 = "2017-12-27"
14
+ s.date = "2018-12-04"
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 = [
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
25
25
  ".ruby-version",
26
26
  ".travis.yml",
27
27
  "Gemfile",
28
- "Gemfile.lock",
29
28
  "LICENSE.txt",
30
29
  "README.rdoc",
31
30
  "Rakefile",
@@ -40,7 +39,6 @@ Gem::Specification.new do |s|
40
39
  "lib/model.rb",
41
40
  "lib/railties.rb",
42
41
  "lib/request.rb",
43
- "lib/request/basic_auth.rb",
44
42
  "lib/response/raise_error.rb",
45
43
  "lib/response_error.rb",
46
44
  "lib/vertebrae.rb",
@@ -62,20 +60,20 @@ Gem::Specification.new do |s|
62
60
  s.specification_version = 4
63
61
 
64
62
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
- s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
63
+ s.add_runtime_dependency(%q<activesupport>.freeze, [">= 5.1.4", "~> 5.1"])
66
64
  s.add_runtime_dependency(%q<faraday>.freeze, [">= 0.9.2"])
67
- s.add_runtime_dependency(%q<faraday_middleware>.freeze, [">= 0"])
68
- s.add_runtime_dependency(%q<hashie>.freeze, [">= 0"])
65
+ s.add_runtime_dependency(%q<faraday_middleware>.freeze, [">= 0.12.2", "~> 0.12"])
66
+ s.add_runtime_dependency(%q<hashie>.freeze, [">= 3.5.7", "~> 3.5"])
69
67
  s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
70
68
  s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
71
69
  s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
72
70
  s.add_development_dependency(%q<rspec-its>.freeze, [">= 0"])
73
71
  s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
74
72
  else
75
- s.add_dependency(%q<activesupport>.freeze, [">= 0"])
73
+ s.add_dependency(%q<activesupport>.freeze, [">= 5.1.4", "~> 5.1"])
76
74
  s.add_dependency(%q<faraday>.freeze, [">= 0.9.2"])
77
- s.add_dependency(%q<faraday_middleware>.freeze, [">= 0"])
78
- s.add_dependency(%q<hashie>.freeze, [">= 0"])
75
+ s.add_dependency(%q<faraday_middleware>.freeze, [">= 0.12.2", "~> 0.12"])
76
+ s.add_dependency(%q<hashie>.freeze, [">= 3.5.7", "~> 3.5"])
79
77
  s.add_dependency(%q<rspec>.freeze, [">= 0"])
80
78
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
81
79
  s.add_dependency(%q<webmock>.freeze, [">= 0"])
@@ -83,10 +81,10 @@ Gem::Specification.new do |s|
83
81
  s.add_dependency(%q<juwelier>.freeze, [">= 0"])
84
82
  end
85
83
  else
86
- s.add_dependency(%q<activesupport>.freeze, [">= 0"])
84
+ s.add_dependency(%q<activesupport>.freeze, [">= 5.1.4", "~> 5.1"])
87
85
  s.add_dependency(%q<faraday>.freeze, [">= 0.9.2"])
88
- s.add_dependency(%q<faraday_middleware>.freeze, [">= 0"])
89
- s.add_dependency(%q<hashie>.freeze, [">= 0"])
86
+ s.add_dependency(%q<faraday_middleware>.freeze, [">= 0.12.2", "~> 0.12"])
87
+ s.add_dependency(%q<hashie>.freeze, [">= 3.5.7", "~> 3.5"])
90
88
  s.add_dependency(%q<rspec>.freeze, [">= 0"])
91
89
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
92
90
  s.add_dependency(%q<webmock>.freeze, [">= 0"])
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.3
4
+ version: 0.5.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: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 5.1.4
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: 5.1.4
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.1'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +50,40 @@ dependencies:
44
50
  requirements:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: '0'
53
+ version: 0.12.2
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.12'
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
61
  - - ">="
53
62
  - !ruby/object:Gem::Version
54
- version: '0'
63
+ version: 0.12.2
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.12'
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: hashie
57
69
  requirement: !ruby/object:Gem::Requirement
58
70
  requirements:
59
71
  - - ">="
60
72
  - !ruby/object:Gem::Version
61
- version: '0'
73
+ version: 3.5.7
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3.5'
62
77
  type: :runtime
63
78
  prerelease: false
64
79
  version_requirements: !ruby/object:Gem::Requirement
65
80
  requirements:
66
81
  - - ">="
67
82
  - !ruby/object:Gem::Version
68
- version: '0'
83
+ version: 3.5.7
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '3.5'
69
87
  - !ruby/object:Gem::Dependency
70
88
  name: rspec
71
89
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +169,6 @@ files:
151
169
  - ".ruby-version"
152
170
  - ".travis.yml"
153
171
  - Gemfile
154
- - Gemfile.lock
155
172
  - LICENSE.txt
156
173
  - README.rdoc
157
174
  - Rakefile
@@ -166,7 +183,6 @@ files:
166
183
  - lib/model.rb
167
184
  - lib/railties.rb
168
185
  - lib/request.rb
169
- - lib/request/basic_auth.rb
170
186
  - lib/response/raise_error.rb
171
187
  - lib/response_error.rb
172
188
  - lib/vertebrae.rb
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
@@ -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