fellowshipone 2.2.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- 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/responses/contribution.rb +7 -7
- data/lib/fellowshipone.rb +3 -2
- metadata +4 -5
- data/Gemfile.lock +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c69eb8b606e665f01ab90b205c6051253817de2458b848deb38ff1c28de75073
|
4
|
+
data.tar.gz: 1184d6a8f2d5ccf3710f5f13940e77ef16c3c45fd1f1a79e86f174c32596e7e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33038de82fbcb6cfa4f6ed9b46ab54ce4b0c2225469edb8f9b8b0f30641ea6af55ef7b1dc3d977212662186fab8fe82e4d175c75d3034cddade9d91a509d7cf
|
7
|
+
data.tar.gz: b796f9e3cec78268eba4fc86c2be47361b5cfff62ccbd4862235b0f5cfe88e61ddfbc34e4d857ae058911d1ccdb4a703e7048db9867a318ecb5d13e17ab342f8
|
data/.gitignore
CHANGED
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.1'
|
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
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Fellowshipone
|
2
2
|
class Contribution
|
3
|
-
|
4
3
|
def self.format(res)
|
5
|
-
response = res[
|
4
|
+
response = res['contributionReceipt']
|
6
5
|
if response.is_a?(Array)
|
7
6
|
response.map{|contribution| format_contribution(contribution) }
|
8
7
|
else
|
@@ -12,11 +11,12 @@ module Fellowshipone
|
|
12
11
|
|
13
12
|
def self.format_contribution(contribution)
|
14
13
|
OpenStruct.new(
|
15
|
-
id: contribution[
|
16
|
-
amount: contribution[
|
17
|
-
fund: contribution[
|
18
|
-
sub_fund: contribution[
|
19
|
-
date: contribution[
|
14
|
+
id: contribution['@id'],
|
15
|
+
amount: contribution['amount'],
|
16
|
+
fund: contribution['fund']['name'],
|
17
|
+
sub_fund: contribution['subFund']['name'],
|
18
|
+
date: contribution['receivedDate'],
|
19
|
+
fund_type_id: contribution['fund']['fundTypeID']
|
20
20
|
)
|
21
21
|
end
|
22
22
|
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.1
|
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-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -188,13 +188,13 @@ extra_rdoc_files: []
|
|
188
188
|
files:
|
189
189
|
- ".gitignore"
|
190
190
|
- Gemfile
|
191
|
-
- Gemfile.lock
|
192
191
|
- README.md
|
193
192
|
- Rakefile
|
194
193
|
- fellowshipone.gemspec
|
195
194
|
- lib/fellowshipone.rb
|
196
195
|
- lib/fellowshipone/client.rb
|
197
196
|
- lib/fellowshipone/connection.rb
|
197
|
+
- lib/fellowshipone/error.rb
|
198
198
|
- lib/fellowshipone/resources/communication.rb
|
199
199
|
- lib/fellowshipone/resources/contribution.rb
|
200
200
|
- lib/fellowshipone/resources/fund.rb
|
@@ -226,8 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
|
-
|
230
|
-
rubygems_version: 2.6.13
|
229
|
+
rubygems_version: 3.1.6
|
231
230
|
signing_key:
|
232
231
|
specification_version: 4
|
233
232
|
summary: Ruby gem/plugin to interact with the FellowshipOne API (https://developer.fellowshipone.com/).
|
data/Gemfile.lock
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fellowshipone (1.3.0)
|
5
|
-
addressable
|
6
|
-
faraday
|
7
|
-
faraday_middleware
|
8
|
-
hashie
|
9
|
-
json
|
10
|
-
simple_oauth
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: http://rubygems.org/
|
14
|
-
specs:
|
15
|
-
addressable (2.3.7)
|
16
|
-
crack (0.4.2)
|
17
|
-
safe_yaml (~> 1.0.0)
|
18
|
-
faraday (0.9.2)
|
19
|
-
multipart-post (>= 1.2, < 3)
|
20
|
-
faraday_middleware (0.10.0)
|
21
|
-
faraday (>= 0.7.4, < 0.10)
|
22
|
-
hashie (3.4.3)
|
23
|
-
json (1.8.3)
|
24
|
-
minitest (5.5.1)
|
25
|
-
multipart-post (2.0.0)
|
26
|
-
rake (10.4.2)
|
27
|
-
safe_yaml (1.0.4)
|
28
|
-
simple_oauth (0.3.1)
|
29
|
-
vcr (2.9.3)
|
30
|
-
webmock (1.20.4)
|
31
|
-
addressable (>= 2.3.6)
|
32
|
-
crack (>= 0.3.2)
|
33
|
-
|
34
|
-
PLATFORMS
|
35
|
-
ruby
|
36
|
-
|
37
|
-
DEPENDENCIES
|
38
|
-
bundler
|
39
|
-
fellowshipone!
|
40
|
-
minitest
|
41
|
-
rake
|
42
|
-
vcr
|
43
|
-
webmock
|
44
|
-
|
45
|
-
BUNDLED WITH
|
46
|
-
1.10.6
|