action_network_rest 0.8.2 → 0.9.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
  SHA256:
3
- metadata.gz: 805ab89baf0bfa4fe4635e963cd112a0ffeef25764d200d1d62b759f258db9ec
4
- data.tar.gz: 48bcee71e1c6f0bda6e19a7d2dfa3efdc46040f60c6647a1ec030210a456536e
3
+ metadata.gz: f9016ae9e2c22b78c042639d589683ff591c4098712cad0861dc8faab843c82a
4
+ data.tar.gz: 114f680aead1e7b3500c26fb61175784046bf68db57ac62137df455f98f1789e
5
5
  SHA512:
6
- metadata.gz: 01df31dc26e22c1b9aaad6399ed5a8fbffdf37f17876640aca512840d1e3e73f6da51b0455b830b2c07c6d3b31bf62572ddd19c57753a26aa3fb7de818d0096d
7
- data.tar.gz: 85ac9b3aaf713840db2314813ca71ee479e0c0fd8643ca61d96b587a6a1523937d81d0da31d34dcb2cf93b6c655ba5a1c999a13b154500e2f764d2a831f098a1
6
+ metadata.gz: 7f811528d9ffe857652121e3c3bf42b517b9991a5335dd52fd99c02d36b3a75688bbc403c16aca0cdd619a4efc96fc3d5f50cb7d4fcddc2b01731c068c85e03b
7
+ data.tar.gz: b4db252bd30f7aeee2f3d402f287104212e51a7cf2e745773767d63f577a9d1c9131b4162b671b0568108b1b7d6e7e23434ed5d1016c949eb5e613238722c5fb
@@ -2,6 +2,8 @@
2
2
 
3
3
  module ActionNetworkRest
4
4
  class Attendances < Base
5
+ class CreateError < StandardError; end
6
+
5
7
  attr_accessor :event_campaign_id, :event_id
6
8
 
7
9
  def base_path
@@ -14,7 +16,15 @@ module ActionNetworkRest
14
16
 
15
17
  def create(attendance_data)
16
18
  response = client.post_request base_path, attendance_data
17
- object_from_response(response)
19
+ new_attendance = object_from_response(response)
20
+
21
+ # Action Network treats the attendance create helper endpoint as an unauthenticated
22
+ # "blind" POST (see https://actionnetwork.org/docs/v2/unauthenticated-post/). For this
23
+ # reason they don't return a status code with error to avoid leaking private data. Instead
24
+ # they return 200 OK with an empty body (vs. the newly created attendance's data for successful calls)
25
+ raise CreateError if new_attendance.empty?
26
+
27
+ new_attendance
18
28
  end
19
29
 
20
30
  def update(id, attendance_data)
@@ -15,6 +15,8 @@ module ActionNetworkRest
15
15
  if error_message == 'You must specify a valid person id'
16
16
  raise MustSpecifyValidPersonId, error_message(response)
17
17
  end
18
+ elsif status_code == 404
19
+ raise NotFoundError, error_message(response)
18
20
  else
19
21
  raise ResponseError, error_message(response)
20
22
  end
@@ -29,6 +31,8 @@ module ActionNetworkRest
29
31
 
30
32
  class MustSpecifyValidPersonId < StandardError; end
31
33
 
34
+ class NotFoundError < StandardError; end
35
+
32
36
  class ResponseError < StandardError; end
33
37
  end
34
38
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module ActionNetworkRest
4
4
  class Signatures < Base
5
+ class CreateError < StandardError; end
6
+
5
7
  attr_accessor :petition_id
6
8
 
7
9
  def base_path
@@ -13,7 +15,15 @@ module ActionNetworkRest
13
15
  post_body['add_tags'] = tags if tags.any?
14
16
 
15
17
  response = client.post_request(base_path, post_body)
16
- object_from_response(response)
18
+ new_signature = object_from_response(response)
19
+
20
+ # Action Network treats the signature create helper endpoint as an unauthenticated
21
+ # "blind" POST (see https://actionnetwork.org/docs/v2/unauthenticated-post/). For this
22
+ # reason they don't return a status code with error to avoid leaking private data. Instead
23
+ # they return 200 OK with an empty body (vs. the newly created signature's data for successful calls)
24
+ raise CreateError if new_signature.empty?
25
+
26
+ new_signature
17
27
  end
18
28
 
19
29
  def update(id, signature_data)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionNetworkRest
4
- VERSION = '0.8.2'
4
+ VERSION = '0.9.0'
5
5
  end
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.2
4
+ version: 0.9.0
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-09-23 00:00:00.000000000 Z
11
+ date: 2021-09-30 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: []
@@ -178,7 +178,7 @@ homepage: https://github.com/controlshift/action-network-rest
178
178
  licenses:
179
179
  - MIT
180
180
  metadata: {}
181
- post_install_message:
181
+ post_install_message:
182
182
  rdoc_options: []
183
183
  require_paths:
184
184
  - lib
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubygems_version: 3.1.6
197
- signing_key:
197
+ signing_key:
198
198
  specification_version: 4
199
199
  summary: Ruby client for interacting with the ActionNetwork REST API
200
200
  test_files: []