faraday_middleware-oauth2_refresh 0.0.3 → 0.1.1

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
- SHA1:
3
- metadata.gz: 166131c41ebb86eebeed0a8591c2812413c05495
4
- data.tar.gz: 9fd9c422e5f2bac9947554e241f77f0684d3669c
2
+ SHA256:
3
+ metadata.gz: '0835c23a3e9a86fad54695c9b05bc60c999517f465f048753f36488b3bbdf838'
4
+ data.tar.gz: 4b41576d47ccff8cf55b7389116c1907286cab10d050e48fc99c963cd104c83d
5
5
  SHA512:
6
- metadata.gz: 9acb20fa52d5387f1247755e1b93ed3d9fccded97de37a6ca6a9fdca216d870c29d4c91e857aad1eba10869474c5088319a300eecf7da4f46a53cd2f37a85931
7
- data.tar.gz: 965572b1994399922d558ca6294f4aa830737e0f9db9a138fbe2855e7cd4b0dcdfb282710255e7e869ec338f7a86120dc524c34a17af8f1bc03a975276de5228
6
+ metadata.gz: 1871d7e5f40b9ec91574abf10b8b8b85bd6d5d6564f8df3d1b8533f02e79c479246577eb01cc507022dc73db7d00417b7bd4e51044d48c3a2b0b3fc671d102e5
7
+ data.tar.gz: aa87320f914b39f8d38f48004a22721aeefe3fa3d14abe7048e72efbfc7b1d028957fc3bee309c36f02e947afdb7e3c9f232b382dbfa20bb41e8071b96b66012
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  CHANGELOG
2
2
  ---------
3
+ - **2016-11-21**: 0.0.4
4
+ - Add VersionEye reference tracking
3
5
  - **2016-08-23**: 0.0.3
4
6
  - Update dependencies
5
7
  - **2015-05-31**: 0.0.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at johncwang@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2016 John Wang
1
+ Copyright (c) 2015-2023 John Wang
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,14 +1,24 @@
1
1
  # FaradayMiddleware::OAuth2Refresh
2
2
 
3
- [![Gem Version][gem-version-svg]][gem-version-link]
4
- [![Build Status][build-status-svg]][build-status-link]
5
- [![Coverage Status][coverage-status-svg]][coverage-status-link]
6
- [![Dependency Status][dependency-status-svg]][dependency-status-link]
7
- [![Code Climate][codeclimate-status-svg]][codeclimate-status-link]
8
- [![Scrutinizer Code Quality][scrutinizer-status-svg]][scrutinizer-status-link]
9
- [![Downloads][downloads-svg]][downloads-link]
10
- [![Docs][docs-rubydoc-svg]][docs-rubydoc-link]
11
- [![License][license-svg]][license-link]
3
+ <div align="center">
4
+
5
+ [![Gem Version][gem-version-svg]][gem-version-url]
6
+ [![Build Status][build-status-svg]][build-status-url]
7
+ [![Coverage Status][coverage-status-svg]][coverage-status-url]
8
+
9
+ </div>
10
+ <div align="center">
11
+
12
+ [![Code Climate][codeclimate-status-svg]][codeclimate-status-url]
13
+ [![Scrutinizer Code Quality][scrutinizer-status-svg]][scrutinizer-status-url]
14
+
15
+ </div>
16
+ <div align="center">
17
+
18
+ [![Docs][docs-rubydoc-svg]][docs-rubydoc-url]
19
+ [![License][license-svg]][license-url]
20
+
21
+ </div>
12
22
 
13
23
  Faraday middleware to manage OAuth token authorization with token refresh.
14
24
 
@@ -71,25 +81,29 @@ Please report these on [Github](https://github.com/grokify/faraday_middleware-oa
71
81
 
72
82
  ## License
73
83
 
74
- FaradayMiddleware::OAuth2Refresh is available under an MIT-style license. See {file:LICENSE.txt} for details.
84
+ FaradayMiddleware::OAuth2Refresh is available under an MIT-style license. See {file:LICENSE.md} for details.
75
85
 
76
- FaradayMiddleware::OAuth2Refresh &copy; 2015-2016 by John Wang
86
+ FaradayMiddleware::OAuth2Refresh &copy; 2015-2021 by John Wang
77
87
 
78
88
  [gem-version-svg]: https://badge.fury.io/rb/faraday_middleware-oauth2_refresh.svg
79
- [gem-version-link]: http://badge.fury.io/rb/faraday_middleware-oauth2_refresh
89
+ [gem-version-url]: http://badge.fury.io/rb/faraday_middleware-oauth2_refresh
80
90
  [downloads-svg]: http://ruby-gem-downloads-badge.herokuapp.com/faraday_middleware-oauth2_refresh
81
- [downloads-link]: https://rubygems.org/gems/faraday_middleware-oauth2_refresh
82
- [build-status-svg]: https://api.travis-ci.org/grokify/faraday_middleware-oauth2_refresh.svg?branch=master
83
- [build-status-link]: https://travis-ci.org/grokify/faraday_middleware-oauth2_refresh
91
+ [downloads-url]: https://rubygems.org/gems/faraday_middleware-oauth2_refresh
92
+ [build-status-svg]: https://github.com/grokify/faraday_middleware-oauth2_refresh/workflows/ruby%20build/badge.svg?branch=master
93
+ [build-status-url]: https://github.com/grokify/faraday_middleware-oauth2_refresh/actions
84
94
  [coverage-status-svg]: https://coveralls.io/repos/grokify/faraday_middleware-oauth2_refresh/badge.svg?branch=master
85
- [coverage-status-link]: https://coveralls.io/r/grokify/faraday_middleware-oauth2_refresh?branch=master
95
+ [coverage-status-url]: https://coveralls.io/r/grokify/faraday_middleware-oauth2_refresh?branch=master
86
96
  [dependency-status-svg]: https://gemnasium.com/grokify/faraday_middleware-oauth2_refresh.svg
87
- [dependency-status-link]: https://gemnasium.com/grokify/faraday_middleware-oauth2_refresh
97
+ [dependency-status-url]: https://gemnasium.com/grokify/faraday_middleware-oauth2_refresh
98
+ [codacy-svg]: https://api.codacy.com/project/badge/Grade/88aedf52809d460891546fc7e11bd2c6
99
+ [codacy-url]: https://app.codacy.com/manual/grokify/faraday_middleware-oauth2_refresh/dashboard
88
100
  [codeclimate-status-svg]: https://codeclimate.com/github/grokify/faraday_middleware-oauth2_refresh/badges/gpa.svg
89
- [codeclimate-status-link]: https://codeclimate.com/github/grokify/faraday_middleware-oauth2_refresh
101
+ [codeclimate-status-url]: https://codeclimate.com/github/grokify/faraday_middleware-oauth2_refresh
90
102
  [scrutinizer-status-svg]: https://scrutinizer-ci.com/g/grokify/faraday_middleware-oauth2_refresh/badges/quality-score.png?b=master
91
- [scrutinizer-status-link]: https://scrutinizer-ci.com/g/grokify/faraday_middleware-oauth2_refresh/?branch=master
103
+ [scrutinizer-status-url]: https://scrutinizer-ci.com/g/grokify/faraday_middleware-oauth2_refresh/?branch=master
104
+ [references-svg]: https://www.versioneye.com/ruby/faraday_middleware-oauth2_refresh/reference_badge.svg
105
+ [references-url]: https://www.versioneye.com/ruby/faraday_middleware-oauth2_refresh/
92
106
  [docs-rubydoc-svg]: https://img.shields.io/badge/docs-rubydoc-blue.svg
93
- [docs-rubydoc-link]: http://www.rubydoc.info/gems/faraday_middleware-oauth2_refresh/
107
+ [docs-rubydoc-url]: http://www.rubydoc.info/gems/faraday_middleware-oauth2_refresh/
94
108
  [license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
95
- [license-link]: https://github.com/grokify/faraday_middleware-oauth2_refresh/blob/master/LICENSE.txt
109
+ [license-url]: https://github.com/grokify/faraday_middleware-oauth2_refresh/blob/master/LICENSE.txt
data/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.1.0
@@ -12,27 +12,27 @@ module FaradayMiddleware
12
12
 
13
13
  def call(env)
14
14
  if @oauth2_token.expired?
15
- @oauth2_token = @oauth2_token.refresh!({:headers => {'Authorization' => 'Basic ' + get_api_key()}})
15
+ @oauth2_token = @oauth2_token.refresh!({ headers: { 'Authorization' => 'Basic ' + get_api_key() } })
16
16
  end
17
17
 
18
- if @oauth2_token.token.to_s.length>0
19
- env[:request_headers][AUTH_HEADER] = %(Bearer #{@oauth2_token.token.to_s})
18
+ unless @oauth2_token.token.to_s.empty?
19
+ env[:request_headers][AUTH_HEADER] = %(Bearer #{@oauth2_token.token})
20
20
  end
21
21
 
22
22
  @app.call env
23
23
  end
24
24
 
25
- def get_api_key()
26
- api_key = Base64::encode64("#{@oauth2_token.client.id.to_s}:#{@oauth2_token.client.secret.to_s}").gsub(/[\s\t\r\n]/,'')
25
+ def get_api_key
26
+ api_key = Base64.encode64("#{@oauth2_token.client.id}:#{@oauth2_token.client.secret}").gsub(/[\s]/,'')
27
27
  return api_key
28
28
  end
29
29
 
30
- def initialize(app=nil, token=nil, options={})
31
- super(app)
30
+ def initialize(app = nil, token = nil)
31
+ super app
32
32
  @oauth2_token = token
33
33
  end
34
34
 
35
35
  end
36
36
  end
37
37
 
38
- Faraday::Request.register_middleware :oauth2_refresh => FaradayMiddleware::OAuth2Refresh
38
+ Faraday::Request.register_middleware oauth2_refresh: FaradayMiddleware::OAuth2Refresh
data/test/test_setup.rb CHANGED
@@ -7,9 +7,9 @@ require 'faraday_middleware'
7
7
  require 'faraday_middleware-oauth2_refresh'
8
8
 
9
9
  class OAuth2Test < Test::Unit::TestCase
10
- def testSetup
10
+ def test_setup
11
11
 
12
- conn = Faraday.new 'http://example.com/api' do |conn|
12
+ Faraday.new 'http://example.com/api' do |conn|
13
13
  conn.request :oauth2_refresh
14
14
  end
15
15
 
@@ -18,4 +18,4 @@ class OAuth2Test < Test::Unit::TestCase
18
18
  assert_equal 'FaradayMiddleware::OAuth2Refresh', ref.class.name
19
19
 
20
20
  end
21
- end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware-oauth2_refresh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-23 00:00:00.000000000 Z
11
+ date: 2023-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,52 +16,52 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: 1.10.3
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: '0.9'
22
+ version: 1.10.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.9'
29
+ version: 1.10.3
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '0.9'
32
+ version: 1.10.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: faraday_middleware
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: 1.2.0
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: 1.2.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0'
49
+ version: 1.2.0
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: '0'
52
+ version: 1.2.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: coveralls
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ">="
57
+ - - "~>"
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - ">="
64
+ - - "~>"
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  - !ruby/object:Gem::Dependency
@@ -70,42 +70,42 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: '0'
73
+ version: '13'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: '0'
80
+ version: '13'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: simplecov
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - ">="
85
+ - - "~>"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - ">="
92
+ - - "~>"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: test-unit
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
99
+ - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: '3'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ">="
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '0'
108
+ version: '3'
109
109
  description: This Faraday middleware gem adds OAuth2 token handling with token refresh
110
110
  email: johncwang@gmail.com
111
111
  executables: []
@@ -113,6 +113,7 @@ extensions: []
113
113
  extra_rdoc_files: []
114
114
  files:
115
115
  - CHANGELOG.md
116
+ - CODE_OF_CONDUCT.md
116
117
  - LICENSE.txt
117
118
  - README.md
118
119
  - Rakefile
@@ -120,11 +121,11 @@ files:
120
121
  - lib/faraday_middleware-oauth2_refresh.rb
121
122
  - lib/faraday_middleware/oauth2_refresh.rb
122
123
  - test/test_setup.rb
123
- homepage: https://github.com/grokify/
124
+ homepage: https://github.com/grokify/faraday_middleware-oauth2_refresh
124
125
  licenses:
125
126
  - MIT
126
127
  metadata: {}
127
- post_install_message:
128
+ post_install_message:
128
129
  rdoc_options: []
129
130
  require_paths:
130
131
  - lib
@@ -139,9 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0'
141
142
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.5.1
144
- signing_key:
143
+ rubygems_version: 3.4.2
144
+ signing_key:
145
145
  specification_version: 4
146
146
  summary: Faraday OAuth2 request middleware with token refresh
147
147
  test_files: []