fellowshipone 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -10
- data/README.md +2 -3
- data/fellowshipone.gemspec +1 -1
- data/lib/fellowshipone/client.rb +1 -0
- data/lib/fellowshipone/error.rb +44 -0
- data/lib/fellowshipone.rb +3 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7b6892a399d21c72712f35fb4b780fc5f0a67375b53dfcb0ed212c6d826c72b
|
4
|
+
data.tar.gz: b9ce0b52ad3365cf93ad0e839fb6ff4b23de93a7365b4db0f4f346f69a3e7ff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4fc4e55888f426e7cc6335f8cb3a73f47d6c992b8101b315f758b1efffc8505fa2ac9495316c9c58017d70e17d483eb7ccaf676a4c788b331f75aff29d314cc
|
7
|
+
data.tar.gz: 89638f38f54f34d29da9758a846a6f30de15c795c161a5665247f029ca5ba3a5b2ebc7f8609a5fe370df7f816b312403222f30314ef5442272fadba9adb6f883
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,33 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fellowshipone (
|
4
|
+
fellowshipone (2.3.0)
|
5
5
|
addressable
|
6
6
|
faraday
|
7
7
|
faraday_middleware
|
8
8
|
hashie
|
9
9
|
json
|
10
|
+
oauth
|
10
11
|
simple_oauth
|
11
12
|
|
12
13
|
GEM
|
13
14
|
remote: http://rubygems.org/
|
14
15
|
specs:
|
15
|
-
addressable (2.
|
16
|
+
addressable (2.8.0)
|
17
|
+
public_suffix (>= 2.0.2, < 5.0)
|
16
18
|
crack (0.4.2)
|
17
19
|
safe_yaml (~> 1.0.0)
|
18
|
-
faraday (0.
|
20
|
+
faraday (1.0.1)
|
19
21
|
multipart-post (>= 1.2, < 3)
|
20
|
-
faraday_middleware (0.
|
21
|
-
faraday (
|
22
|
-
hashie (
|
23
|
-
json (
|
22
|
+
faraday_middleware (1.0.0)
|
23
|
+
faraday (~> 1.0)
|
24
|
+
hashie (4.1.0)
|
25
|
+
json (2.3.1)
|
24
26
|
minitest (5.5.1)
|
25
|
-
multipart-post (2.
|
26
|
-
|
27
|
+
multipart-post (2.1.1)
|
28
|
+
oauth (0.5.6)
|
29
|
+
public_suffix (4.0.6)
|
30
|
+
rake (12.3.3)
|
27
31
|
safe_yaml (1.0.4)
|
28
32
|
simple_oauth (0.3.1)
|
29
33
|
vcr (2.9.3)
|
@@ -43,4 +47,4 @@ DEPENDENCIES
|
|
43
47
|
webmock
|
44
48
|
|
45
49
|
BUNDLED WITH
|
46
|
-
1.
|
50
|
+
2.1.4
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Installing the gem
|
|
12
12
|
|
13
13
|
To add it to your Gemfile
|
14
14
|
|
15
|
-
gem 'fellowshipone',
|
15
|
+
gem 'fellowshipone', '3.0.0'
|
16
16
|
|
17
17
|
## Additional resources
|
18
18
|
|
@@ -23,10 +23,9 @@ To add it to your Gemfile
|
|
23
23
|
## License
|
24
24
|
|
25
25
|
This project is released under the MIT license (see LICENSE).
|
26
|
-
|
27
26
|
This project is maintained by Taylor Brooks (https://github.com/taylorbrooks).
|
28
27
|
|
29
28
|
|
30
29
|
## Want to Contribute?
|
31
30
|
|
32
|
-
If you would like to get involved in this project, then please fork the project. Make changes, add features, write some tests, and then send a pull request.
|
31
|
+
If you would like to get involved in this project, then please fork the project. Make changes, add features, write some tests, and then send a pull request.
|
data/fellowshipone.gemspec
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'fellowshipone'
|
5
|
-
s.version = '
|
5
|
+
s.version = '3.0.0'
|
6
6
|
s.authors = ['Taylor Brooks']
|
7
7
|
s.email = ['tbrooks@gmail.com']
|
8
8
|
s.homepage = 'https://github.com/taylorbrooks/fellowshipone'
|
data/lib/fellowshipone/client.rb
CHANGED
@@ -54,6 +54,7 @@ module Fellowshipone
|
|
54
54
|
connection.request :oauth, oauth_data
|
55
55
|
connection.response :logger if logger
|
56
56
|
connection.use FaradayMiddleware::Mashify
|
57
|
+
connection.use FaradayMiddleware::FellowshiponeErrorHandler
|
57
58
|
connection.response :json
|
58
59
|
connection.adapter Faraday.default_adapter
|
59
60
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Fellowshipone
|
2
|
+
class Error < StandardError; end
|
3
|
+
class BadRequest < Error; end
|
4
|
+
class Forbidden < Error; end
|
5
|
+
class GatewayTimeout < Error; end
|
6
|
+
class InternalServerError < Error; end
|
7
|
+
class NotFound < Error; end
|
8
|
+
class ServiceUnavailable < Error; end
|
9
|
+
class Unauthorized < Error; end
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'faraday'
|
13
|
+
module FaradayMiddleware
|
14
|
+
class FellowshiponeErrorHandler < Faraday::Response::Middleware
|
15
|
+
ERROR_STATUSES = 400..600
|
16
|
+
|
17
|
+
def on_complete(env)
|
18
|
+
case env[:status]
|
19
|
+
when 400
|
20
|
+
raise Fellowshipone::BadRequest, error_message(env)
|
21
|
+
when 401
|
22
|
+
raise Fellowshipone::Unauthorized, error_message(env)
|
23
|
+
when 403
|
24
|
+
raise Fellowshipone::Forbidden, error_message(env)
|
25
|
+
when 404
|
26
|
+
raise Fellowshipone::NotFound, error_message(env)
|
27
|
+
when 500
|
28
|
+
raise Fellowshipone::InternalServerError, error_message(env)
|
29
|
+
when 503
|
30
|
+
raise Fellowshipone::ServiceUnavailable, error_message(env)
|
31
|
+
when 504
|
32
|
+
raise Fellowshipone::GatewayTimeout, error_message(env)
|
33
|
+
when ERROR_STATUSES
|
34
|
+
raise Fellowshipone::Error, error_message(env)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def error_message(env)
|
41
|
+
"#{env[:status]}: #{env[:url]} #{env[:body]} #{env[:reason_phrase]}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/fellowshipone.rb
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
require_relative 'fellowshipone/client
|
2
|
-
require_relative 'fellowshipone/connection
|
1
|
+
require_relative 'fellowshipone/client'
|
2
|
+
require_relative 'fellowshipone/connection'
|
3
|
+
require_relative 'fellowshipone/error'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fellowshipone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Brooks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- lib/fellowshipone.rb
|
196
196
|
- lib/fellowshipone/client.rb
|
197
197
|
- lib/fellowshipone/connection.rb
|
198
|
+
- lib/fellowshipone/error.rb
|
198
199
|
- lib/fellowshipone/resources/communication.rb
|
199
200
|
- lib/fellowshipone/resources/contribution.rb
|
200
201
|
- lib/fellowshipone/resources/fund.rb
|
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
227
|
- !ruby/object:Gem::Version
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
+
rubygems_version: 3.1.6
|
230
231
|
signing_key:
|
231
232
|
specification_version: 4
|
232
233
|
summary: Ruby gem/plugin to interact with the FellowshipOne API (https://developer.fellowshipone.com/).
|