action_network_rest 0.8.1 → 0.8.2
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 +4 -4
- data/.github/workflows/ci.yml +24 -0
- data/.rubocop.yml +4 -0
- data/.ruby-version +1 -1
- data/README.md +1 -1
- data/lib/action_network_rest/api.rb +20 -0
- data/lib/action_network_rest/client.rb +1 -1
- data/lib/action_network_rest/response/raise_error.rb +34 -0
- data/lib/action_network_rest/version.rb +1 -1
- data/lib/action_network_rest.rb +2 -0
- metadata +9 -7
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 805ab89baf0bfa4fe4635e963cd112a0ffeef25764d200d1d62b759f258db9ec
|
4
|
+
data.tar.gz: 48bcee71e1c6f0bda6e19a7d2dfa3efdc46040f60c6647a1ec030210a456536e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01df31dc26e22c1b9aaad6399ed5a8fbffdf37f17876640aca512840d1e3e73f6da51b0455b830b2c07c6d3b31bf62572ddd19c57753a26aa3fb7de818d0096d
|
7
|
+
data.tar.gz: 85ac9b3aaf713840db2314813ca71ee479e0c0fd8643ca61d96b587a6a1523937d81d0da31d34dcb2cf93b6c655ba5a1c999a13b154500e2f764d2a831f098a1
|
@@ -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/.rubocop.yml
CHANGED
@@ -4,8 +4,12 @@ require:
|
|
4
4
|
AllCops:
|
5
5
|
NewCops: enable
|
6
6
|
TargetRubyVersion: 2.6
|
7
|
+
Metrics/AbcSize:
|
8
|
+
Enabled: false
|
7
9
|
Metrics/BlockLength:
|
8
10
|
Enabled: false
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Enabled: false
|
9
13
|
Naming/AccessorMethodName:
|
10
14
|
Enabled: false
|
11
15
|
Naming/MemoizedInstanceVariableName:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.4
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Ruby client for interacting with the [ActionNetwork REST API](https://actionnetwork.org/docs/) from the engineering team at [ControlShift](https://www.controlshiftlabs.com/).
|
4
4
|
|
5
|
-
[](https://github.com/controlshift/action-network-rest/actions/workflows/ci.yml)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionNetworkRest
|
4
|
+
class API < Vertebrae::API
|
5
|
+
def setup
|
6
|
+
connection.stack do |builder|
|
7
|
+
builder.use Faraday::Request::Multipart
|
8
|
+
builder.use Faraday::Request::UrlEncoded
|
9
|
+
|
10
|
+
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
11
|
+
|
12
|
+
builder.use FaradayMiddleware::Mashify
|
13
|
+
builder.use FaradayMiddleware::ParseJson
|
14
|
+
|
15
|
+
builder.use ActionNetworkRest::Response::RaiseError
|
16
|
+
builder.adapter connection.configuration.adapter
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionNetworkRest
|
4
|
+
module Response
|
5
|
+
class RaiseError < Faraday::Response::Middleware
|
6
|
+
# rubocop:disable Style/GuardClause
|
7
|
+
def on_complete(response)
|
8
|
+
status_code = response[:status].to_i
|
9
|
+
|
10
|
+
if (400...600).cover? status_code
|
11
|
+
if status_code == 400 && response[:body].include?('error')
|
12
|
+
error_hsh = JSON.parse(response[:body])
|
13
|
+
error_message = error_hsh['error']
|
14
|
+
|
15
|
+
if error_message == 'You must specify a valid person id'
|
16
|
+
raise MustSpecifyValidPersonId, error_message(response)
|
17
|
+
end
|
18
|
+
else
|
19
|
+
raise ResponseError, error_message(response)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# rubocop:enable Style/GuardClause
|
24
|
+
|
25
|
+
def error_message(response)
|
26
|
+
"#{response[:method].to_s.upcase} #{response[:url]}: #{response[:status]} \n\n #{response[:body]}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class MustSpecifyValidPersonId < StandardError; end
|
31
|
+
|
32
|
+
class ResponseError < StandardError; end
|
33
|
+
end
|
34
|
+
end
|
data/lib/action_network_rest.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_network_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grey Moore
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vertebrae
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 3.8.3
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email:
|
141
141
|
- grey@controlshiftlabs.com
|
142
142
|
executables: []
|
@@ -144,11 +144,11 @@ extensions: []
|
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
146
|
- ".env.sample"
|
147
|
+
- ".github/workflows/ci.yml"
|
147
148
|
- ".gitignore"
|
148
149
|
- ".rubocop.yml"
|
149
150
|
- ".ruby-gemset"
|
150
151
|
- ".ruby-version"
|
151
|
-
- ".travis.yml"
|
152
152
|
- CODE_OF_CONDUCT.md
|
153
153
|
- Gemfile
|
154
154
|
- LICENSE
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- bin/rspec
|
161
161
|
- example.rb
|
162
162
|
- lib/action_network_rest.rb
|
163
|
+
- lib/action_network_rest/api.rb
|
163
164
|
- lib/action_network_rest/attendances.rb
|
164
165
|
- lib/action_network_rest/base.rb
|
165
166
|
- lib/action_network_rest/client.rb
|
@@ -168,6 +169,7 @@ files:
|
|
168
169
|
- lib/action_network_rest/events.rb
|
169
170
|
- lib/action_network_rest/people.rb
|
170
171
|
- lib/action_network_rest/petitions.rb
|
172
|
+
- lib/action_network_rest/response/raise_error.rb
|
171
173
|
- lib/action_network_rest/signatures.rb
|
172
174
|
- lib/action_network_rest/taggings.rb
|
173
175
|
- lib/action_network_rest/tags.rb
|
@@ -176,7 +178,7 @@ homepage: https://github.com/controlshift/action-network-rest
|
|
176
178
|
licenses:
|
177
179
|
- MIT
|
178
180
|
metadata: {}
|
179
|
-
post_install_message:
|
181
|
+
post_install_message:
|
180
182
|
rdoc_options: []
|
181
183
|
require_paths:
|
182
184
|
- lib
|
@@ -192,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
194
|
version: '0'
|
193
195
|
requirements: []
|
194
196
|
rubygems_version: 3.1.6
|
195
|
-
signing_key:
|
197
|
+
signing_key:
|
196
198
|
specification_version: 4
|
197
199
|
summary: Ruby client for interacting with the ActionNetwork REST API
|
198
200
|
test_files: []
|